]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree.def (VOID_CST): New.
authorRichard Sandiford <rsandifo@linux.vnet.ibm.com>
Wed, 21 May 2014 11:00:35 +0000 (11:00 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Wed, 21 May 2014 11:00:35 +0000 (11:00 +0000)
gcc/
* tree.def (VOID_CST): New.
* tree-core.h (TI_VOID): New.
* tree.h (void_node): New.
* tree.c (tree_node_structure_for_code, tree_code_size)
(iterative_hash_expr): Handle VOID_CST.
(build_common_tree_nodes): Initialize void_node.

gcc/c-family/
* c-common.h (CTI_VOID_ZERO, void_zero_node): Delete.
* c-common.c (c_common_nodes_and_builtins): Don't initialize
void_zero_node.
* c-pretty-print.c (pp_c_void_constant): New function.
(c_pretty_printer::constant, c_pretty_printer::primary_expression)
(c_pretty_printer::expression): Handle VOID_CST.
* cilk.c (extract_free_variables): Likewise.
* c-ubsan.c (ubsan_instrument_division, ubsan_instrument_shift)
(ubsan_instrument_vla): Use void_node instead of void_zero_node.

gcc/c/
* c-array-notation.c (expand_array_notations): Use void_node
instead of void_zero_node.

gcc/cp/
* cvt.c (convert_to_void): Use void_node instead of void_zero_node.
* cp-array-notation.c (replace_invariant_exprs): Likewise.
(expand_array_notation): Handle VOID_CST.
* error.c (dump_expr): Likewise.
* cxx-pretty-print.c (cxx_pretty_printer::primary_expression)
(cxx_pretty_printer::expression): Likewise.
(pp_cxx_new_expression): Use void_node instead of void_zero_node.
* decl.c (register_dtor_fn): Likewise.
* init.c (build_raw_new_expr, build_new_1, build_vec_init)
(build_delete, push_base_cleanups): Likewise.
* mangle.c (write_expression): Likewise.
* semantics.c (finish_break_stmt, empty_expr_stmt_p): Likewise.
* pt.c (tsubst_decl, tsubst_copy_and_build): Likewise.
(tsubst, tsubst_copy, build_non_dependent_expr): Handle VOID_CST.
* tree.c (cp_tree_equal): Likewise.
(build_dummy_object, is_dummy_object, stabilize_expr): Use void_node
instead of void_zero_node.
* typeck.c (check_return_expr): Likewise.
* typeck2.c (build_functional_cast): Likewise.

From-SVN: r210692

26 files changed:
gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-common.c
gcc/c-family/c-common.h
gcc/c-family/c-pretty-print.c
gcc/c-family/c-ubsan.c
gcc/c-family/cilk.c
gcc/c/ChangeLog
gcc/c/c-array-notation.c
gcc/cp/ChangeLog
gcc/cp/cp-array-notation.c
gcc/cp/cvt.c
gcc/cp/cxx-pretty-print.c
gcc/cp/decl.c
gcc/cp/error.c
gcc/cp/init.c
gcc/cp/mangle.c
gcc/cp/pt.c
gcc/cp/semantics.c
gcc/cp/tree.c
gcc/cp/typeck.c
gcc/cp/typeck2.c
gcc/tree-core.h
gcc/tree.c
gcc/tree.def
gcc/tree.h

index b0a42b9a341d682c5def0ad17f8187da27fda698..499200eb28498fd133ca31bd456558cedb002a58 100644 (file)
@@ -1,3 +1,12 @@
+2014-05-21  Richard Sandiford  <rsandifo@linux.vnet.ibm.com>
+
+       * tree.def (VOID_CST): New.
+       * tree-core.h (TI_VOID): New.
+       * tree.h (void_node): New.
+       * tree.c (tree_node_structure_for_code, tree_code_size)
+       (iterative_hash_expr): Handle VOID_CST.
+       (build_common_tree_nodes): Initialize void_node.
+
 2014-05-21  Bernd Schmidt  <bernds@codesourcery.com>
 
        * reload1.c (remove_init_insns, will_delete_init_insn_p): New static
index c88cf59c459c1636e3c62c338f3e97ee41b0bb56..d0bfc27394c7c92fa15cc2f5dffe21d4dc1e63dd 100644 (file)
@@ -1,3 +1,15 @@
+2014-05-21  Richard Sandiford  <rsandifo@linux.vnet.ibm.com>
+
+       * c-common.h (CTI_VOID_ZERO, void_zero_node): Delete.
+       * c-common.c (c_common_nodes_and_builtins): Don't initialize
+       void_zero_node.
+       * c-pretty-print.c (pp_c_void_constant): New function.
+       (c_pretty_printer::constant, c_pretty_printer::primary_expression)
+       (c_pretty_printer::expression): Handle VOID_CST.
+       * cilk.c (extract_free_variables): Likewise.
+       * c-ubsan.c (ubsan_instrument_division, ubsan_instrument_shift)
+       (ubsan_instrument_vla): Use void_node instead of void_zero_node.
+
 2014-05-17  Trevor Saunders  <tsaunders@mozilla.com>
 
        * c-common.h (sorted_fields_type): Remove variable_size GTY attribute.
index a120b5cb008721e257fd69d523bee4e7bb1e762a..c8d9e0c535972ad7a089eb4626567e679763104a 100644 (file)
@@ -5524,10 +5524,6 @@ c_common_nodes_and_builtins (void)
     TYPE_NAME (void_type_node) = void_name;
   }
 
