summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2014-05-21 11:00:35 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2014-05-21 11:00:35 +0000
commit3ab4693e65a50b71c1e8af23f0378f679da3dadd (patch)
tree873a8d60202acd9cd1d79ac86b9a225532e52a1c /gcc
parent2b14b1a37cdb0f70e85de2a6e1d12dbae23ae30e (diff)
downloadgcc-3ab4693e65a50b71c1e8af23f0378f679da3dadd.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@210692 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/c-family/ChangeLog12
-rw-r--r--gcc/c-family/c-common.c4
-rw-r--r--gcc/c-family/c-common.h5
-rw-r--r--gcc/c-family/c-pretty-print.c18
-rw-r--r--gcc/c-family/c-ubsan.c6
-rw-r--r--gcc/c-family/cilk.c1
-rw-r--r--gcc/c/ChangeLog5
-rw-r--r--gcc/c/c-array-notation.c2
-rw-r--r--gcc/cp/ChangeLog22
-rw-r--r--gcc/cp/cp-array-notation.c3
-rw-r--r--gcc/cp/cvt.c4
-rw-r--r--gcc/cp/cxx-pretty-print.c4
-rw-r--r--gcc/cp/decl.c6
-rw-r--r--gcc/cp/error.c1
-rw-r--r--gcc/cp/init.c13
-rw-r--r--gcc/cp/mangle.c2
-rw-r--r--gcc/cp/pt.c19
-rw-r--r--gcc/cp/semantics.c4
-rw-r--r--gcc/cp/tree.c11
-rw-r--r--gcc/cp/typeck.c2
-rw-r--r--gcc/cp/typeck2.c2
-rw-r--r--gcc/tree-core.h2
-rw-r--r--gcc/tree.c7
-rw-r--r--gcc/tree.def2
-rw-r--r--gcc/tree.h2
26 files changed, 127 insertions, 41 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b0a42b9a341..499200eb284 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index c88cf59c459..d0bfc27394c 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -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.
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index a120b5cb008..c8d9e0c5359 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -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
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 59e809a1886..edd43b687e2 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -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]
diff --git a/gcc/c-family/c-pretty-print.c b/gcc/c-family/c-pretty-print.c
index 2e97d0147c5..9ac8cbaa2a9 100644
--- a/gcc/c-family/c-pretty-print.c
+++ b/gcc/c-family/c-pretty-print.c
@@ -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;
diff --git a/gcc/c-family/c-ubsan.c b/gcc/c-family/c-ubsan.c
index a0397925fe7..8d5b6856f87 100644
--- a/gcc/c-family/c-ubsan.c
+++ b/gcc/c-family/c-ubsan.c
@@ -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;
}
diff --git a/gcc/c-family/cilk.c b/gcc/c-family/cilk.c
index a952902533a..8bdcdcfaad5 100644
--- a/gcc/c-family/cilk.c
+++ b/gcc/c-family/cilk.c
@@ -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:
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 1266d4ea969..76d5c4671bd 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -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.
diff --git a/gcc/c/c-array-notation.c b/gcc/c/c-array-notation.c
index 0ac6ba8e119..a01269742ce 100644
--- a/gcc/c/c-array-notation.c
+++ b/gcc/c/c-array-notation.c
@@ -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;
}
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 790b87e0090..adde47f5569 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/cp-array-notation.c b/gcc/cp/cp-array-notation.c
index 65b8bcb8169..0ff0967d363 100644
--- a/gcc/cp/cp-array-notation.c
+++ b/gcc/cp/cp-array-notation.c
@@ -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:
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index 9b066b9f806..2a827237f28 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -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;
}
diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c
index c39fb7d7165..f5f91c804c1 100644
--- a/gcc/cp/cxx-pretty-print.c
+++ b/gcc/cp/cxx-pretty-print.c
@@ -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:
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index ab91928cf42..3752d17fad1 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -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)
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 699d5458a40..b3b5bbb0971 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -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:
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 42b25db9916..8edf5193750 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -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);
}
}
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 34a0c958108..4205fecfc94 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -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');
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index fca1ab34d05..2ebe0159491 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -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
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 6c5bdf7391b..7e144a6734c 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -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)
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 229d47620d6..21c9a82bbda 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -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. */
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index b671c92d730..255deafdac4 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -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);
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index d50d93eb2ea..e98942d7d2a 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -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);
}
diff --git a/gcc/tree-core.h b/gcc/tree-core.h
index 72ef8e143a2..98c3951c691 100644
--- a/gcc/tree-core.h
+++ b/gcc/tree-core.h
@@ -410,6 +410,8 @@ enum tree_index {
TI_UINT32_TYPE,
TI_UINT64_TYPE,
+ TI_VOID,
+
TI_INTEGER_ZERO,
TI_INTEGER_ONE,
TI_INTEGER_THREE,
diff --git a/gcc/tree.c b/gcc/tree.c
index 4dd8e73c6cf..22b92f3b6b2 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -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));
diff --git a/gcc/tree.def b/gcc/tree.def
index a6247a7e00a..464c8c7b099 100644
--- a/gcc/tree.def
+++ b/gcc/tree.def
@@ -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
diff --git a/gcc/tree.h b/gcc/tree.h
index e0a3084b755..968b389dd11 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -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]