diff options
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 16 | ||||
-rw-r--r-- | gcc/cp/cp-lang.c | 21 | ||||
-rw-r--r-- | gcc/cp/cp-tree.def | 21 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 16 | ||||
-rw-r--r-- | gcc/cp/decl.c | 1 | ||||
-rw-r--r-- | gcc/cp/pt.c | 9 | ||||
-rw-r--r-- | gcc/cp/tree.c | 21 |
7 files changed, 46 insertions, 59 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ce68f07..8311500 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,19 @@ 2003-04-06 Zack Weinberg <zack@codesourcery.com> + * cp-tree.def: Make fourth element for all 'c' and 'x' nodes zero. + * cp-lang.c (cp_tree_size): New function. + (LANG_HOOKS_TREE_SIZE): Override. + + * cp-tree.h (SOURCE_LOCUS, SRCLOC_FILE, SRCLOC_LINE, struct + tree_srcloc, TS_CP_COMMON, TS_CP_SRCLOC): Kill. + (union lang_tree_node): Remove common and srcloc members. + (build_srcloc_here): Don't prototype. + * decl.c (cp_tree_node_structure): Kill SRCLOC case. + * pt.c (pending_templates): Correct comment. + * tree.c (build_srcloc, build_srcloc_here): Kill. + +2003-04-06 Zack Weinberg <zack@codesourcery.com> + * call.c: Include intl.h. (print_z_candidate): Always use inform; get rid of errfn argument. Reorganize so that all the strings get picked up @@ -3897,7 +3911,7 @@ 2002-08-11 Gabriel Dos Reis <gdr@nerim.net> - * decl.c (duplicate_decls): Replace DECL_SOURCE_FILE + + * decl.c (duplicate_decls): Replace DECL_SOURCE_FILE DECL_SOURCE_LINE with DECL_SOURCE_LOCATION. * optimize.c (maybe_clone_body): Likewise. * pt.c (tsubst_enum): Likewise. diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c index b35c31c..0caa336 100644 --- a/gcc/cp/cp-lang.c +++ b/gcc/cp/cp-lang.c @@ -34,10 +34,13 @@ static HOST_WIDE_INT cxx_get_alias_set (tree); static bool ok_to_generate_alias_set_for_type (tree); static bool cxx_warn_unused_global_decl (tree); static tree cp_expr_size (tree); +static size_t cp_tree_size (enum tree_code); static bool cp_var_mod_type_p (tree); #undef LANG_HOOKS_NAME #define LANG_HOOKS_NAME "GNU C++" +#undef LANG_HOOKS_TREE_SIZE +#define LANG_HOOKS_TREE_SIZE cp_tree_size #undef LANG_HOOKS_INIT #define LANG_HOOKS_INIT cxx_init #undef LANG_HOOKS_FINISH @@ -318,6 +321,24 @@ cp_expr_size (tree exp) return lhd_expr_size (exp); } +/* Langhook for tree_size: determine size of our 'x' and 'c' nodes. */ +static size_t +cp_tree_size (enum tree_code code) +{ + switch (code) + { + case PTRMEM_CST: return sizeof (struct ptrmem_cst); + case BASELINK: return sizeof (struct tree_baselink); + case TEMPLATE_PARM_INDEX: return sizeof (template_parm_index); + case DEFAULT_ARG: return sizeof (struct tree_default_arg); + case OVERLOAD: return sizeof (struct tree_overload); + case WRAPPER: return sizeof (struct tree_wrapper); + default: + abort (); + } + /* NOTREACHED */ +} + /* Returns true if T is a variably modified type, in the sense of C99. This routine needs only check cases that cannot be handled by the language-independent logic in tree-inline.c. */ diff --git a/gcc/cp/cp-tree.def b/gcc/cp/cp-tree.def index e95d593..2d340f3 100644 --- a/gcc/cp/cp-tree.def +++ b/gcc/cp/cp-tree.def @@ -47,7 +47,7 @@ DEFTREECODE (OFFSET_REF, "offset_ref", 'r', 2) /* A pointer-to-member constant. For a pointer-to-member constant `X::Y' The PTRMEM_CST_CLASS is the RECORD_TYPE for `X' and the PTRMEM_CST_MEMBER is the _DECL for `Y'. */ -DEFTREECODE (PTRMEM_CST, "ptrmem_cst", 'c', 2) +DEFTREECODE (PTRMEM_CST, "ptrmem_cst", 'c', 0) /* For NEW_EXPR, operand 0 is the placement list. Operand 1 is the new-declarator. @@ -105,7 +105,7 @@ DEFTREECODE (ALIAS_DECL, "alias_decl", 'd', 0) the type of the expression. This type is either a FUNCTION_TYPE, METHOD_TYPE, or `unknown_type_node' indicating that the function is overloaded. */ -DEFTREECODE (BASELINK, "baselink", 'x', 3) +DEFTREECODE (BASELINK, "baselink", 'x', 0) /* Template definition. The following fields have the specified uses, although there are other macros in cp-tree.h that should be used for @@ -157,16 +157,7 @@ DEFTREECODE (TEMPLATE_DECL, "template_decl", 'd', 0) The LEVEL is the level of the parameter when we are worrying about the types of things; the ORIG_LEVEL is the level when we are worrying about instantiating things. */ -DEFTREECODE (TEMPLATE_PARM_INDEX, "template_parm_index", 'x', - /* The addition of (sizeof(tree) - 1) in the next expression - is to handle the case when padding pushes us past an even - multiple of sizeof(tree). */ - /* We used to try to calculate this using - 1+3*sizeof(HOST_WIDE_INT), but that fails if alignment - makes it bigger. */ - ((sizeof (template_parm_index) - sizeof (struct tree_common)) - + sizeof (tree) - 1) - / sizeof (tree)) +DEFTREECODE (TEMPLATE_PARM_INDEX, "template_parm_index", 'x', 0) /* Index into a template parameter list. This parameter must be a type. The TYPE_FIELDS value will be a TEMPLATE_PARM_INDEX. */ @@ -212,7 +203,7 @@ DEFTREECODE (USING_DECL, "using_decl", 'd', 0) DEFTREECODE (USING_STMT, "using_directive", 'e', 1) /* An un-parsed default argument. Looks like an IDENTIFIER_NODE. */ -DEFTREECODE (DEFAULT_ARG, "default_arg", 'x', 2) +DEFTREECODE (DEFAULT_ARG, "default_arg", 'x', 0) /* A template-id, like foo<int>. The first operand is the template. The second is the TREE_LIST or TREE_VEC of explicitly specified @@ -224,11 +215,11 @@ DEFTREECODE (TEMPLATE_ID_EXPR, "template_id_expr", 'e', 2) /* A list-like node for chaining overloading candidates. TREE_TYPE is the original name, and the parameter is the FUNCTION_DECL. */ -DEFTREECODE (OVERLOAD, "overload", 'x', 1) +DEFTREECODE (OVERLOAD, "overload", 'x', 0) /* A generic wrapper for something not tree that we want to include in tree structure. */ -DEFTREECODE (WRAPPER, "wrapper", 'x', 1) +DEFTREECODE (WRAPPER, "wrapper", 'x', 0) /* Used to represent deferred name lookup for dependent names while parsing a template declaration. The first argument is an diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 92a227f..2986d6b 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -353,17 +353,6 @@ struct tree_wrapper GTY(()) struct z_candidate *z_c; }; -#define SOURCE_LOCUS(NODE) \ - (((struct tree_srcloc*)SRCLOC_CHECK (NODE))->locus) -#define SRCLOC_FILE(NODE) SOURCE_LOCUS (NODE).file -#define SRCLOC_LINE(NODE) SOURCE_LOCUS (NODE).line - -struct tree_srcloc GTY(()) -{ - struct tree_common common; - location_t locus; -}; - /* Macros for access to language-specific slots in an identifier. */ #define IDENTIFIER_NAMESPACE_BINDINGS(NODE) \ @@ -466,7 +455,6 @@ struct tree_default_arg GTY (()) }; enum cp_tree_node_structure_enum { - TS_CP_COMMON, TS_CP_GENERIC, TS_CP_IDENTIFIER, TS_CP_TPI, @@ -475,7 +463,6 @@ enum cp_tree_node_structure_enum { TS_CP_OVERLOAD, TS_CP_BASELINK, TS_CP_WRAPPER, - TS_CP_SRCLOC, TS_CP_DEFAULT_ARG, LAST_TS_CP_ENUM }; @@ -484,7 +471,6 @@ enum cp_tree_node_structure_enum { union lang_tree_node GTY((desc ("cp_tree_node_structure (&%h)"), chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)"))) { - struct tree_common GTY ((tag ("TS_CP_COMMON"))) common; 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; @@ -492,7 +478,6 @@ union lang_tree_node GTY((desc ("cp_tree_node_structure (&%h)"), struct tree_overload GTY ((tag ("TS_CP_OVERLOAD"))) overload; struct tree_baselink GTY ((tag ("TS_CP_BASELINK"))) baselink; struct tree_wrapper GTY ((tag ("TS_CP_WRAPPER"))) wrapper; - struct tree_srcloc GTY ((tag ("TS_CP_SRCLOC"))) srcloc; struct tree_default_arg GTY ((tag ("TS_CP_DEFAULT_ARG"))) default_arg; struct lang_identifier GTY ((tag ("TS_CP_IDENTIFIER"))) identifier; }; @@ -4212,7 +4197,6 @@ extern tree decl_namespace_context (tree); extern tree lvalue_type (tree); extern tree error_type (tree); extern tree build_zc_wrapper (struct z_candidate *); -extern tree build_srcloc_here (void); extern int varargs_function_p (tree); extern int really_overloaded_fn (tree); extern int cp_tree_equal (tree, tree); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 376db75..4734d76 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -14405,7 +14405,6 @@ cp_tree_node_structure (union lang_tree_node * t) case PTRMEM_CST: return TS_CP_PTRMEM; case BASELINK: return TS_CP_BASELINK; case WRAPPER: return TS_CP_WRAPPER; - case SRCLOC: return TS_CP_SRCLOC; default: return TS_CP_GENERIC; } } diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index a79b8a5..b5ea239 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -49,11 +49,10 @@ typedef int (*tree_fn_t) PARAMS ((tree, void*)); /* The PENDING_TEMPLATES is a TREE_LIST of templates whose instantiations have been deferred, either because their definitions - were not yet available, or because we were putting off doing the - work. The TREE_PURPOSE of each entry is a SRCLOC indicating where - the instantiate request occurred; the TREE_VALUE is either a DECL - (for a function or static data member), or a TYPE (for a class) - indicating what we are hoping to instantiate. */ + were not yet available, or because we were putting off doing the work. + The TREE_PURPOSE of each entry is either a DECL (for a function or + static data member), or a TYPE (for a class) indicating what we are + hoping to instantiate. The TREE_VALUE is not used. */ static GTY(()) tree pending_templates; static GTY(()) tree last_pending_template; diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index a5858bf..97d297a 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -43,7 +43,6 @@ static hashval_t list_hash_pieces PARAMS ((tree, tree, tree)); static hashval_t list_hash PARAMS ((const void *)); static cp_lvalue_kind lvalue_p_1 PARAMS ((tree, int, int)); static tree no_linkage_helper PARAMS ((tree *, int *, void *)); -static tree build_srcloc PARAMS ((const char *, int)); static tree mark_local_for_remap_r PARAMS ((tree *, int *, void *)); static tree cp_unsave_r PARAMS ((tree *, int *, void *)); static tree build_target_expr PARAMS ((tree, tree)); @@ -1824,26 +1823,6 @@ build_zc_wrapper (ptr) return t; } -static tree -build_srcloc (file, line) - const char *file; - int line; -{ - tree t; - - t = make_node (SRCLOC); - SRCLOC_FILE (t) = file; - SRCLOC_LINE (t) = line; - - return t; -} - -tree -build_srcloc_here () -{ - return build_srcloc (input_filename, lineno); -} - /* The type of ARG when used as an lvalue. */ tree |