-  /* This node must not be shared.  */
-  void_zero_node = make_int_cst (1, 1);
-  TREE_TYPE (void_zero_node) = void_type_node;
-
   void_list_node = build_void_list_node ();
 
   /* Make a type to be the domain of a few array types
index 59e809a1886c01a3d411e864ee09add946040e73..edd43b687e20acb1fb609bd0e3d48c49ba1e30df 100644 (file)
@@ -297,8 +297,6 @@ enum c_tree_index
     CTI_C99_FUNCTION_NAME_DECL,
     CTI_SAVED_FUNCTION_NAME_DECLS,
 
-    CTI_VOID_ZERO,
-
     CTI_NULL,
 
     CTI_MAX
@@ -430,9 +428,6 @@ extern const unsigned int num_c_common_reswords;
 #define c99_function_name_decl_node            c_global_trees[CTI_C99_FUNCTION_NAME_DECL]
 #define saved_function_name_decls      c_global_trees[CTI_SAVED_FUNCTION_NAME_DECLS]
 
-/* A node for `((void) 0)'.  */
-#define void_zero_node                  c_global_trees[CTI_VOID_ZERO]
-
 /* The node for C++ `__null'.  */
 #define null_node                       c_global_trees[CTI_NULL]
 
index 2e97d0147c5224db7e98b0bb615e43bfdbc071dc..9ac8cbaa2a9a18a42275d95e64a36d2596e72015 100644 (file)
@@ -906,6 +906,15 @@ pp_c_string_literal (c_pretty_printer *pp, tree s)
   pp_doublequote (pp);
 }
 
+/* Pretty-print a VOID_CST (void_node).  */
+
+static void
+pp_c_void_constant (c_pretty_printer *pp)
+{
+  pp_c_type_cast (pp, void_type_node);
+  pp_string (pp, "0");
+}
+
 /* Pretty-print an INTEGER literal.  */
 
 static void
@@ -1136,6 +1145,10 @@ c_pretty_printer::constant (tree e)
 
   switch (code)
     {
+    case VOID_CST:
+      pp_c_void_constant (this);
+      break;
+
     case INTEGER_CST:
       {
        tree type = TREE_TYPE (e);
@@ -1241,6 +1254,7 @@ c_pretty_printer::primary_expression (tree e)
       translate_string ("<return-value>");
       break;
 
+    case VOID_CST:
     case INTEGER_CST:
     case REAL_CST:
     case FIXED_CST:
@@ -2131,6 +2145,10 @@ c_pretty_printer::expression (tree e)
 {
   switch (TREE_CODE (e))
     {
+    case VOID_CST:
+      pp_c_void_constant (this);
+      break;
+
     case INTEGER_CST:
       pp_c_integer_constant (this, e);
       break;
index a0397925fe7aa9db4427782a14740b3fbb5d1f05..8d5b6856f8748c9b439e51a3b3e197131e185e59 100644 (file)
@@ -95,7 +95,7 @@ ubsan_instrument_division (location_t loc, tree op0, tree op1)
       tt = build_call_expr_loc (loc, tt, 3, data, ubsan_encode_value (op0),
                                ubsan_encode_value (op1));
     }
-  t = fold_build3 (COND_EXPR, void_type_node, t, tt, void_zero_node);
+  t = fold_build3 (COND_EXPR, void_type_node, t, tt, void_node);
 
   return t;
 }
@@ -178,7 +178,7 @@ ubsan_instrument_shift (location_t loc, enum tree_code code,
       tt = build_call_expr_loc (loc, tt, 3, data, ubsan_encode_value (op0),
                                ubsan_encode_value (op1));
     }
-  t = fold_build3 (COND_EXPR, void_type_node, t, tt, void_zero_node);
+  t = fold_build3 (COND_EXPR, void_type_node, t, tt, void_node);
 
   return t;
 }
@@ -207,7 +207,7 @@ ubsan_instrument_vla (location_t loc, tree size)
       tt = builtin_decl_explicit (bcode);
       tt = build_call_expr_loc (loc, tt, 2, data, ubsan_encode_value (size));
     }
