From: Jakub Jelinek Date: Mon, 27 Jun 2011 16:56:08 +0000 (+0200) Subject: c-common.h (c_tree_chain_next): New static inline function. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=563007852e8d19b66ec8c1e42e431efaaa967dc6;p=gcc.git c-common.h (c_tree_chain_next): New static inline function. * c-common.h (c_tree_chain_next): New static inline function. * c-decl.c (union lang_tree_node): Use it in chain_next expression. * cp-tree.h (union lang_tree_node): Use it in chain_next expression. From-SVN: r175542 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8ed86d29e23..241a1f4b149 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,7 @@ 2011-06-27 Jakub Jelinek + * c-decl.c (union lang_tree_node): Use it in chain_next expression. + * builtin-types.def (BT_FN_PTR_CONST_PTR_SIZE_VAR): New. * builtins.def (BUILT_IN_ASSUME_ALIGNED): New builtin. * tree-ssa-structalias.c (find_func_aliases_for_builtin_call, diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 1c7552b7589..7198cb2d5d3 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -238,7 +238,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 ("CODE_CONTAINS_STRUCT (TREE_CODE (&%h.generic), TS_TYPE_COMMON) ? (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 + chain_next ("(union lang_tree_node *) c_tree_chain_next (&%h.generic)"))) 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 0595cd1a7ac..8cdeb3372b2 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,5 +1,7 @@ 2011-06-27 Jakub Jelinek + * c-common.h (c_tree_chain_next): New static inline function. + * c-common.c (check_builtin_function_arguments): Handle BUILT_IN_ASSUME_ALIGNED. diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h index c63b40d0360..a80c0eaec40 100644 --- a/gcc/c-family/c-common.h +++ b/gcc/c-family/c-common.h @@ -1016,4 +1016,19 @@ extern bool c_omp_sharing_predetermined (tree); extern tree c_omp_remap_decl (tree, bool); extern void record_types_used_by_current_var_decl (tree); +/* Return next tree in the chain for chain_next walking of tree nodes. */ +static inline tree +c_tree_chain_next (tree t) +{ + /* TREE_CHAIN of a type is TYPE_STUB_DECL, which is different + kind of object, never a long chain of nodes. Prefer + TYPE_NEXT_VARIANT for types. */ + if (CODE_CONTAINS_STRUCT (TREE_CODE (t), TS_TYPE_COMMON)) + return TYPE_NEXT_VARIANT (t); + /* Otherwise, if there is TREE_CHAIN, return it. */ + if (CODE_CONTAINS_STRUCT (TREE_CODE (t), TS_COMMON)) + return TREE_CHAIN (t); + return NULL; +} + #endif /* ! GCC_C_COMMON_H */ diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 66295492760..45b85302afc 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2011-06-27 Jakub Jelinek + + * cp-tree.h (union lang_tree_node): Use it in chain_next expression. + 2011-06-26 Jason Merrill PR c++/49528 diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 872ff6ffe89..9afb33cc144 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -729,7 +729,7 @@ enum cp_tree_node_structure_enum { /* The resulting tree type. */ union GTY((desc ("cp_tree_node_structure (&%h)"), - chain_next ("CODE_CONTAINS_STRUCT (TREE_CODE (&%h.generic), TS_TYPE_COMMON) ? ((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 { + chain_next ("(union lang_tree_node *) c_tree_chain_next (&%h.generic)"))) 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;