aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog20
-rw-r--r--gcc/ada/ChangeLog7
-rw-r--r--gcc/ada/gcc-interface/ada-tree.h2
-rw-r--r--gcc/ada/gcc-interface/misc.c19
-rw-r--r--gcc/c-decl.c2
-rw-r--r--gcc/c-family/ChangeLog5
-rw-r--r--gcc/c-family/c-common.c9
-rw-r--r--gcc/c-family/c-common.h1
-rw-r--r--gcc/c-lang.c2
-rw-r--r--gcc/cp/ChangeLog10
-rw-r--r--gcc/cp/cp-lang.c22
-rw-r--r--gcc/cp/cp-objcp-common.c73
-rw-r--r--gcc/cp/cp-objcp-common.h1
-rw-r--r--gcc/cp/cp-tree.h2
-rw-r--r--gcc/fortran/ChangeLog5
-rw-r--r--gcc/fortran/f95-lang.c2
-rw-r--r--gcc/go/ChangeLog5
-rw-r--r--gcc/go/go-lang.c2
-rw-r--r--gcc/java/ChangeLog5
-rw-r--r--gcc/java/java-tree.h2
-rw-r--r--gcc/lto-streamer-in.c2
-rw-r--r--gcc/lto-streamer-out.c2
-rw-r--r--gcc/lto/ChangeLog6
-rw-r--r--gcc/lto/lto-tree.h2
-rw-r--r--gcc/lto/lto.c3
-rw-r--r--gcc/objc/ChangeLog6
-rw-r--r--gcc/objc/objc-act.c18
-rw-r--r--gcc/objc/objc-act.h1
-rw-r--r--gcc/objc/objc-lang.c32
-rw-r--r--gcc/objcp/ChangeLog5
-rw-r--r--gcc/objcp/objcp-lang.c48
-rw-r--r--gcc/print-tree.c3
-rw-r--r--gcc/tree-inline.c3
-rw-r--r--gcc/tree.c66
-rw-r--r--gcc/tree.h52
35 files changed, 275 insertions, 170 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bc53217..050e113 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,23 @@
+2011-04-12 Nathan Froyd <froydnj@codesourcery.com>
+
+ * c-decl.c (union lang_tree_node): Check for TS_COMMON before
+ calling TREE_CHAIN.
+ * print-tree.c (print_node): Likewise.
+ * tree-inline.c (copy_tree_r): Likewise.
+ * c-lang.c (LANG_HOOKS_INIT_TS): Define.
+ * lto-streamer-in.c (lto_input_tree_pointers): Check for TS_TYPED
+ instead of TS_COMMON.
+ * lto-streamer-out.c (lto_output_tree_pointers): Likewise.
+ * tree.c (initialize_tree_contains_struct): Handle TS_TYPED.
+ (copy_node_stat): Zero TREE_CHAIN only if necessary.
+ (MARK_TS_BASE, MARK_TS_TYPED, MARK_TS_COMMON): Move these...
+ (MARK_TS_DECL_COMMON, MARK_TS_DECL_COMMON, MARK_TS_DECL_WRTL):
+ ...and these...
+ (MARK_TS_DECL_WITH_VIS, MARK_TS_DECL_NON_COMMON): ...and these...
+ * tree.h: ...here.
+ (TREE_CHAIN): Check for a TS_COMMON structure.
+ (TREE_TYPE): Check for a TS_TYPED structure.
+
2011-04-12 Pat Haugen <pthaugen@us.ibm.com>
* config/rs6000/rs6000.c (call_ABI_of_interest): Call
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 285d61d..f97a087 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,10 @@
+2011-04-12 Nathan Froyd <froydnj@codesourcery.com>
+
+ * gcc-interface/ada-tree.h (union lang_tree_node): Check for
+ TS_COMMON before calling TREE_CHAIN.
+ * gcc-interface/misc.c (gnat_init_ts): New function.
+ (LANG_HOOKS_INIT_TS): Define.
+
2011-04-12 Martin Jambor <mjambor@suse.cz>
* gcc-interface/utils.c (end_subprog_body): Call
diff --git a/gcc/ada/gcc-interface/ada-tree.h b/gcc/ada/gcc-interface/ada-tree.h
index de47afc..2b14b95 100644
--- a/gcc/ada/gcc-interface/ada-tree.h
+++ b/gcc/ada/gcc-interface/ada-tree.h
@@ -25,7 +25,7 @@
/* The resulting tree type. */
union GTY((desc ("0"),
- chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)")))
+ chain_next ("CODE_CONTAINS_STRUCT (TREE_CODE (&%h.generic), TS_COMMON) ? ((union lang_tree_node *) TREE_CHAIN (&%h.generic)) : NULL")))
lang_tree_node
{
union tree_node GTY((tag ("0"),
diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c
index c35a22a..1f00b33 100644
--- a/gcc/ada/gcc-interface/misc.c
+++ b/gcc/ada/gcc-interface/misc.c
@@ -690,6 +690,23 @@ gnat_eh_personality (void)
return gnat_eh_personality_decl;
}
+/* Initialize language-specific bits of tree_contains_struct. */
+
+static void
+gnat_init_ts (void)
+{
+ MARK_TS_COMMON (UNCONSTRAINED_ARRAY_TYPE);
+
+ MARK_TS_TYPED (UNCONSTRAINED_ARRAY_REF);
+ MARK_TS_TYPED (NULL_EXPR);
+ MARK_TS_TYPED (PLUS_NOMOD_EXPR);
+ MARK_TS_TYPED (MINUS_NOMOD_EXPR);
+ MARK_TS_TYPED (ATTR_ADDR_EXPR);
+ MARK_TS_TYPED (STMT_STMT);
+ MARK_TS_TYPED (LOOP_STMT);
+ MARK_TS_TYPED (EXIT_STMT);
+}
+
/* Definitions for our language-specific hooks. */
#undef LANG_HOOKS_NAME
@@ -750,6 +767,8 @@ gnat_eh_personality (void)
#define LANG_HOOKS_EH_PERSONALITY gnat_eh_personality
#undef LANG_HOOKS_DEEP_UNSHARING
#define LANG_HOOKS_DEEP_UNSHARING true
+#undef LANG_HOOKS_INIT_TS
+#define LANG_HOOKS_INIT_TS gnat_init_ts
struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 5d32a9a..3436278 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -242,7 +242,7 @@ extern char C_SIZEOF_STRUCT_LANG_IDENTIFIER_isnt_accurate
/* The resulting tree type. */
union GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"),
- chain_next ("TREE_CODE (&%h.generic) == INTEGER_TYPE ? (union lang_tree_node *) TYPE_NEXT_VARIANT (&%h.generic) : ((union lang_tree_node *) TREE_CHAIN (&%h.generic))"))) lang_tree_node
+ chain_next ("TREE_CODE (&%h.generic) == INTEGER_TYPE ? (union lang_tree_node *) TYPE_NEXT_VARIANT (&%h.generic) : CODE_CONTAINS_STRUCT (TREE_CODE (&%h.generic), TS_COMMON) ? ((union lang_tree_node *) TREE_CHAIN (&%h.generic)) : NULL"))) lang_tree_node
{
union tree_node GTY ((tag ("0"),
desc ("tree_node_structure (&%h)")))
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 9fc2e22..fb9d99d 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,8 @@
+2011-04-12 Nathan Froyd <froydnj@codesourcery.com>
+
+ * c-common.h (c_common_init_ts): Declare.
+ * c-common.c (c_common_init_ts): Define.
+
2011-04-12 Nicola Pero <nicola.pero@meta-innovation.com>
* c-objc.h (objc_build_message_expr): Updated prototype.
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 030e3c6..752806e 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -9711,4 +9711,13 @@ keyword_is_decl_specifier (enum rid keyword)
}
}
+/* Initialize language-specific-bits of tree_contains_struct. */
+
+void
+c_common_init_ts (void)
+{
+ MARK_TS_TYPED (C_MAYBE_CONST_EXPR);
+ MARK_TS_TYPED (EXCESS_PRECISION_EXPR);
+}
+
#include "gt-c-family-c-common.h"
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 91e21ff..da9dad5 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -708,6 +708,7 @@ extern tree c_common_fixed_point_type_for_size (unsigned int, unsigned int,
extern tree c_common_unsigned_type (tree);
extern tree c_common_signed_type (tree);
extern tree c_common_signed_or_unsigned_type (int, tree);
+extern void c_common_init_ts (void);
extern tree c_build_bitfield_integer_type (unsigned HOST_WIDE_INT, int);
extern bool decl_with_nonnull_addr_p (const_tree);
extern tree c_fully_fold (tree, bool, bool *);
diff --git a/gcc/c-lang.c b/gcc/c-lang.c
index 0ca2e7c..ae1b081 100644
--- a/gcc/c-lang.c
+++ b/gcc/c-lang.c
@@ -43,6 +43,8 @@ enum c_language_kind c_language = clk_c;
#define LANG_HOOKS_NAME "GNU C"
#undef LANG_HOOKS_INIT
#define LANG_HOOKS_INIT c_objc_common_init
+#undef LANG_HOOKS_INIT_TS
+#define LANG_HOOKS_INIT_TS c_common_init_ts
/* Each front end provides its own lang hook initializer. */
struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 21a9377..63dbaf0 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,13 @@
+2011-04-12 Nathan Froyd <froydnj@codesourcery.com>
+
+ * cp-lang.c (cp_init_ts): Call cp_common_init_ts. Move
+ tree_contains_struct initialization to...
+ * cp-objcp-common.c (cp_common_init_ts): ...here. Use MARK_*
+ macros.
+ * cp-objcp-common.h (cp_common_init_ts): Declare.
+ * cp-tree.h (union lang_tree_node): Check for TS_COMMON before
+ calling TREE_CHAIN.
+
2011-04-12 Nicola Pero <nicola.pero@meta-innovation.com>
* parser.c (cp_parser_objc_message_expression): Updated call
diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c
index 42fbdff..7b1f450 100644
--- a/gcc/cp/cp-lang.c
+++ b/gcc/cp/cp-lang.c
@@ -101,32 +101,12 @@ objcp_tsubst_copy_and_build (tree t ATTRIBUTE_UNUSED,
return NULL_TREE;
}
-
static void
cp_init_ts (void)
{
- tree_contains_struct[NAMESPACE_DECL][TS_DECL_NON_COMMON] = 1;
- tree_contains_struct[USING_DECL][TS_DECL_NON_COMMON] = 1;
- tree_contains_struct[TEMPLATE_DECL][TS_DECL_NON_COMMON] = 1;
-
- tree_contains_struct[NAMESPACE_DECL][TS_DECL_WITH_VIS] = 1;
- tree_contains_struct[USING_DECL][TS_DECL_WITH_VIS] = 1;
- tree_contains_struct[TEMPLATE_DECL][TS_DECL_WITH_VIS] = 1;
-
- tree_contains_struct[NAMESPACE_DECL][TS_DECL_WRTL] = 1;
- tree_contains_struct[USING_DECL][TS_DECL_WRTL] = 1;
- tree_contains_struct[TEMPLATE_DECL][TS_DECL_WRTL] = 1;
-
- tree_contains_struct[NAMESPACE_DECL][TS_DECL_COMMON] = 1;
- tree_contains_struct[USING_DECL][TS_DECL_COMMON] = 1;
- tree_contains_struct[TEMPLATE_DECL][TS_DECL_COMMON] = 1;
-
- tree_contains_struct[NAMESPACE_DECL][TS_DECL_MINIMAL] = 1;
- tree_contains_struct[USING_DECL][TS_DECL_MINIMAL] = 1;
- tree_contains_struct[TEMPLATE_DECL][TS_DECL_MINIMAL] = 1;
+ cp_common_init_ts ();
init_shadowed_var_for_decl ();
-
}
static const char *
diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c
index 6e04269..6a7f400 100644
--- a/gcc/cp/cp-objcp-common.c
+++ b/gcc/cp/cp-objcp-common.c
@@ -224,5 +224,78 @@ init_shadowed_var_for_decl (void)
tree_decl_map_eq, 0);
}
+void
+cp_common_init_ts (void)
+{
+ MARK_TS_DECL_NON_COMMON (NAMESPACE_DECL);
+ MARK_TS_DECL_NON_COMMON (USING_DECL);
+ MARK_TS_DECL_NON_COMMON (TEMPLATE_DECL);
+
+ MARK_TS_COMMON (TEMPLATE_TEMPLATE_PARM);
+ MARK_TS_COMMON (TEMPLATE_TYPE_PARM);
+ MARK_TS_COMMON (TEMPLATE_PARM_INDEX);
+ MARK_TS_COMMON (OVERLOAD);
+ MARK_TS_COMMON (TEMPLATE_INFO);
+ MARK_TS_COMMON (FOR_STMT);
+ MARK_TS_COMMON (TYPENAME_TYPE);
+ MARK_TS_COMMON (TYPEOF_TYPE);
+ MARK_TS_COMMON (IF_STMT);
+ MARK_TS_COMMON (BASELINK);
+ MARK_TS_COMMON (SWITCH_STMT);
+ MARK_TS_COMMON (TYPE_PACK_EXPANSION);
+ MARK_TS_COMMON (EXPR_PACK_EXPANSION);
+ MARK_TS_COMMON (DECLTYPE_TYPE);
+ MARK_TS_COMMON (BOUND_TEMPLATE_TEMPLATE_PARM);
+ MARK_TS_COMMON (UNBOUND_CLASS_TEMPLATE);
+ MARK_TS_COMMON (RANGE_FOR_STMT);
+
+ MARK_TS_TYPED (AGGR_INIT_EXPR);
+ MARK_TS_TYPED (EXPR_STMT);
+ MARK_TS_TYPED (EH_SPEC_BLOCK);
+ MARK_TS_TYPED (CLEANUP_STMT);
+ MARK_TS_TYPED (SCOPE_REF);
+ MARK_TS_TYPED (CAST_EXPR);
+ MARK_TS_TYPED (NON_DEPENDENT_EXPR);
+ MARK_TS_TYPED (MODOP_EXPR);
+ MARK_TS_TYPED (TRY_BLOCK);
+ MARK_TS_TYPED (THROW_EXPR);
+ MARK_TS_TYPED (HANDLER);
+ MARK_TS_TYPED (REINTERPRET_CAST_EXPR);
+ MARK_TS_TYPED (CONST_CAST_EXPR);
+ MARK_TS_TYPED (STATIC_CAST_EXPR);
+ MARK_TS_TYPED (DYNAMIC_CAST_EXPR);
+ MARK_TS_TYPED (TEMPLATE_ID_EXPR);
+ MARK_TS_TYPED (ARROW_EXPR);
+ MARK_TS_TYPED (SIZEOF_EXPR);
+ MARK_TS_TYPED (ALIGNOF_EXPR);
+ MARK_TS_TYPED (AT_ENCODE_EXPR);
+ MARK_TS_TYPED (UNARY_PLUS_EXPR);
+ MARK_TS_TYPED (TRAIT_EXPR);
+ MARK_TS_TYPED (TYPE_ARGUMENT_PACK);
+ MARK_TS_TYPED (NOEXCEPT_EXPR);
+ MARK_TS_TYPED (NONTYPE_ARGUMENT_PACK);
+ MARK_TS_TYPED (WHILE_STMT);
+ MARK_TS_TYPED (NEW_EXPR);
+ MARK_TS_TYPED (VEC_NEW_EXPR);
+ MARK_TS_TYPED (BREAK_STMT);
+ MARK_TS_TYPED (MEMBER_REF);
+ MARK_TS_TYPED (DOTSTAR_EXPR);
+ MARK_TS_TYPED (DO_STMT);
+ MARK_TS_TYPED (DELETE_EXPR);
+ MARK_TS_TYPED (VEC_DELETE_EXPR);
+ MARK_TS_TYPED (CONTINUE_STMT);
+ MARK_TS_TYPED (TAG_DEFN);
+ MARK_TS_TYPED (PSEUDO_DTOR_EXPR);
+ MARK_TS_TYPED (TYPEID_EXPR);
+ MARK_TS_TYPED (MUST_NOT_THROW_EXPR);
+ MARK_TS_TYPED (STMT_EXPR);
+ MARK_TS_TYPED (OFFSET_REF);
+ MARK_TS_TYPED (OFFSETOF_EXPR);
+ MARK_TS_TYPED (PTRMEM_CST);
+ MARK_TS_TYPED (EMPTY_CLASS_EXPR);
+ MARK_TS_TYPED (VEC_INIT_EXPR);
+ MARK_TS_TYPED (USING_STMT);
+ MARK_TS_TYPED (LAMBDA_EXPR);
+}
#include "gt-cp-cp-objcp-common.h"
diff --git a/gcc/cp/cp-objcp-common.h b/gcc/cp/cp-objcp-common.h
index 38da59e..c668ad8 100644
--- a/gcc/cp/cp-objcp-common.h
+++ b/gcc/cp/cp-objcp-common.h
@@ -28,6 +28,7 @@ extern tree objcp_tsubst_copy_and_build (tree, tree, tsubst_flags_t,
tree, bool);
extern bool cp_function_decl_explicit_p (tree decl);
+extern void cp_common_init_ts (void);
/* Lang hooks that are shared between C++ and ObjC++ are defined here. Hooks
specific to C++ or ObjC++ go in cp/cp-lang.c and objcp/objcp-lang.c,
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 4321d28..15c1974 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -705,7 +705,7 @@ enum cp_tree_node_structure_enum {
/* The resulting tree type. */
union GTY((desc ("cp_tree_node_structure (&%h)"),
- chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)"))) lang_tree_node {
+ chain_next ("CODE_CONTAINS_STRUCT (TREE_CODE (&%h.generic), TS_COMMON) ? ((union lang_tree_node *) TREE_CHAIN (&%h.generic)) : NULL"))) lang_tree_node {
union tree_node GTY ((tag ("TS_CP_GENERIC"),
desc ("tree_node_structure (&%h)"))) generic;
struct template_parm_index_s GTY ((tag ("TS_CP_TPI"))) tpi;
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index c17ef42..96b92dc 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,8 @@
+2011-04-12 Nathan Froyd <froydnj@codesourcery.com>
+
+ * f95-lang.c (union lang_tree_node): Check for TS_COMMON before
+ calling TREE_CHAIN.
+
2011-04-12 Paul Thomas <pault@gcc.gnu.org>
PR fortran/48360
diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c
index 728b631..ffe8953 100644
--- a/gcc/fortran/f95-lang.c
+++ b/gcc/fortran/f95-lang.c
@@ -59,7 +59,7 @@ lang_identifier {
/* The resulting tree type. */
union GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"),
- chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)")))
+ chain_next ("CODE_CONTAINS_STRUCT (TREE_CODE (&%h.generic), TS_COMMON) ? ((union lang_tree_node *) TREE_CHAIN (&%h.generic)) : NULL")))
lang_tree_node {
union tree_node GTY((tag ("0"),
diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog
index 3ee5fb1..9f400f1 100644
--- a/gcc/go/ChangeLog
+++ b/gcc/go/ChangeLog
@@ -1,3 +1,8 @@
+2011-04-12 Nathan Froyd <froydnj@codesourcery.com>
+
+ * go-lang.c (union lang_tree_node): Check for TS_COMMON before
+ calling TREE_CHAIN.
+
2011-04-06 Ian Lance Taylor <iant@google.com>
* go-gcc.cc (if_statement): Use build3_loc.
diff --git a/gcc/go/go-lang.c b/gcc/go/go-lang.c
index b59e72d..5132e97 100644
--- a/gcc/go/go-lang.c
+++ b/gcc/go/go-lang.c
@@ -65,7 +65,7 @@ struct GTY(()) lang_identifier
/* The resulting tree type. */
union GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"),
- chain_next ("(union lang_tree_node *) TREE_CHAIN (&%h.generic)")))
+ chain_next ("CODE_CONTAINS_STRUCT (TREE_CODE (&%h.generic), TS_COMMON) ? ((union lang_tree_node *) TREE_CHAIN (&%h.generic)) : NULL")))
lang_tree_node
{
union tree_node GTY((tag ("0"),
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 3f81762..0c19120 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,8 @@
+2011-04-12 Nathan Froyd <froydnj@codesourcery.com>
+
+ * java-tree.h (union lang_tree_node): Check for TS_COMMON before
+ calling TREE_CHAIN.
+
2011-04-11 Martin Jambor <mjambor@suse.cz>
* decl.c (java_mark_decl_local): Call cgraph_get_node instead of
diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h
index 3addcca..e422b4a 100644
--- a/gcc/java/java-tree.h
+++ b/gcc/java/java-tree.h
@@ -587,7 +587,7 @@ struct GTY(()) lang_identifier {
/* The resulting tree type. */
union GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"),
- chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)")))
+ chain_next ("CODE_CONTAINS_STRUCT (TREE_CODE (&%h.generic), TS_COMMON) ? ((union lang_tree_node *) TREE_CHAIN (&%h.generic)) : NULL")))
lang_tree_node {
union tree_node GTY ((tag ("0"),
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c
index b250023..f1e426a 100644
--- a/gcc/lto-streamer-in.c
+++ b/gcc/lto-streamer-in.c
@@ -2340,7 +2340,7 @@ lto_input_tree_pointers (struct lto_input_block *ib, struct data_in *data_in,
code = TREE_CODE (expr);
- if (CODE_CONTAINS_STRUCT (code, TS_COMMON))
+ if (CODE_CONTAINS_STRUCT (code, TS_TYPED))
lto_input_ts_common_tree_pointers (ib, data_in, expr);
if (CODE_CONTAINS_STRUCT (code, TS_VECTOR))
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index a29cdd5..1f5b054 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -1156,7 +1156,7 @@ lto_output_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
code = TREE_CODE (expr);
- if (CODE_CONTAINS_STRUCT (code, TS_COMMON))
+ if (CODE_CONTAINS_STRUCT (code, TS_TYPED))
lto_output_ts_common_tree_pointers (ob, expr, ref_p);
if (CODE_CONTAINS_STRUCT (code, TS_VECTOR))
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index 56bf3f5b..bc72f2f 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,9 @@
+2011-04-12 Nathan Froyd <froydnj@codesourcery.com>
+
+ * lto-tree.h (union lang_tree_node): Check for TS_COMMON before
+ calling TREE_CHAIN.
+ * lto.c (lto_fixup_common): Likewise.
+
2011-04-08 Nathan Froyd <froydnj@codesourcery.com>
* lto-lang.c (handle_sentinel_attribute): Don't use TYPE_ARG_TYPES.
diff --git a/gcc/lto/lto-tree.h b/gcc/lto/lto-tree.h
index d187fe2..847348c 100644
--- a/gcc/lto/lto-tree.h
+++ b/gcc/lto/lto-tree.h
@@ -48,7 +48,7 @@ enum lto_tree_node_structure_enum {
};
union GTY((desc ("lto_tree_node_structure (&%h)"),
- chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)")))
+ chain_next ("CODE_CONTAINS_STRUCT (TREE_CODE (&%h.generic), TS_COMMON) ? ((union lang_tree_node *) TREE_CHAIN (&%h.generic)) : NULL")))
lang_tree_node
{
union tree_node GTY ((tag ("TS_LTO_GENERIC"),
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index 45bdb70..eebc50f 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -1618,7 +1618,8 @@ lto_fixup_common (tree t, void *data)
/* This is not very efficient because we cannot do tail-recursion with
a long chain of trees. */
- LTO_FIXUP_SUBTREE (TREE_CHAIN (t));
+ if (CODE_CONTAINS_STRUCT (TREE_CODE (t), TS_COMMON))
+ LTO_FIXUP_SUBTREE (TREE_CHAIN (t));
}
/* Fix up fields of a decl_minimal T. DATA points to fix-up states. */
diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog
index 110de87..caceac1 100644
--- a/gcc/objc/ChangeLog
+++ b/gcc/objc/ChangeLog
@@ -1,3 +1,9 @@
+2011-04-12 Nathan Froyd <froydnj@codesourcery.com>
+
+ * objc-lang.c (objc_init_ts): Move code for this function...
+ * objc-act.c (objc_common_init_ts): ...here. Define.
+ * objc-act.h (objc_common_init_ts): Declare.
+
2011-04-12 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (objc_build_message_expr): Accept two arguments
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index 2f6613c..13eef24 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -10640,4 +10640,22 @@ objc_v2_encode_prop_attr (tree property)
return get_identifier (string);
}
+void
+objc_common_init_ts (void)
+{
+ c_common_init_ts ();
+
+ MARK_TS_DECL_NON_COMMON (CLASS_METHOD_DECL);
+ MARK_TS_DECL_NON_COMMON (INSTANCE_METHOD_DECL);
+ MARK_TS_DECL_NON_COMMON (KEYWORD_DECL);
+ MARK_TS_DECL_NON_COMMON (PROPERTY_DECL);
+
+ MARK_TS_COMMON (CLASS_INTERFACE_TYPE);
+ MARK_TS_COMMON (PROTOCOL_INTERFACE_TYPE);
+ MARK_TS_COMMON (CLASS_IMPLEMENTATION_TYPE);
+
+ MARK_TS_TYPED (MESSAGE_SEND_EXPR);
+ MARK_TS_TYPED (PROPERTY_REF);
+}
+
#include "gt-objc-objc-act.h"
diff --git a/gcc/objc/objc-act.h b/gcc/objc/objc-act.h
index 3983d4b..909181a 100644
--- a/gcc/objc/objc-act.h
+++ b/gcc/objc/objc-act.h
@@ -28,6 +28,7 @@ bool objc_init (void);
const char *objc_printable_name (tree, int);
tree objc_fold_obj_type_ref (tree, tree);
int objc_gimplify_expr (tree *, gimple_seq *, gimple_seq *);
+void objc_common_init_ts (void);
/* NB: The remaining public functions are prototyped in c-common.h, for the
benefit of stub-objc.c and objc-act.c. */
diff --git a/gcc/objc/objc-lang.c b/gcc/objc/objc-lang.c
index fd657765..169b894 100644
--- a/gcc/objc/objc-lang.c
+++ b/gcc/objc/objc-lang.c
@@ -36,7 +36,6 @@ along with GCC; see the file COPYING3. If not see
#include "c-lang.h"
enum c_language_kind c_language = clk_objc;
-static void objc_init_ts (void);
/* Lang hooks common to C and ObjC are declared in c-objc-common.h;
consequently, there should be very few hooks below. */
@@ -50,7 +49,7 @@ static void objc_init_ts (void);
#undef LANG_HOOKS_GIMPLIFY_EXPR
#define LANG_HOOKS_GIMPLIFY_EXPR objc_gimplify_expr
#undef LANG_HOOKS_INIT_TS
-#define LANG_HOOKS_INIT_TS objc_init_ts
+#define LANG_HOOKS_INIT_TS objc_common_init_ts
/* Each front end provides its own lang hook initializer. */
struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
@@ -58,33 +57,4 @@ struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
/* Lang hook routines common to C and ObjC appear in c-objc-common.c;
there should be very few (if any) routines below. */
-static void
-objc_init_ts (void)
-{
- tree_contains_struct[CLASS_METHOD_DECL][TS_DECL_NON_COMMON] = 1;
- tree_contains_struct[INSTANCE_METHOD_DECL][TS_DECL_NON_COMMON] = 1;
- tree_contains_struct[KEYWORD_DECL][TS_DECL_NON_COMMON] = 1;
- tree_contains_struct[PROPERTY_DECL][TS_DECL_NON_COMMON] = 1;
-
- tree_contains_struct[CLASS_METHOD_DECL][TS_DECL_WITH_VIS] = 1;
- tree_contains_struct[INSTANCE_METHOD_DECL][TS_DECL_WITH_VIS] = 1;
- tree_contains_struct[KEYWORD_DECL][TS_DECL_WITH_VIS] = 1;
- tree_contains_struct[PROPERTY_DECL][TS_DECL_WITH_VIS] = 1;
-
- tree_contains_struct[CLASS_METHOD_DECL][TS_DECL_WRTL] = 1;
- tree_contains_struct[INSTANCE_METHOD_DECL][TS_DECL_WRTL] = 1;
- tree_contains_struct[KEYWORD_DECL][TS_DECL_WRTL] = 1;
- tree_contains_struct[PROPERTY_DECL][TS_DECL_WRTL] = 1;
-
- tree_contains_struct[CLASS_METHOD_DECL][TS_DECL_MINIMAL] = 1;
- tree_contains_struct[INSTANCE_METHOD_DECL][TS_DECL_MINIMAL] = 1;
- tree_contains_struct[KEYWORD_DECL][TS_DECL_MINIMAL] = 1;
- tree_contains_struct[PROPERTY_DECL][TS_DECL_MINIMAL] = 1;
-
- tree_contains_struct[CLASS_METHOD_DECL][TS_DECL_COMMON] = 1;
- tree_contains_struct[INSTANCE_METHOD_DECL][TS_DECL_COMMON] = 1;
- tree_contains_struct[KEYWORD_DECL][TS_DECL_COMMON] = 1;
- tree_contains_struct[PROPERTY_DECL][TS_DECL_COMMON] = 1;
-}
-
#include "gtype-objc.h"
diff --git a/gcc/objcp/ChangeLog b/gcc/objcp/ChangeLog
index c743cce..f78e493 100644
--- a/gcc/objcp/ChangeLog
+++ b/gcc/objcp/ChangeLog
@@ -1,3 +1,8 @@
+2011-04-12 Nathan Froyd <froydnj@codesourcery.com>
+
+ * objcp-lang.c (objcxx_init_ts): Call objc_common_init_ts and
+ cp_common_init_ts.
+
2011-03-21 Nicola Pero <nicola.pero@meta-innovation.com>
PR bootstrap/48167
diff --git a/gcc/objcp/objcp-lang.c b/gcc/objcp/objcp-lang.c
index fe2be66..0019022 100644
--- a/gcc/objcp/objcp-lang.c
+++ b/gcc/objcp/objcp-lang.c
@@ -89,52 +89,8 @@ objcp_tsubst_copy_and_build (tree t, tree args, tsubst_flags_t complain,
static void
objcxx_init_ts (void)
{
- /* objc decls */
- tree_contains_struct[CLASS_METHOD_DECL][TS_DECL_NON_COMMON] = 1;
- tree_contains_struct[INSTANCE_METHOD_DECL][TS_DECL_NON_COMMON] = 1;
- tree_contains_struct[KEYWORD_DECL][TS_DECL_NON_COMMON] = 1;
- tree_contains_struct[PROPERTY_DECL][TS_DECL_NON_COMMON] = 1;
-
- tree_contains_struct[CLASS_METHOD_DECL][TS_DECL_WITH_VIS] = 1;
- tree_contains_struct[INSTANCE_METHOD_DECL][TS_DECL_WITH_VIS] = 1;
- tree_contains_struct[KEYWORD_DECL][TS_DECL_WITH_VIS] = 1;
- tree_contains_struct[PROPERTY_DECL][TS_DECL_WITH_VIS] = 1;
-
- tree_contains_struct[CLASS_METHOD_DECL][TS_DECL_WRTL] = 1;
- tree_contains_struct[INSTANCE_METHOD_DECL][TS_DECL_WRTL] = 1;
- tree_contains_struct[KEYWORD_DECL][TS_DECL_WRTL] = 1;
- tree_contains_struct[PROPERTY_DECL][TS_DECL_WRTL] = 1;
-
- tree_contains_struct[CLASS_METHOD_DECL][TS_DECL_MINIMAL] = 1;
- tree_contains_struct[INSTANCE_METHOD_DECL][TS_DECL_MINIMAL] = 1;
- tree_contains_struct[KEYWORD_DECL][TS_DECL_MINIMAL] = 1;
- tree_contains_struct[PROPERTY_DECL][TS_DECL_MINIMAL] = 1;
-
- tree_contains_struct[CLASS_METHOD_DECL][TS_DECL_COMMON] = 1;
- tree_contains_struct[INSTANCE_METHOD_DECL][TS_DECL_COMMON] = 1;
- tree_contains_struct[KEYWORD_DECL][TS_DECL_COMMON] = 1;
- tree_contains_struct[PROPERTY_DECL][TS_DECL_COMMON] = 1;
-
- /* C++ decls */
- tree_contains_struct[NAMESPACE_DECL][TS_DECL_NON_COMMON] = 1;
- tree_contains_struct[USING_DECL][TS_DECL_NON_COMMON] = 1;
- tree_contains_struct[TEMPLATE_DECL][TS_DECL_NON_COMMON] = 1;
-
- tree_contains_struct[NAMESPACE_DECL][TS_DECL_WITH_VIS] = 1;
- tree_contains_struct[USING_DECL][TS_DECL_WITH_VIS] = 1;
- tree_contains_struct[TEMPLATE_DECL][TS_DECL_WITH_VIS] = 1;
-
- tree_contains_struct[NAMESPACE_DECL][TS_DECL_WRTL] = 1;
- tree_contains_struct[USING_DECL][TS_DECL_WRTL] = 1;
- tree_contains_struct[TEMPLATE_DECL][TS_DECL_WRTL] = 1;
-
- tree_contains_struct[NAMESPACE_DECL][TS_DECL_COMMON] = 1;
- tree_contains_struct[USING_DECL][TS_DECL_COMMON] = 1;
- tree_contains_struct[TEMPLATE_DECL][TS_DECL_COMMON] = 1;
-
- tree_contains_struct[NAMESPACE_DECL][TS_DECL_MINIMAL] = 1;
- tree_contains_struct[USING_DECL][TS_DECL_MINIMAL] = 1;
- tree_contains_struct[TEMPLATE_DECL][TS_DECL_MINIMAL] = 1;
+ objc_common_init_ts ();
+ cp_common_init_ts ();
init_shadowed_var_for_decl ();
}
diff --git a/gcc/print-tree.c b/gcc/print-tree.c
index dfd3589..b0c6899 100644
--- a/gcc/print-tree.c
+++ b/gcc/print-tree.c
@@ -756,7 +756,8 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
print_node (file, temp, TREE_OPERAND (node, i), indent + 4);
}
}
- print_node (file, "chain", TREE_CHAIN (node), indent + 4);
+ if (CODE_CONTAINS_STRUCT (code, TS_COMMON))
+ print_node (file, "chain", TREE_CHAIN (node), indent + 4);
break;
case tcc_constant:
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 0ba8e4e..84307ac 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -4253,7 +4253,8 @@ copy_tree_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
here. */
tree chain = NULL_TREE, new_tree;
- chain = TREE_CHAIN (*tp);
+ if (CODE_CONTAINS_STRUCT (code, TS_COMMON))
+ chain = TREE_CHAIN (*tp);
/* Copy the node. */
new_tree = copy_node (*tp);
diff --git a/gcc/tree.c b/gcc/tree.c
index e137aad..9d9101d 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -352,53 +352,6 @@ initialize_tree_contains_struct (void)
{
unsigned i;
-#define MARK_TS_BASE(C) \
- do { \
- tree_contains_struct[C][TS_BASE] = 1; \
- } while (0)
-
-#define MARK_TS_TYPED(C) \
- do { \
- MARK_TS_BASE (C); \
- tree_contains_struct[C][TS_TYPED] = 1; \
- } while (0)
-
-#define MARK_TS_COMMON(C) \
- do { \
- MARK_TS_TYPED (C); \
- tree_contains_struct[C][TS_COMMON] = 1; \
- } while (0)
-
-#define MARK_TS_DECL_MINIMAL(C) \
- do { \
- MARK_TS_COMMON (C); \
- tree_contains_struct[C][TS_DECL_MINIMAL] = 1; \
- } while (0)
-
-#define MARK_TS_DECL_COMMON(C) \
- do { \
- MARK_TS_DECL_MINIMAL (C); \
- tree_contains_struct[C][TS_DECL_COMMON] = 1; \
- } while (0)
-
-#define MARK_TS_DECL_WRTL(C) \
- do { \
- MARK_TS_DECL_COMMON (C); \
- tree_contains_struct[C][TS_DECL_WRTL] = 1; \
- } while (0)
-
-#define MARK_TS_DECL_WITH_VIS(C) \
- do { \
- MARK_TS_DECL_WRTL (C); \
- tree_contains_struct[C][TS_DECL_WITH_VIS] = 1; \
- } while (0)
-
-#define MARK_TS_DECL_NON_COMMON(C) \
- do { \
- MARK_TS_DECL_WITH_VIS (C); \
- tree_contains_struct[C][TS_DECL_NON_COMMON] = 1; \
- } while (0)
-
for (i = ERROR_MARK; i < LAST_AND_UNUSED_TREE_CODE; i++)
{
enum tree_code code;
@@ -413,10 +366,14 @@ initialize_tree_contains_struct (void)
/* Mark all the structures that TS is derived from. */
switch (ts_code)
{
- case TS_COMMON:
+ case TS_TYPED:
MARK_TS_BASE (code);
break;
+ case TS_COMMON:
+ MARK_TS_TYPED (code);
+ break;
+
case TS_INT_CST:
case TS_REAL_CST:
case TS_FIXED_CST:
@@ -521,14 +478,6 @@ initialize_tree_contains_struct (void)
gcc_assert (tree_contains_struct[FUNCTION_DECL][TS_FUNCTION_DECL]);
gcc_assert (tree_contains_struct[IMPORTED_DECL][TS_DECL_MINIMAL]);
gcc_assert (tree_contains_struct[IMPORTED_DECL][TS_DECL_COMMON]);
-
-#undef MARK_TS_BASE
-#undef MARK_TS_COMMON
-#undef MARK_TS_DECL_MINIMAL
-#undef MARK_TS_DECL_COMMON
-#undef MARK_TS_DECL_WRTL
-#undef MARK_TS_DECL_WITH_VIS
-#undef MARK_TS_DECL_NON_COMMON
}
@@ -964,7 +913,7 @@ make_node_stat (enum tree_code code MEM_STAT_DECL)
}
/* Return a new node with the same contents as NODE except that its
- TREE_CHAIN is zero and it has a fresh uid. */
+ TREE_CHAIN, if it has one, is zero and it has a fresh uid. */
tree
copy_node_stat (tree node MEM_STAT_DECL)
@@ -980,7 +929,8 @@ copy_node_stat (tree node MEM_STAT_DECL)
t = ggc_alloc_zone_tree_node_stat (&tree_zone, length PASS_MEM_STAT);
memcpy (t, node, length);
- TREE_CHAIN (t) = 0;
+ if (CODE_CONTAINS_STRUCT (code, TS_COMMON))
+ TREE_CHAIN (t) = 0;
TREE_ASM_WRITTEN (t) = 0;
TREE_VISITED (t) = 0;
if (code == VAR_DECL || code == PARM_DECL || code == RESULT_DECL)
diff --git a/gcc/tree.h b/gcc/tree.h
index 149ba75..5d33185 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -50,6 +50,54 @@ MAX_TREE_CODES
extern unsigned char tree_contains_struct[MAX_TREE_CODES][64];
#define CODE_CONTAINS_STRUCT(CODE, STRUCT) (tree_contains_struct[(CODE)][(STRUCT)])
+/* Macros for initializing `tree_contains_struct'. */
+#define MARK_TS_BASE(C) \
+ do { \
+ tree_contains_struct[C][TS_BASE] = 1; \
+ } while (0)
+
+#define MARK_TS_TYPED(C) \
+ do { \
+ MARK_TS_BASE (C); \
+ tree_contains_struct[C][TS_TYPED] = 1; \
+ } while (0)
+
+#define MARK_TS_COMMON(C) \
+ do { \
+ MARK_TS_TYPED (C); \
+ tree_contains_struct[C][TS_COMMON] = 1; \
+ } while (0)
+
+#define MARK_TS_DECL_MINIMAL(C) \
+ do { \
+ MARK_TS_COMMON (C); \
+ tree_contains_struct[C][TS_DECL_MINIMAL] = 1; \
+ } while (0)
+
+#define MARK_TS_DECL_COMMON(C) \
+ do { \
+ MARK_TS_DECL_MINIMAL (C); \
+ tree_contains_struct[C][TS_DECL_COMMON] = 1; \
+ } while (0)
+
+#define MARK_TS_DECL_WRTL(C) \
+ do { \
+ MARK_TS_DECL_COMMON (C); \
+ tree_contains_struct[C][TS_DECL_WRTL] = 1; \
+ } while (0)
+
+#define MARK_TS_DECL_WITH_VIS(C) \
+ do { \
+ MARK_TS_DECL_WRTL (C); \
+ tree_contains_struct[C][TS_DECL_WITH_VIS] = 1; \
+ } while (0)
+
+#define MARK_TS_DECL_NON_COMMON(C) \
+ do { \
+ MARK_TS_DECL_WITH_VIS (C); \
+ tree_contains_struct[C][TS_DECL_NON_COMMON] = 1; \
+ } while (0)
+
/* Number of language-independent tree codes. */
#define NUM_TREE_CODES ((int) LAST_AND_UNUSED_TREE_CODE)
@@ -864,7 +912,7 @@ enum tree_node_structure_enum {
are chained together. */
#define TREE_CHAIN(NODE) __extension__ \
-(*({__typeof (NODE) const __t = (NODE); \
+(*({__typeof (NODE) const __t = CONTAINS_STRUCT_CHECK (NODE, TS_COMMON);\
&__t->common.chain; }))
/* In all nodes that are expressions, this is the data type of the expression.
@@ -872,7 +920,7 @@ enum tree_node_structure_enum {
In ARRAY_TYPE nodes, this is the type of the elements.
In VECTOR_TYPE nodes, this is the type of the elements. */
#define TREE_TYPE(NODE) __extension__ \
-(*({__typeof (NODE) const __t = (NODE); \
+(*({__typeof (NODE) const __t = CONTAINS_STRUCT_CHECK (NODE, TS_TYPED); \
&__t->typed.type; }))
extern void tree_contains_struct_check_failed (const_tree,