-  t = fold_build3 (COND_EXPR, void_type_node, t, tt, void_zero_node);
+  t = fold_build3 (COND_EXPR, void_type_node, t, tt, void_node);
 
   return t;
 }
index a952902533a11c618dcb6af25959f104e7c7069e..8bdcdcfaad577298ff3a70c29c886e2bc74d8d89 100644 (file)
@@ -997,6 +997,7 @@ extract_free_variables (tree t, struct wrapper_data *wd,
     {
     case ERROR_MARK:
     case IDENTIFIER_NODE:
+    case VOID_CST:
     case INTEGER_CST:
     case REAL_CST:
     case FIXED_CST:
index 1266d4ea96997d354c1db02b6a95c529c1db4f89..76d5c4671bd27da41d9ed64b640a10a88fab6ccc 100644 (file)
@@ -1,3 +1,8 @@
+2014-05-21  Richard Sandiford  <rsandifo@linux.vnet.ibm.com>
+
+       * c-array-notation.c (expand_array_notations): Use void_node
+       instead of void_zero_node.
+
 2014-05-17  Trevor Saunders  <tsaunders@mozilla.com>
 
        * c-decl.c (finish_struct): Adjust.
index 0ac6ba8e119c523c50828e2562d26074dec2aab1..a01269742ce1c3c49600f0a8b6d47ec19fefd3f0 100644 (file)
@@ -1279,7 +1279,7 @@ expand_array_notations (tree *tp, int *walk_subtrees, void *)
         A[x:y:z];
         A[x:y];
         Replace those with just void zero node.  */
-      *tp = void_zero_node;
+      *tp = void_node;
     default:
       break;
     }
index 790b87e009067b804029514af9274d07ea7a2aea..adde47f5569dfa75c268f3a99e9c5c7b3946dee1 100644 (file)
@@ -1,3 +1,25 @@
+2014-05-21  Richard Sandiford  <rsandifo@linux.vnet.ibm.com>
+
+       * cvt.c (convert_to_void): Use void_node instead of void_zero_node.
+       * cp-array-notation.c (replace_invariant_exprs): Likewise.
+       (expand_array_notation): Handle VOID_CST.
+       * error.c (dump_expr): Likewise.
+       * cxx-pretty-print.c (cxx_pretty_printer::primary_expression)
+       (cxx_pretty_printer::expression): Likewise.
+       (pp_cxx_new_expression): Use void_node instead of void_zero_node.
+       * decl.c (register_dtor_fn): Likewise.
+       * init.c (build_raw_new_expr, build_new_1, build_vec_init)
+       (build_delete, push_base_cleanups): Likewise.
+       * mangle.c (write_expression): Likewise.
+       * semantics.c (finish_break_stmt, empty_expr_stmt_p): Likewise.
+       * pt.c (tsubst_decl, tsubst_copy_and_build): Likewise.
+       (tsubst, tsubst_copy, build_non_dependent_expr): Handle VOID_CST.
+       * tree.c (cp_tree_equal): Likewise.
+       (build_dummy_object, is_dummy_object, stabilize_expr): Use void_node
+       instead of void_zero_node.
+       * typeck.c (check_return_expr): Likewise.
+       * typeck2.c (build_functional_cast): Likewise.
+
 2014-05-21  Igor Zamyatin  <igor.zamyatin@intel.com>
 
        PR c/60189
index 65b8bcb81695731ce3d18257f9335a5a63c4e6e8..0ff0967d36379432ffaa9770938cdec71db0e5c0 100644 (file)
@@ -181,7 +181,7 @@ replace_invariant_exprs (tree *node)
          if (VOID_TYPE_P (TREE_TYPE (t)))
            {
              finish_expr_stmt (t);
-             new_var = void_zero_node;
+             new_var = void_node;
            }
          else 
            new_var = get_temp_regvar (TREE_TYPE (t), t); 
@@ -1126,6 +1126,7 @@ expand_array_notation_exprs (tree t)
     {
     case ERROR_MARK:
     case IDENTIFIER_NODE:
+    case VOID_CST:
     case INTEGER_CST:
     case REAL_CST:
     case FIXED_CST:
index 9b066b9f80666fd67c4e2f667658bf92ec162748..2a827237f2883d68e0dff6148e90872edabb2fdf 100644 (file)
@@ -1285,7 +1285,7 @@ convert_to_void (tree expr, impl_conv_void implicit, tsubst_flags_t complain)
            }
        else
          return error_mark_node;
-       expr = void_zero_node;
+       expr = void_node;
       }
     else if (implicit != ICV_CAST && probe == expr && is_overloaded_fn (probe))
       {
@@ -1415,7 +1415,7 @@ convert_to_void (tree expr, impl_conv_void implicit, tsubst_flags_t complain)
       expr = build1 (CONVERT_EXPR, void_type_node, expr);
     }
   if (! TREE_SIDE_EFFECTS (expr))
-    expr = void_zero_node;
+    expr = void_node;
   return expr;
 }
 
index c39fb7d7165a9e7f792c791ff8a3f31fc2152142..f5f91c804c1812616833d6fa5d2d62c253a7c796 100644 (file)
@@ -403,6 +403,7 @@ cxx_pretty_printer::primary_expression (tree t)
 {
   switch (TREE_CODE (t))
     {
+    case VOID_CST:
     case INTEGER_CST:
     case REAL_CST:
     case COMPLEX_CST:
@@ -690,7 +691,7 @@ pp_cxx_new_expression (cxx_pretty_printer *pp, tree t)
          pp_left_paren (pp);
          if (TREE_CODE (init) == TREE_LIST)
            pp_c_expression_list (pp, init);
-         else if (init == void_zero_node)
+         else if (init == void_node)
            ;                   /* OK, empty initializer list.  */
          else
            pp->expression (init);
@@ -1028,6 +1029,7 @@ cxx_pretty_printer::expression (tree t)
   switch (TREE_CODE (t))
     {
     case STRING_CST:
+    case VOID_CST:
     case INTEGER_CST:
     case REAL_CST:
     case COMPLEX_CST:
index ab91928cf4294cb52ba5f7ba34b52a84d7d024a6..3752d17fad1a2be3e78f167af4459c60b1ccd0bc 100644 (file)
@@ -6830,7 +6830,7 @@ register_dtor_fn (tree decl)
 
   type = TREE_TYPE (decl);
   if (TYPE_HAS_TRIVIAL_DESTRUCTOR (type))
-    return void_zero_node;
+    return void_node;
 
   /* If we're using "__cxa_atexit" (or "__cxa_thread_atexit" or
      "__aeabi_atexit"), and DECL is a class object, we can just pass the
@@ -7077,7 +7077,7 @@ expand_static_init (tree decl, tree init)
 
          TARGET_EXPR_CLEANUP (begin)
            = build3 (COND_EXPR, void_type_node, flag,
-                     void_zero_node,
+                     void_node,
                      build_call_n (abort_fn, 1, guard_addr));
          CLEANUP_EH_ONLY (begin) = 1;
 
@@ -8425,7 +8425,7 @@ compute_array_index_type (tree name, tree size, tsubst_flags_t complain)
              tree comp = build2 (LT_EXPR, boolean_type_node, itype,
                                  ssize_int (-1));
              comp = build3 (COND_EXPR, void_type_node, comp,
-                            throw_bad_array_length (), void_zero_node);
+                            throw_bad_array_length (), void_node);
              finish_expr_stmt (comp);
            }
          else if (flag_sanitize & SANITIZE_VLA)
index 699d5458a40f0b82145c18b563f2fd622af02c88..b3b5bbb0971405acd7a6b287b6295f636f0b4f8e 100644 (file)
@@ -1913,6 +1913,7 @@ dump_expr (cxx_pretty_printer *pp, tree t, int flags)
        pp_cxx_ws_string (pp, M_("<unknown>"));
       break;
 
+    case VOID_CST:
     case INTEGER_CST:
     case REAL_CST:
     case STRING_CST:
index 42b25db9916c3b20c05c1e742e3f99bc6b9c3347..8edf5193750440a758ed81f315378e5c1b471622 100644 (file)
@@ -2120,7 +2120,7 @@ build_raw_new_expr (vec<tree, va_gc> *placement, tree type, tree nelts,
   if (init == NULL)
     init_list = NULL_TREE;
   else if (init->is_empty ())
-    init_list = void_zero_node;
+    init_list = void_node;
   else
     init_list = build_tree_list_vec (init);
 
@@ -2935,7 +2935,7 @@ build_new_1 (vec<tree, va_gc> **placement, tree type, tree nelts,
 
              TARGET_EXPR_CLEANUP (begin)
                = build3 (COND_EXPR, void_type_node, sentry,
-                         cleanup, void_zero_node);
+                         cleanup, void_node);
 
              end = build2 (MODIFY_EXPR, TREE_TYPE (sentry),
                            sentry, boolean_false_node);
@@ -3598,7 +3598,7 @@ build_vec_init (tree base, tree maxindex, tree init,
          else
            throw_call = throw_bad_array_new_length ();
          length_check = build3 (COND_EXPR, void_type_node, length_check,
-                                throw_call, void_zero_node);
+                                throw_call, void_node);
          finish_expr_stmt (length_check);
        }
 
@@ -4020,7 +4020,7 @@ build_delete (tree otype, tree addr, special_function_kind auto_delete,
        }
 
       if (auto_delete != sfk_deleting_destructor)
-       return void_zero_node;
+       return void_node;
 
       return build_op_delete_call (DELETE_EXPR, addr,
                                   cxx_sizeof_nowarn (type),
@@ -4108,8 +4108,7 @@ build_delete (tree otype, tree addr, special_function_kind auto_delete,
        }
 
       if (ifexp != integer_one_node)
-       expr = build3 (COND_EXPR, void_type_node,
-                      ifexp, expr, void_zero_node);
+       expr = build3 (COND_EXPR, void_type_node, ifexp, expr, void_node);
 
       return expr;
     }
@@ -4154,7 +4153,7 @@ push_base_cleanups (void)
              if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (BINFO_TYPE (base_binfo)))
                {
                  expr = build3 (COND_EXPR, void_type_node, cond,
-                                expr, void_zero_node);
+                                expr, void_node);
                  finish_decl_cleanup (NULL_TREE, expr);
                }
            }
index 34a0c958108b28265b53fde35b287cca7e45f9ef..4205fecfc949a1995659d963f2bf131ae49f1b89 100644 (file)
@@ -2812,7 +2812,7 @@ write_expression (tree expr)
        {
          if (init)
            write_string ("pi");
-         if (init && init != void_zero_node)
+         if (init && init != void_node)
            for (t = init; t; t = TREE_CHAIN (t))
              write_expression (TREE_VALUE (t));
          write_char ('E');
index fca1ab34d0512dd327cc0540b18acf6617d1d76d..2ebe0159491cb9ee68acf41e4ee99cb2732f11c9 100644 (file)
@@ -10911,7 +10911,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
                /* Set up DECL_TEMPLATE_INFO so that we can get at the
                   NSDMI in perform_member_init.  Still set DECL_INITIAL
                   so that we know there is one.  */
-               DECL_INITIAL (r) = void_zero_node;
+               DECL_INITIAL (r) = void_node;
                gcc_assert (DECL_LANG_SPECIFIC (r) == NULL);
                retrofit_lang_decl (r);
                DECL_TEMPLATE_INFO (r) = build_template_info (t, args);
@@ -12286,6 +12286,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
       }
       break;
 
+    case VOID_CST:
     case INTEGER_CST:
     case REAL_CST:
     case STRING_CST:
@@ -13054,6 +13055,10 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
       error ("use %<...%> to expand argument pack");
       return error_mark_node;
 
+    case VOID_CST:
+      gcc_checking_assert (t == void_node && VOID_TYPE_P (TREE_TYPE (t)));
+      return t;
+
     case INTEGER_CST:
     case REAL_CST:
     case STRING_CST:
@@ -14600,7 +14605,7 @@ tsubst_copy_and_build (tree t,
        else
          {
            init_vec = make_tree_vector ();
-           if (init == void_zero_node)
+           if (init == void_node)
              gcc_assert (init_vec != NULL);
            else
              {
@@ -15261,9 +15266,9 @@ tsubst_copy_and_build (tree t,
        cur_stmt_expr = old_stmt_expr;
 
        /* If the resulting list of expression statement is empty,
-          fold it further into void_zero_node.  */
+          fold it further into void_node.  */
        if (empty_expr_stmt_p (stmt_expr))
-         stmt_expr = void_zero_node;
+         stmt_expr = void_node;
 
        RETURN (stmt_expr);
       }
@@ -21550,9 +21555,11 @@ build_non_dependent_expr (tree expr)
      cannot be used to initialize a "char *".  */
   if (TREE_CODE (expr) == STRING_CST)
     return expr;
-  /* Preserve arithmetic constants, as an optimization -- there is no
+  /* Preserve void and arithmetic constants, as an optimization -- there is no
      reason to create a new node.  */
-  if (TREE_CODE (expr) == INTEGER_CST || TREE_CODE (expr) == REAL_CST)
+  if (TREE_CODE (expr) == VOID_CST
+      || TREE_CODE (expr) == INTEGER_CST
+      || TREE_CODE (expr) == REAL_CST)
     return expr;
   /* Preserve THROW_EXPRs -- all throw-expressions have type "void".
      There is at least one place where we want to know that a
index 6c5bdf7391b51552789323d9e7ca6d15bf80e578..7e144a6734c3855ddcbee5e01030ba1de8d12412 100644 (file)
@@ -1083,7 +1083,7 @@ finish_break_stmt (void)
      block_may_fallthru returns true when given something it does not
      understand.  */
   if (!block_may_fallthru (cur_stmt_list))
-    return void_zero_node;
+    return void_node;
   return add_stmt (build_stmt (input_location, BREAK_STMT));
 }
 
@@ -2095,7 +2095,7 @@ empty_expr_stmt_p (tree expr_stmt)
 {
   tree body = NULL_TREE;
 
-  if (expr_stmt == void_zero_node)
+  if (expr_stmt == void_node)
     return true;
 
   if (expr_stmt)
index 229d47620d60ba23b956393e0c71dd04ad452fb2..21c9a82bbdaa4e8a7653e92388df84f019d94772 100644 (file)
@@ -2620,6 +2620,11 @@ cp_tree_equal (tree t1, tree t2)
 
   switch (code1)
     {
+    case VOID_CST:
+      /* There's only a single VOID_CST node, so we should never reach
+        here.  */
+      gcc_unreachable ();
+
     case INTEGER_CST:
       return tree_int_cst_equal (t1, t2);
 
@@ -2947,7 +2952,7 @@ member_p (const_tree decl)
 tree
 build_dummy_object (tree type)
 {
-  tree decl = build1 (NOP_EXPR, build_pointer_type (type), void_zero_node);
+  tree decl = build1 (NOP_EXPR, build_pointer_type (type), void_node);
   return cp_build_indirect_ref (decl, RO_NULL, tf_warning_or_error);
 }
 
@@ -2997,7 +3002,7 @@ is_dummy_object (const_tree ob)
   if (INDIRECT_REF_P (ob))
     ob = TREE_OPERAND (ob, 0);
   return (TREE_CODE (ob) == NOP_EXPR
-         && TREE_OPERAND (ob, 0) == void_zero_node);
+         && TREE_OPERAND (ob, 0) == void_node);
 }
 
 /* Returns 1 iff type T is something we want to treat as a scalar type for
@@ -3775,7 +3780,7 @@ stabilize_expr (tree exp, tree* initp)
   else if (VOID_TYPE_P (TREE_TYPE (exp)))
     {
       init_expr = exp;
-      exp = void_zero_node;
+      exp = void_node;
     }
   /* There are no expressions with REFERENCE_TYPE, but there can be call
      arguments with such a type; just treat it as a pointer.  */
index b671c92d730023d7db9fa1f593f20a93c3e5241b..255deafdac42e8650ee73628c346bfc099863c6c 100644 (file)
@@ -8424,7 +8424,7 @@ check_return_expr (tree retval, bool *no_warning)
       else
        {
          if (!retval)
-           retval = void_zero_node;
+           retval = void_node;
          auto_node = type_uses_auto (current_function_auto_return_pattern);
          type = do_auto_deduction (current_function_auto_return_pattern,
                                    retval, auto_node);
index d50d93eb2eab8c265fa63e3853ae89559e812319..e98942d7d2a56b77abf1eb92459c6e0ef463fbf0 100644 (file)
@@ -1888,7 +1888,7 @@ build_functional_cast (tree exp, tree parms, tsubst_flags_t complain)
       if (parms == NULL_TREE)
        {
          if (VOID_TYPE_P (type))
-           return void_zero_node;
+           return void_node;
          return build_value_init (cv_unqualified (type), complain);
        }
 
index 72ef8e143a2142dd61d81d6208f8a42f83545d50..98c3951c6911c7f023dde288fe2c25d782c5bf94 100644 (file)
@@ -410,6 +410,8 @@ enum tree_index {
   TI_UINT32_TYPE,
   TI_UINT64_TYPE,
 
+  TI_VOID,
+
   TI_INTEGER_ZERO,
   TI_INTEGER_ONE,
   TI_INTEGER_THREE,
index 4dd8e73c6cfaeda2bf90bce0f609668a6b85a7d8..22b92f3b6b264aa244a7d199a82d93a28a269514 100644 (file)
@@ -383,6 +383,7 @@ tree_node_structure_for_code (enum tree_code code)
   switch (code)
     {
       /* tcc_constant cases.  */
+    case VOID_CST:             return TS_TYPED;
     case INTEGER_CST:          return TS_INT_CST;
     case REAL_CST:             return TS_REAL_CST;
     case FIXED_CST:            return TS_FIXED_CST;
@@ -652,6 +653,7 @@ tree_code_size (enum tree_code code)
     case tcc_constant:  /* a constant */
       switch (code)
        {
+       case VOID_CST:          return sizeof (struct tree_typed);
        case INTEGER_CST:       gcc_unreachable ();
        case REAL_CST:          return sizeof (struct tree_real_cst);
        case FIXED_CST:         return sizeof (struct tree_fixed_cst);
@@ -7360,6 +7362,8 @@ iterative_hash_expr (const_tree t, hashval_t val)
     {
     /* Alas, constants aren't shared, so we can't rely on pointer
        identity.  */
+    case VOID_CST:
+      return iterative_hash_hashval_t (0, val);
     case INTEGER_CST:
       for (i = 0; i < TREE_INT_CST_NUNITS (t); i++)
        val = iterative_hash_host_wide_int (TREE_INT_CST_ELT (t, i), val);
@@ -9631,6 +9635,9 @@ build_common_tree_nodes (bool signed_char, bool short_double)
   TYPE_ALIGN (void_type_node) = BITS_PER_UNIT;
   TYPE_USER_ALIGN (void_type_node) = 0;
 
+  void_node = make_node (VOID_CST);
+  TREE_TYPE (void_node) = void_type_node;
+
   null_pointer_node = build_int_cst (build_pointer_type (void_type_node), 0);
   layout_type (TREE_TYPE (null_pointer_node));
 
index a6247a7e00a29d0ce260830099ab3c98881af8cd..464c8c7b09946f94c8fd9e2329100cc078e85b6d 100644 (file)
@@ -257,6 +257,8 @@ DEFTREECODE (LANG_TYPE, "lang_type", tcc_type, 0)
 
 /* First, the constants.  */
 
+DEFTREECODE (VOID_CST, "void_cst", tcc_constant, 0)
+
 /* Contents are in an array of HOST_WIDE_INTs.
 
    We often access these constants both in their native precision and
index e0a3084b755d620899217c6e257cad3e043a6981..968b389dd11f38fe483d26bcb4e23ad40c143f2d 100644 (file)
@@ -3246,6 +3246,8 @@ tree_operand_check_code (const_tree __t, enum tree_code __code, int __i,
 #define uint32_type_node               global_trees[TI_UINT32_TYPE]
 #define uint64_type_node               global_trees[TI_UINT64_TYPE]
 
+#define void_node                      global_trees[TI_VOID]
+
 #define integer_zero_node              global_trees[TI_INTEGER_ZERO]
 #define integer_one_node               global_trees[TI_INTEGER_ONE]
 #define integer_three_node              global_trees[TI_INTEGER_THREE]