diff options
52 files changed, 201 insertions, 172 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a288901d290..0b9c8e60610 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,13 @@ 2003-09-21 Richard Henderson <rth@redhat.com> + * tree.h c-aux-info.c, c-decl.c, c-parse.in, coverage.c, dbxout.c, + diagnostic.c, dwarf2out.c, dwarfout.c, function.c, integrate.c, + print-tree.c, stmt.c, toplev.c, tree-dump.c, tree-inline.c, + tree-optimize.c, tree.c, tree.def, xcoffout.c, config/alpha/alpha.c, + config/mips/mips.c, doc/c-tree.texi, objc/objc-act.c: Revert. + +2003-09-21 Richard Henderson <rth@redhat.com> + * tree.h (TREE_LOCUS): Rename from DECL_SOURCE_LOCATION; make const. (TREE_FILENAME, TREE_LINENO): Likewise. (set_tree_locus, copy_tree_locus, set_tree_file_line): New. diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 51ba6b4783d..c84af19d0d6 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,9 @@ 2003-09-21 Richard Henderson <rth@redhat.com> + * trans.c, utils.c: Revert. + +2003-09-21 Richard Henderson <rth@redhat.com> + * trans.c, utils.c: Update for DECL_SOURCE_LOCATION rename and change to const. diff --git a/gcc/ada/trans.c b/gcc/ada/trans.c index 889b267cd17..8e6f9ac4e49 100644 --- a/gcc/ada/trans.c +++ b/gcc/ada/trans.c @@ -2611,7 +2611,7 @@ tree_transform (gnat_node) the body so that the line number notes are written correctly. */ set_lineno (gnat_node, 0); - set_tree_locus (gnu_subprog_decl, input_location); + DECL_SOURCE_LOCATION (gnu_subprog_decl) = input_location; begin_subprog_body (gnu_subprog_decl); set_lineno (gnat_node, 1); @@ -5333,7 +5333,7 @@ build_unit_elab (gnat_unit, body_p, gnu_elab_list) { tree lhs = TREE_PURPOSE (gnu_elab_list); - input_location = TREE_LOCUS (lhs); + input_location = DECL_SOURCE_LOCATION (lhs); /* If LHS has a padded type, convert it to the unpadded type so the assignment is done properly. */ diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c index eddfb320011..186b0fdb175 100644 --- a/gcc/ada/utils.c +++ b/gcc/ada/utils.c @@ -1655,9 +1655,9 @@ create_label_decl (label_name) { tree label_decl = build_decl (LABEL_DECL, label_name, void_type_node); - DECL_CONTEXT (label_decl) = current_function_decl; - DECL_MODE (label_decl) = VOIDmode; - set_tree_locus (label_decl, input_location); + DECL_CONTEXT (label_decl) = current_function_decl; + DECL_MODE (label_decl) = VOIDmode; + DECL_SOURCE_LOCATION (label_decl) = input_location; return label_decl; } diff --git a/gcc/c-aux-info.c b/gcc/c-aux-info.c index 0a14839a357..e785ade2239 100644 --- a/gcc/c-aux-info.c +++ b/gcc/c-aux-info.c @@ -569,8 +569,8 @@ gen_aux_info_record (tree fndecl, int is_definition, int is_implicit, /* Write the actual line of auxiliary info. */ fprintf (aux_info_file, "/* %s:%d:%c%c */ %s;", - TREE_FILENAME (fndecl), - TREE_LINENO (fndecl), + DECL_SOURCE_FILE (fndecl), + DECL_SOURCE_LINE (fndecl), (is_implicit) ? 'I' : (is_prototyped) ? 'N' : 'O', (is_definition) ? 'F' : 'C', gen_decl (fndecl, is_definition, ansi)); diff --git a/gcc/c-decl.c b/gcc/c-decl.c index f58f5601d9e..db35f9a9ea9 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -905,7 +905,8 @@ duplicate_decls (tree newdecl, tree olddecl, int different_binding_level, return 0; } } - else if (TREE_CODE (olddecl) == FUNCTION_DECL && !TREE_LOCUS_SET_P (olddecl)) + else if (TREE_CODE (olddecl) == FUNCTION_DECL + && DECL_SOURCE_LINE (olddecl) == 0) { /* A function declaration for a predeclared function that isn't actually built in. */ @@ -1174,7 +1175,7 @@ duplicate_decls (tree newdecl, tree olddecl, int different_binding_level, } /* Optionally warn about more than one declaration for the same name. */ - if (errmsg == 0 && warn_redundant_decls && TREE_LOCUS_SET_P (olddecl) + if (errmsg == 0 && warn_redundant_decls && DECL_SOURCE_LINE (olddecl) != 0 /* Don't warn about a function declaration followed by a definition. */ && !(TREE_CODE (newdecl) == FUNCTION_DECL && DECL_INITIAL (newdecl) != 0 @@ -1271,7 +1272,10 @@ duplicate_decls (tree newdecl, tree olddecl, int different_binding_level, information so that meaningful diagnostics can be given. */ if (DECL_INITIAL (newdecl) == 0 && DECL_INITIAL (olddecl) != 0 && ! different_binding_level) - copy_tree_locus (newdecl, olddecl); + { + DECL_SOURCE_LINE (newdecl) = DECL_SOURCE_LINE (olddecl); + DECL_SOURCE_FILE (newdecl) = DECL_SOURCE_FILE (olddecl); + } /* Merge the unused-warning information. */ if (DECL_IN_SYSTEM_HEADER (olddecl)) @@ -1521,7 +1525,7 @@ warn_if_shadowing (tree x, tree old) /* Shadow warnings not wanted? */ || !warn_shadow /* No shadow warnings for internally generated vars. */ - || !TREE_LOCUS_SET_P (x) + || DECL_SOURCE_LINE (x) == 0 /* No shadow warnings for vars made for inlining. */ || DECL_FROM_INLINE (x) /* Don't warn about the parm names in function declarator @@ -1589,7 +1593,7 @@ warn_if_shadowing (tree x, tree old) static void clone_underlying_type (tree x) { - if (!TREE_LOCUS_SET_P (x)) + if (DECL_SOURCE_LINE (x) == 0) { if (TYPE_NAME (TREE_TYPE (x)) == 0) TYPE_NAME (TREE_TYPE (x)) = x; @@ -1944,7 +1948,7 @@ make_label (tree name, location_t location) DECL_CONTEXT (label) = current_function_decl; DECL_MODE (label) = VOIDmode; - set_tree_locus (label, location); + DECL_SOURCE_LOCATION (label) = location; return label; } @@ -1991,7 +1995,7 @@ lookup_label (tree name) location to point here, for better diagnostics if it turns out not to have been defined. */ if (!TREE_USED (label)) - set_tree_locus (label, input_location); + DECL_SOURCE_LOCATION (label) = input_location; return label; } @@ -2070,7 +2074,7 @@ define_label (location_t location, tree name) /* The label has been used or declared already in this function, but not defined. Update its location to point to this definition. */ - set_tree_locus (label, location); + DECL_SOURCE_LOCATION (label) = location; } else { @@ -5458,7 +5462,7 @@ start_function (tree declspecs, tree declarator, tree attributes) && TYPE_ARG_TYPES (TREE_TYPE (decl1)) == 0) { TREE_TYPE (decl1) = TREE_TYPE (old_decl); - current_function_prototype_locus = TREE_LOCUS (old_decl); + current_function_prototype_locus = DECL_SOURCE_LOCATION (old_decl); } /* Optionally warn of old-fashioned def with no previous prototype. */ @@ -5751,7 +5755,7 @@ store_parm_decls_oldstyle (void) { decl = build_decl (PARM_DECL, TREE_VALUE (parm), integer_type_node); DECL_ARG_TYPE (decl) = TREE_TYPE (decl); - copy_tree_locus (decl, fndecl); + DECL_SOURCE_LOCATION (decl) = DECL_SOURCE_LOCATION (fndecl); pushdecl (decl); if (flag_isoc99) diff --git a/gcc/c-parse.in b/gcc/c-parse.in index 35825461b33..bb9cc1a7703 100644 --- a/gcc/c-parse.in +++ b/gcc/c-parse.in @@ -414,7 +414,7 @@ fndef: YYERROR1; } old_style_parm_decls save_location - { set_tree_locus (current_function_decl, $6); + { DECL_SOURCE_LOCATION (current_function_decl) = $6; store_parm_decls (); } compstmt_or_error { finish_function (); @@ -427,7 +427,7 @@ fndef: YYERROR1; } old_style_parm_decls save_location - { set_tree_locus (current_function_decl, $6); + { DECL_SOURCE_LOCATION (current_function_decl) = $6; store_parm_decls (); } compstmt_or_error { finish_function (); @@ -440,7 +440,7 @@ fndef: YYERROR1; } old_style_parm_decls save_location - { set_tree_locus (current_function_decl, $5); + { DECL_SOURCE_LOCATION (current_function_decl) = $5; store_parm_decls (); } compstmt_or_error { finish_function (); @@ -1563,7 +1563,7 @@ nested_function: } old_style_parm_decls save_location { tree decl = current_function_decl; - set_tree_locus (decl, $4); + DECL_SOURCE_LOCATION (decl) = $4; store_parm_decls (); } /* This used to use compstmt_or_error. That caused a bug with input `f(g) int g {}', @@ -1594,7 +1594,7 @@ notype_nested_function: } old_style_parm_decls save_location { tree decl = current_function_decl; - set_tree_locus (decl, $4); + DECL_SOURCE_LOCATION (decl) = $4; store_parm_decls (); } /* This used to use compstmt_or_error. That caused a bug with input `f(g) int g {}', diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 4b32ca0a907..72d01af2f15 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -7349,11 +7349,13 @@ alpha_start_function (FILE *file, const char *fnname, if (write_symbols == SDB_DEBUG) { #ifdef ASM_OUTPUT_SOURCE_FILENAME - ASM_OUTPUT_SOURCE_FILENAME (file, TREE_FILENAME (current_function_decl)); + ASM_OUTPUT_SOURCE_FILENAME (file, + DECL_SOURCE_FILE (current_function_decl)); #endif #ifdef ASM_OUTPUT_SOURCE_LINE if (debug_info_level != DINFO_LEVEL_TERSE) - ASM_OUTPUT_SOURCE_LINE (file, TREE_LINENO (current_function_decl), 0); + ASM_OUTPUT_SOURCE_LINE (file, + DECL_SOURCE_LINE (current_function_decl), 0); #endif } diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 307027ed56f..8bd2139d9ef 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -6507,11 +6507,11 @@ mips_output_function_prologue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED) need the source filename more than once in the file, beyond what is emitted by the debug information. */ if (!TARGET_GAS) - ASM_OUTPUT_SOURCE_FILENAME (file, TREE_FILENAME (current_function_decl)); + ASM_OUTPUT_SOURCE_FILENAME (file, DECL_SOURCE_FILE (current_function_decl)); #ifdef SDB_DEBUGGING_INFO if (debug_info_level != DINFO_LEVEL_TERSE && write_symbols == SDB_DEBUG) - ASM_OUTPUT_SOURCE_LINE (file, TREE_LINENO (current_function_decl), 0); + ASM_OUTPUT_SOURCE_LINE (file, DECL_SOURCE_LINE (current_function_decl), 0); #endif /* In mips16 mode, we may need to generate a 32 bit to handle diff --git a/gcc/coverage.c b/gcc/coverage.c index dc10206cef8..e6f4129dd79 100644 --- a/gcc/coverage.c +++ b/gcc/coverage.c @@ -410,9 +410,9 @@ checksum_string (unsigned chksum, const char *string) static unsigned compute_checksum (void) { - unsigned chksum = TREE_LINENO (current_function_decl); + unsigned chksum = DECL_SOURCE_LINE (current_function_decl); - chksum = checksum_string (chksum, TREE_FILENAME (current_function_decl)); + chksum = checksum_string (chksum, DECL_SOURCE_FILE (current_function_decl)); chksum = checksum_string (chksum, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl))); @@ -432,8 +432,8 @@ coverage_begin_output (void) if (!bbg_function_announced) { - const char *file = TREE_FILENAME (current_function_decl); - unsigned line = TREE_LINENO (current_function_decl); + const char *file = DECL_SOURCE_FILE (current_function_decl); + unsigned line = DECL_SOURCE_LINE (current_function_decl); unsigned long offset; if (!bbg_file_opened) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 19c3c481343..7f85eaf9c79 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,6 +1,11 @@ 2003-09-21 Richard Henderson <rth@redhat.com> * class.c, cp-tree.h, decl.c, decl2.c, error.c, init.c, + method.c, optimize.c, pt.c, semantics.c, tree.c: Revert. + +2003-09-21 Richard Henderson <rth@redhat.com> + + * class.c, cp-tree.h, decl.c, decl2.c, error.c, init.c, method.c, optimize.c, pt.c, semantics.c, tree.c: Update for DECL_SOURCE_LOCATION rename and change to const. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index ebcad8041a5..17ff0e49674 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -5212,7 +5212,7 @@ finish_struct (tree t, tree attributes) /* Nadger the current location so that diagnostics point to the start of the struct, not the end. */ - input_location = TREE_LOCUS (TYPE_NAME (t)); + input_location = DECL_SOURCE_LOCATION (TYPE_NAME (t)); if (processing_template_decl) { diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 8f931aa05b1..ef38d5565d8 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -390,7 +390,7 @@ typedef enum cp_id_kind /* The IDENTIFIER_VALUE is the value of the IDENTIFIER_BINDING, or NULL_TREE if there is no binding. */ #define IDENTIFIER_VALUE(NODE) \ - (IDENTIFIER_BINDING (NODE) ? IDENTIFIER_BINDING (NODE)->value : NULL_TREE) + (IDENTIFIER_BINDING (NODE) ? IDENTIFIER_BINDING (NODE)->value : NULL) /* If IDENTIFIER_CLASS_VALUE is set, then NODE is bound in the current class, and IDENTIFIER_CLASS_VALUE is the value binding. This is diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 376d8de10de..892affacc82 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -1787,7 +1787,7 @@ print_binding_level (struct cp_binding_level* lvl) continue; if (no_print_builtins && (TREE_CODE (t) == TYPE_DECL) - && (!strcmp (TREE_FILENAME (t), "<built-in>"))) + && (!strcmp (DECL_SOURCE_FILE (t),"<built-in>"))) continue; /* Function decls tend to have longer names. */ @@ -3153,8 +3153,9 @@ duplicate_decls (tree newdecl, tree olddecl) if (DECL_INITIAL (DECL_TEMPLATE_RESULT (olddecl)) == NULL_TREE && DECL_INITIAL (DECL_TEMPLATE_RESULT (newdecl)) != NULL_TREE) { - copy_tree_locus (olddecl, newdecl); - copy_tree_locus (DECL_TEMPLATE_RESULT (olddecl), newdecl); + DECL_SOURCE_LOCATION (olddecl) + = DECL_SOURCE_LOCATION (DECL_TEMPLATE_RESULT (olddecl)) + = DECL_SOURCE_LOCATION (newdecl); } return 1; @@ -3194,13 +3195,13 @@ duplicate_decls (tree newdecl, tree olddecl) TYPE_RAISES_EXCEPTIONS (oldtype)); if ((pedantic || ! DECL_IN_SYSTEM_HEADER (olddecl)) - && TREE_LOCUS_SET_P (olddecl) + && DECL_SOURCE_LINE (olddecl) != 0 && flag_exceptions && !comp_except_specs (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (newdecl)), TYPE_RAISES_EXCEPTIONS (TREE_TYPE (olddecl)), 1)) { error ("declaration of `%F' throws different exceptions", - newdecl); + newdecl); cp_error_at ("than previous declaration `%F'", olddecl); } } @@ -3231,7 +3232,7 @@ duplicate_decls (tree newdecl, tree olddecl) && DECL_INITIAL (olddecl) != NULL_TREE) { DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl); - copy_tree_locus (newdecl, olddecl); + DECL_SOURCE_LOCATION (newdecl) = DECL_SOURCE_LOCATION (olddecl); if (CAN_HAVE_FULL_LANG_DECL_P (newdecl) && DECL_LANG_SPECIFIC (newdecl) && DECL_LANG_SPECIFIC (olddecl)) @@ -3700,7 +3701,7 @@ pushdecl (tree x) if (TREE_CODE (x) == TYPE_DECL) { tree type = TREE_TYPE (x); - if (!TREE_LOCUS_SET_P (x)) + if (DECL_SOURCE_LINE (x) == 0) { if (TYPE_NAME (type) == 0) TYPE_NAME (type) = x; @@ -4074,7 +4075,7 @@ pushdecl_class_level (tree x) for (f = TYPE_FIELDS (TREE_TYPE (x)); f; f = TREE_CHAIN (f)) { location_t save_location = input_location; - input_location = TREE_LOCUS (f); + input_location = DECL_SOURCE_LOCATION (f); if (!pushdecl_class_level (f)) is_valid = false; input_location = save_location; @@ -4519,7 +4520,7 @@ make_label_decl (tree id, int local_p) /* Say where one reference is to the label, for the sake of the error if it is not defined. */ - set_tree_locus (decl, input_location); + DECL_SOURCE_LOCATION (decl) = input_location; /* Record the fact that this identifier is bound to this label. */ SET_IDENTIFIER_LABEL_VALUE (id, decl); @@ -4830,7 +4831,7 @@ define_label (location_t location, tree name) /* Mark label as having been defined. */ DECL_INITIAL (decl) = error_mark_node; /* Say where in the source. */ - set_tree_locus (decl, location); + DECL_SOURCE_LOCATION (decl) = location; if (ent) { ent->names_in_scope = current_binding_level->names; diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 084cc9b1021..b1ee970464e 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -2240,7 +2240,7 @@ start_static_initialization_or_destruction (tree decl, int initp) where DECL was declared so that error-messages make sense, and so that the debugger will show somewhat sensible file and line information. */ - input_location = TREE_LOCUS (decl); + input_location = DECL_SOURCE_LOCATION (decl); /* Because of: diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 74d1218af1e..a10dcf6a876 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -1959,7 +1959,7 @@ location_of (tree t) else if (TREE_CODE (t) == OVERLOAD) t = OVL_FUNCTION (t); - return TREE_LOCUS (t); + return DECL_SOURCE_LOCATION (t); } /* Now the interfaces from error et al to dump_type et al. Each takes an diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 4427754ea40..ace82cdc39f 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -2414,9 +2414,9 @@ create_temporary_var (tree type) decl = build_decl (VAR_DECL, NULL_TREE, type); TREE_USED (decl) = 1; DECL_ARTIFICIAL (decl) = 1; + DECL_SOURCE_LOCATION (decl) = input_location; DECL_IGNORED_P (decl) = 1; DECL_CONTEXT (decl) = current_function_decl; - set_tree_locus (decl, input_location); return decl; } diff --git a/gcc/cp/method.c b/gcc/cp/method.c index b5d5e327770..52770042bee 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -719,7 +719,7 @@ synthesize_method (tree fndecl) where the attempt to generate the function occurs, giving the user a hint as to why we are attempting to generate the function. */ - set_tree_locus (fndecl, input_location); + DECL_SOURCE_LOCATION (fndecl) = input_location; interface_unknown = 1; start_function (NULL_TREE, fndecl, NULL_TREE, SF_DEFAULT | SF_PRE_PARSED); diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c index a817084bb82..2b7df6c5244 100644 --- a/gcc/cp/optimize.c +++ b/gcc/cp/optimize.c @@ -109,7 +109,7 @@ update_cloned_parm (tree parm, tree cloned_parm) /* The name may have changed from the declaration. */ DECL_NAME (cloned_parm) = DECL_NAME (parm); - copy_tree_locus (cloned_parm, parm); + DECL_SOURCE_LOCATION (cloned_parm) = DECL_SOURCE_LOCATION (parm); } /* FN is a function that has a complete body. Clone the body as @@ -146,7 +146,7 @@ maybe_clone_body (tree fn) splay_tree decl_map; /* Update CLONE's source position information to match FN's. */ - copy_tree_locus (clone, fn); + DECL_SOURCE_LOCATION (clone) = DECL_SOURCE_LOCATION (fn); DECL_INLINE (clone) = DECL_INLINE (fn); DECL_DECLARED_INLINE_P (clone) = DECL_DECLARED_INLINE_P (fn); DECL_COMDAT (clone) = DECL_COMDAT (fn); diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index c1d49e7b056..12baea14a33 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -966,9 +966,10 @@ register_specialization (tree spec, tree tmpl, tree args) else if (DECL_TEMPLATE_SPECIALIZATION (fn)) { if (!duplicate_decls (spec, fn) && DECL_INITIAL (spec)) - /* Dup decl failed, but this is a new definition. Set the - line number so any errors match this new definition. */ - copy_tree_locus (fn, spec); + /* Dup decl failed, but this is a new + definition. Set the line number so any errors + match this new definition. */ + DECL_SOURCE_LOCATION (fn) = DECL_SOURCE_LOCATION (spec); return fn; } @@ -1782,8 +1783,9 @@ check_explicit_specialization (tree declarator, DECL_INITIAL (DECL_TEMPLATE_RESULT (tmpl)) = NULL_TREE; if (have_def) { - copy_tree_locus (tmpl, decl); - copy_tree_locus (DECL_TEMPLATE_RESULT (tmpl), decl); + DECL_SOURCE_LOCATION (tmpl) = DECL_SOURCE_LOCATION (decl); + DECL_SOURCE_LOCATION (DECL_TEMPLATE_RESULT (tmpl)) + = DECL_SOURCE_LOCATION (decl); } return tmpl; } @@ -4253,7 +4255,8 @@ lookup_template_class (tree d1, type_decl = create_implicit_typedef (DECL_NAME (template), t); DECL_CONTEXT (type_decl) = TYPE_CONTEXT (t); TYPE_STUB_DECL (t) = type_decl; - copy_tree_locus (type_decl, TYPE_STUB_DECL (template_type)); + DECL_SOURCE_LOCATION (type_decl) + = DECL_SOURCE_LOCATION (TYPE_STUB_DECL (template_type)); } else type_decl = TYPE_NAME (t); @@ -4709,7 +4712,7 @@ tsubst_friend_function (tree decl, tree args) tree new_friend; location_t saved_loc = input_location; - input_location = TREE_LOCUS (decl); + input_location = DECL_SOURCE_LOCATION (decl); if (TREE_CODE (decl) == FUNCTION_DECL && DECL_TEMPLATE_INSTANTIATION (decl) @@ -5150,7 +5153,7 @@ instantiate_class_template (tree type) /* Set the input location to the template definition. This is needed if tsubsting causes an error. */ - input_location = TREE_LOCUS (TYPE_NAME (pattern)); + input_location = DECL_SOURCE_LOCATION (TYPE_NAME (pattern)); TYPE_HAS_CONSTRUCTOR (type) = TYPE_HAS_CONSTRUCTOR (pattern); TYPE_HAS_DESTRUCTOR (type) = TYPE_HAS_DESTRUCTOR (pattern); @@ -5299,7 +5302,7 @@ instantiate_class_template (tree type) assist in error message reporting. Since we called push_tinst_level above, we don't need to restore these. */ - input_location = TREE_LOCUS (t); + input_location = DECL_SOURCE_LOCATION (t); if (TREE_CODE (t) == TEMPLATE_DECL) processing_template_decl++; @@ -5408,7 +5411,7 @@ instantiate_class_template (tree type) implicit functions at a predictable point, and the same point that would be used for non-template classes. */ typedecl = TYPE_MAIN_DECL (type); - input_location = TREE_LOCUS (typedecl); + input_location = DECL_SOURCE_LOCATION (typedecl); unreverse_member_declarations (type); finish_struct_1 (type); @@ -5705,7 +5708,7 @@ tsubst_decl (tree t, tree args, tree type, tsubst_flags_t complain) /* Set the filename and linenumber to improve error-reporting. */ saved_loc = input_location; - input_location = TREE_LOCUS (t); + input_location = DECL_SOURCE_LOCATION (t); switch (TREE_CODE (t)) { @@ -10771,7 +10774,7 @@ instantiate_decl (tree d, int defer_ok) else pattern_defined = ! DECL_IN_AGGR_P (code_pattern); - input_location = TREE_LOCUS (d); + input_location = DECL_SOURCE_LOCATION (d); if (pattern_defined) { @@ -10887,7 +10890,7 @@ instantiate_decl (tree d, int defer_ok) /* We already set the file and line above. Reset them now in case they changed as a result of calling regenerate_decl_from_template. */ - input_location = TREE_LOCUS (d); + input_location = DECL_SOURCE_LOCATION (d); if (TREE_CODE (d) == VAR_DECL) { @@ -11175,7 +11178,8 @@ tsubst_enum (tree tag, tree newtag, tree args) } finish_enum (newtag); - copy_tree_locus (TYPE_NAME (newtag), TYPE_NAME (tag)); + DECL_SOURCE_LOCATION (TYPE_NAME (newtag)) + = DECL_SOURCE_LOCATION (TYPE_NAME (tag)); } /* DECL is a FUNCTION_DECL that is a template specialization. Return diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index ca04ddf26b6..ef42579f349 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2030,7 +2030,7 @@ begin_class_definition (tree t) } /* Update the location of the decl. */ - set_tree_locus (TYPE_NAME (t), input_location); + DECL_SOURCE_LOCATION (TYPE_NAME (t)) = input_location; if (TYPE_BEING_DEFINED (t)) { diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 6dce605dbd1..0c729d6118c 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -2153,7 +2153,7 @@ cp_copy_res_decl_for_inlining (tree result, && DECL_NAME (var) == NULL_TREE) { DECL_NAME (var) = DECL_NAME (nrv); - copy_tree_locus (var, nrv); + DECL_SOURCE_LOCATION (var) = DECL_SOURCE_LOCATION (nrv); DECL_ABSTRACT_ORIGIN (var) = DECL_ORIGIN (nrv); /* Don't lose initialization info. */ DECL_INITIAL (var) = DECL_INITIAL (nrv); diff --git a/gcc/dbxout.c b/gcc/dbxout.c index 3f457b594b6..e4c797894c0 100644 --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -2689,7 +2689,7 @@ static void dbxout_prepare_symbol (tree decl ATTRIBUTE_UNUSED) { #ifdef WINNING_GDB - const char *filename = TREE_FILENAME (decl); + const char *filename = DECL_SOURCE_FILE (decl); dbxout_source_file (asmfile, filename); #endif @@ -2703,7 +2703,7 @@ dbxout_finish_symbol (tree sym) #else int line = 0; if (use_gnu_debug_info_extensions && sym != 0) - line = TREE_LINENO (sym); + line = DECL_SOURCE_LINE (sym); fprintf (asmfile, "\",%d,0,%d,", current_sym_code, line); if (current_sym_addr) diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index 953733995b2..c29867a60b3 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -139,7 +139,7 @@ text_specifies_location (text_info *text, location_t *locus) else if (p[0] == '%' && p[1] == 'J') { tree t = va_arg (*text->args_ptr, tree); - *locus = TREE_LOCUS (t); + *locus = DECL_SOURCE_LOCATION (t); text->format_spec = p + 2; return true; } diff --git a/gcc/doc/c-tree.texi b/gcc/doc/c-tree.texi index 7f125ee58d6..29ccaec317d 100644 --- a/gcc/doc/c-tree.texi +++ b/gcc/doc/c-tree.texi @@ -856,13 +856,13 @@ entity. @item TREE_TYPE This macro returns the type of the entity declared. -@item TREE_FILENAME +@item DECL_SOURCE_FILE This macro returns the name of the file in which the entity was declared, as a @code{char*}. For an entity declared implicitly by the compiler (like @code{__builtin_memcpy}), this will be the string @code{"<internal>"}. -@item TREE_LINENO +@item DECL_SOURCE_LINE This macro returns the line number at which the entity was declared, as an @code{int}. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index dc28f11c142..5fa730e1b55 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -9907,10 +9907,10 @@ add_pure_or_virtual_attribute (dw_die_ref die, tree func_decl) static void add_src_coords_attributes (dw_die_ref die, tree decl) { - unsigned file_index = lookup_filename (TREE_FILENAME (decl)); + unsigned file_index = lookup_filename (DECL_SOURCE_FILE (decl)); add_AT_unsigned (die, DW_AT_decl_file, file_index); - add_AT_unsigned (die, DW_AT_decl_line, TREE_LINENO (decl)); + add_AT_unsigned (die, DW_AT_decl_line, DECL_SOURCE_LINE (decl)); } /* Add a DW_AT_name attribute and source coordinate attribute for the @@ -10596,7 +10596,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die) } else if (old_die) { - unsigned file_index = lookup_filename (TREE_FILENAME (decl)); + unsigned file_index = lookup_filename (DECL_SOURCE_FILE (decl)); if (!get_AT_flag (old_die, DW_AT_declaration) /* We can have a normal definition following an inline one in the @@ -10625,7 +10625,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die) && (DECL_ARTIFICIAL (decl) || (get_AT_unsigned (old_die, DW_AT_decl_file) == file_index && (get_AT_unsigned (old_die, DW_AT_decl_line) - == (unsigned) TREE_LINENO (decl))))) + == (unsigned) DECL_SOURCE_LINE (decl))))) { subr_die = old_die; @@ -10640,9 +10640,9 @@ gen_subprogram_die (tree decl, dw_die_ref context_die) if (get_AT_unsigned (old_die, DW_AT_decl_file) != file_index) add_AT_unsigned (subr_die, DW_AT_decl_file, file_index); if (get_AT_unsigned (old_die, DW_AT_decl_line) - != (unsigned) TREE_LINENO (decl)) + != (unsigned) DECL_SOURCE_LINE (decl)) add_AT_unsigned - (subr_die, DW_AT_decl_line, TREE_LINENO (decl)); + (subr_die, DW_AT_decl_line, DECL_SOURCE_LINE (decl)); } } else @@ -10859,16 +10859,16 @@ gen_variable_die (tree decl, dw_die_ref context_die) add_AT_die_ref (var_die, DW_AT_specification, old_die); if (DECL_NAME (decl)) { - unsigned file_index = lookup_filename (TREE_FILENAME (decl)); + unsigned file_index = lookup_filename (DECL_SOURCE_FILE (decl)); if (get_AT_unsigned (old_die, DW_AT_decl_file) != file_index) add_AT_unsigned (var_die, DW_AT_decl_file, file_index); if (get_AT_unsigned (old_die, DW_AT_decl_line) - != (unsigned) TREE_LINENO (decl)) + != (unsigned) DECL_SOURCE_LINE (decl)) add_AT_unsigned (var_die, DW_AT_decl_line, - TREE_LINENO (decl)); + DECL_SOURCE_LINE (decl)); } } else @@ -12036,7 +12036,7 @@ dwarf2out_decl (tree decl) /* Don't bother trying to generate any DIEs to represent any of the normal built-in types for the language we are compiling. */ - if (!TREE_LOCUS_SET_P (decl)) + if (DECL_SOURCE_LINE (decl) == 0) { /* OK, we need to generate one for `bool' so GDB knows what type comparisons have. */ diff --git a/gcc/dwarfout.c b/gcc/dwarfout.c index 0ad9d0fcf1f..dfd1f0b57e1 100644 --- a/gcc/dwarfout.c +++ b/gcc/dwarfout.c @@ -3411,10 +3411,10 @@ name_and_src_coords_attributes (tree decl) Fred Fish sez that m68k/svr4 assemblers botch those. */ ASM_OUTPUT_POP_SECTION (asm_out_file); - file_index = lookup_filename (TREE_FILENAME (decl)); + file_index = lookup_filename (DECL_SOURCE_FILE (decl)); ASM_OUTPUT_PUSH_SECTION (asm_out_file, DEBUG_SECTION); - src_coords_attribute (file_index, TREE_LINENO (decl)); + src_coords_attribute (file_index, DECL_SOURCE_LINE (decl)); } #endif /* defined(DWARF_DECL_COORDINATES) */ } @@ -5618,7 +5618,7 @@ dwarfout_file_scope_decl (tree decl, int set_finalizing) /* ??? This code is different than the equivalent code in dwarf2out.c. The dwarf2out.c code is probably more correct. */ - if (!TREE_LOCUS_SET_P (decl) + if (DECL_SOURCE_LINE (decl) == 0 && (type_is_fundamental (TREE_TYPE (decl)) || TREE_CODE (TREE_TYPE (decl)) == LANG_TYPE)) return; diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog index 5d588e974d8..8ab5c2c3ab4 100644 --- a/gcc/f/ChangeLog +++ b/gcc/f/ChangeLog @@ -1,5 +1,9 @@ 2003-09-21 Richard Henderson <rth@redhat.com> + * com.c, ste.c: Revert. + +2003-09-21 Richard Henderson <rth@redhat.com> + * com.c, ste.c: Update for DECL_SOURCE_LOCATION rename and change to const. diff --git a/gcc/f/com.c b/gcc/f/com.c index 9658a544bad..a5100d9bfa9 100644 --- a/gcc/f/com.c +++ b/gcc/f/com.c @@ -13227,7 +13227,7 @@ duplicate_decls (tree newdecl, tree olddecl) return 0; } else if (TREE_CODE (olddecl) == FUNCTION_DECL - && !TREE_LOCUS_SET_P (olddecl)) + && DECL_SOURCE_LINE (olddecl) == 0) { /* A function declaration for a predeclared function that isn't actually built in. */ @@ -13297,7 +13297,8 @@ duplicate_decls (tree newdecl, tree olddecl) if ((DECL_INITIAL (newdecl) == 0 && DECL_INITIAL (olddecl) != 0) || (DECL_CONTEXT (newdecl) != 0 && DECL_CONTEXT (olddecl) == 0)) { - copy_tree_locus (newdecl, olddecl); + DECL_SOURCE_LINE (newdecl) = DECL_SOURCE_LINE (olddecl); + DECL_SOURCE_FILE (newdecl) = DECL_SOURCE_FILE (olddecl); if (DECL_CONTEXT (olddecl) == 0 && TREE_CODE (newdecl) != FUNCTION_DECL) @@ -14534,7 +14535,7 @@ pushdecl (tree x) if (TREE_CODE (x) == TYPE_DECL) { - if (!TREE_LOCUS_SET_P (x)) + if (DECL_SOURCE_LINE (x) == 0) { if (TYPE_NAME (TREE_TYPE (x)) == 0) TYPE_NAME (TREE_TYPE (x)) = x; diff --git a/gcc/f/ste.c b/gcc/f/ste.c index dc0d27e9da1..82435bc8dc8 100644 --- a/gcc/f/ste.c +++ b/gcc/f/ste.c @@ -2392,8 +2392,8 @@ ffeste_labeldef_branch (ffelab label) assert (DECL_INITIAL (glabel) == NULL_TREE); DECL_INITIAL (glabel) = error_mark_node; - set_tree_file_line (glabel, ffelab_definition_filename (label), - ffelab_definition_filelinenum (label)); + DECL_SOURCE_FILE (glabel) = ffelab_definition_filename (label); + DECL_SOURCE_LINE (glabel) = ffelab_definition_filelinenum (label); emit_nop (); diff --git a/gcc/function.c b/gcc/function.c index 1af4d38ff01..baec4ab3048 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -6399,8 +6399,8 @@ init_function_start (tree subr) function. Also tell final how to output a linenum before the function prologue. Note linenums could be missing, e.g. when compiling a Java .class file. */ - if (TREE_LOCUS_SET_P (subr)) - emit_line_note (TREE_LOCUS (subr)); + if (DECL_SOURCE_LINE (subr)) + emit_line_note (DECL_SOURCE_LOCATION (subr)); /* Make sure first insn is a note even if we don't want linenums. This makes sure the first insn will never be deleted. diff --git a/gcc/integrate.c b/gcc/integrate.c index 2c6ff174551..21a738ea237 100644 --- a/gcc/integrate.c +++ b/gcc/integrate.c @@ -987,7 +987,7 @@ expand_inline_function (tree fndecl, tree parms, rtx target, int ignore, && ! (GET_CODE (XEXP (loc, 0)) == REG && REGNO (XEXP (loc, 0)) > LAST_VIRTUAL_REGISTER)) { - rtx note = emit_line_note (TREE_LOCUS (formal)); + rtx note = emit_line_note (DECL_SOURCE_LOCATION (formal)); if (note) RTX_INTEGRATED_P (note) = 1; @@ -2985,7 +2985,7 @@ output_inline_function (tree fndecl) /* Make sure warnings emitted by the optimizers (e.g. control reaches end of non-void function) is not wildly incorrect. */ - input_location = TREE_LOCUS (fndecl); + input_location = DECL_SOURCE_LOCATION (fndecl); /* Compile this function all the way down to assembly code. As a side effect this destroys the saved RTL representation, but diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index be46849d5fe..f0a863b2322 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,6 +1,11 @@ 2003-09-21 Richard Henderson <rth@redhat.com> * class.c, decl.c, jcf-parse.c, jcf-write.c, parse.y, + resource.c: Revert. + +2003-09-21 Richard Henderson <rth@redhat.com> + + * class.c, decl.c, jcf-parse.c, jcf-write.c, parse.y, resource.c: Update for DECL_SOURCE_LOCATION rename and change to const. 2003-09-20 Richard Henderson <rth@redhat.com> diff --git a/gcc/java/class.c b/gcc/java/class.c index 289dbfa2eb8..e3e6cc36e58 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -1728,8 +1728,8 @@ maybe_layout_super_class (tree super_class, tree this_class) { tree this_decl = TYPE_NAME (this_class); this_wrap = build_expr_wfl (this_class, - TREE_FILENAME (this_decl), - TREE_LINENO (this_decl), 0); + DECL_SOURCE_FILE (this_decl), + DECL_SOURCE_LINE (this_decl), 0); } super_class = do_resolve_class (NULL_TREE, /* FIXME? */ super_class, NULL_TREE, this_wrap); @@ -1767,8 +1767,8 @@ layout_class (tree this_class) tree decl = TYPE_NAME (TREE_PURPOSE (current)); sprintf (buffer, "\n which inherits from `%s' (%s:%d)", IDENTIFIER_POINTER (DECL_NAME (decl)), - TREE_FILENAME (decl), - TREE_LINENO (decl)); + DECL_SOURCE_FILE (decl), + DECL_SOURCE_LINE (decl)); obstack_grow (&temporary_obstack, buffer, strlen (buffer)); } obstack_1grow (&temporary_obstack, '\0'); @@ -2059,6 +2059,7 @@ emit_register_classes (void) init_decl = build_decl (FUNCTION_DECL, init_name, init_type); SET_DECL_ASSEMBLER_NAME (init_decl, init_name); + DECL_SOURCE_LINE (init_decl) = 0; TREE_STATIC (init_decl) = 1; current_function_decl = init_decl; DECL_RESULT (init_decl) = build_decl (RESULT_DECL, NULL_TREE, @@ -2083,7 +2084,7 @@ emit_register_classes (void) for ( t = registered_class; t; t = TREE_CHAIN (t)) emit_library_call (registerClass_libfunc, 0, VOIDmode, 1, XEXP (DECL_RTL (t), 0), Pmode); - input_location = TREE_LOCUS (init_decl); + input_location = DECL_SOURCE_LOCATION (init_decl); expand_function_end (); poplevel (1, 0, 1); rest_of_compilation (init_decl); diff --git a/gcc/java/decl.c b/gcc/java/decl.c index d92bbdce4ad..7ddf704efad 100644 --- a/gcc/java/decl.c +++ b/gcc/java/decl.c @@ -1070,7 +1070,7 @@ pushdecl (tree x) /* Maybe warn if shadowing something else. */ else if (warn_shadow && !DECL_EXTERNAL (x) /* No shadow warnings for internally generated vars. */ - && TREE_LOCUS_SET_P (x) + && DECL_SOURCE_LINE (x) != 0 /* No shadow warnings for vars made for inlining. */ && ! DECL_FROM_INLINE (x)) { @@ -1817,7 +1817,8 @@ java_expand_body (tree fndecl) int saved_lineno = input_line; current_function_decl = fndecl; - input_location = TREE_LOCUS (fndecl); + input_filename = DECL_SOURCE_FILE (fndecl); + input_line = DECL_SOURCE_LINE (fndecl); timevar_push (TV_EXPAND); diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c index eea2a15ced8..f47dbe0897a 100644 --- a/gcc/java/jcf-parse.c +++ b/gcc/java/jcf-parse.c @@ -145,10 +145,8 @@ set_source_filename (JCF *jcf, int index) return; } input_filename = sfname; - set_tree_file_line (TYPE_NAME (current_class), sfname, - TREE_LINENO (TYPE_NAME (current_class))); - if (current_class == main_class) - main_input_filename = input_filename; + DECL_SOURCE_FILE (TYPE_NAME (current_class)) = sfname; + if (current_class == main_class) main_input_filename = input_filename; } #define HANDLE_SOURCEFILE(INDEX) set_source_filename (jcf, INDEX) @@ -420,7 +418,7 @@ give_name_to_class (JCF *jcf, int i) tree class_name = unmangle_classname (JPOOL_UTF_DATA (jcf, j), JPOOL_UTF_LENGTH (jcf, j)); this_class = lookup_class (class_name); - input_filename = TREE_FILENAME (TYPE_NAME (this_class)); + input_filename = DECL_SOURCE_FILE (TYPE_NAME (this_class)); input_line = 0; if (main_input_filename == NULL && jcf == main_jcf) main_input_filename = input_filename; @@ -710,7 +708,7 @@ parse_class_file (void) java_layout_seen_class_methods (); - input_filename = TREE_FILENAME (TYPE_NAME (current_class)); + input_filename = DECL_SOURCE_FILE (TYPE_NAME (current_class)); input_line = 0; (*debug_hooks->start_source_file) (input_line, input_filename); init_outgoing_cpool (); diff --git a/gcc/java/jcf-write.c b/gcc/java/jcf-write.c index bc76c8888e8..82c77b1c831 100644 --- a/gcc/java/jcf-write.c +++ b/gcc/java/jcf-write.c @@ -3113,7 +3113,7 @@ generate_classfile (tree clas, struct jcf_partial *state) } ptr = methods_count_ptr; UNSAFE_PUT2 (methods_count); - source_file = TREE_FILENAME (TYPE_NAME (clas)); + source_file = DECL_SOURCE_FILE (TYPE_NAME (clas)); for (s = source_file; ; s++) { char ch = *s; @@ -3299,7 +3299,7 @@ make_class_file_name (tree clas) /* Make sure we put the class file into the .java file's directory, and not into some subdirectory thereof. */ char *t; - dname = TREE_FILENAME (TYPE_NAME (clas)); + dname = DECL_SOURCE_FILE (TYPE_NAME (clas)); slash = strrchr (dname, DIR_SEPARATOR); #ifdef DIR_SEPARATOR_2 if (! slash) diff --git a/gcc/java/parse.y b/gcc/java/parse.y index de0a7d40fa3..a5064e18465 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -3208,7 +3208,7 @@ classitf_redefinition_error (const char *context, tree id, tree decl, tree cl) { parse_error_context (cl, "%s `%s' already defined in %s:%d", context, IDENTIFIER_POINTER (id), - TREE_FILENAME (decl), TREE_LINENO (decl)); + DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl)); /* Here we should point out where its redefined. It's a unicode. FIXME */ } @@ -3716,10 +3716,12 @@ maybe_create_class_interface_decl (tree decl, tree raw_name, decl = push_class (make_class (), qualified_name); /* Take care of the file and line business */ - set_tree_file_line (decl, EXPR_WFL_FILENAME (cl), - (flag_emit_xref - ? EXPR_WFL_LINECOL (cl) : EXPR_WFL_LINENO (cl))); - + DECL_SOURCE_FILE (decl) = EXPR_WFL_FILENAME (cl); + /* If we're emiting xrefs, store the line/col number information */ + if (flag_emit_xref) + DECL_SOURCE_LINE (decl) = EXPR_WFL_LINECOL (cl); + else + DECL_SOURCE_LINE (decl) = EXPR_WFL_LINENO (cl); CLASS_FROM_SOURCE_P (TREE_TYPE (decl)) = 1; CLASS_PARSED_P (TREE_TYPE (decl)) = 1; CLASS_FROM_CURRENTLY_COMPILED_P (TREE_TYPE (decl)) = @@ -4203,7 +4205,7 @@ duplicate_declaration_error_p (tree new_field_name, tree new_type, tree cl) (cl , "Duplicate variable declaration: `%s %s' was `%s %s' (%s:%d)", t1, IDENTIFIER_POINTER (new_field_name), t2, IDENTIFIER_POINTER (DECL_NAME (decl)), - TREE_FILENAME (decl), TREE_LINENO (decl)); + DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl)); free (t1); free (t2); return 1; @@ -4685,7 +4687,7 @@ method_header (int flags, tree type, tree mdecl, tree throws) /* If doing xref, store column and line number information instead of the line number only. */ if (flag_emit_xref) - set_tree_file_line (meth, TREE_FILENAME (meth), EXPR_WFL_LINECOL (id)); + DECL_SOURCE_LINE (meth) = EXPR_WFL_LINECOL (id); return meth; } @@ -6703,8 +6705,8 @@ lookup_cl (tree decl) cl_v = build_expr_wfl (NULL_TREE, NULL, 0, 0); } - EXPR_WFL_FILENAME_NODE (cl_v) = get_identifier (TREE_FILENAME (decl)); - EXPR_WFL_SET_LINECOL (cl_v, TREE_LINENO (decl), -1); + EXPR_WFL_FILENAME_NODE (cl_v) = get_identifier (DECL_SOURCE_FILE (decl)); + EXPR_WFL_SET_LINECOL (cl_v, DECL_SOURCE_LINE (decl), -1); line = java_get_line_col (EXPR_WFL_FILENAME (cl_v), EXPR_WFL_LINENO (cl_v), EXPR_WFL_COLNO (cl_v)); @@ -7284,7 +7286,7 @@ declare_local_variables (int modifier, tree type, tree vlist) if ((other = lookup_name_in_blocks (name))) { variable_redefinition_error (wfl, name, TREE_TYPE (other), - TREE_LINENO (other)); + DECL_SOURCE_LINE (other)); continue; } @@ -7304,8 +7306,7 @@ declare_local_variables (int modifier, tree type, tree vlist) /* If doing xreferencing, replace the line number with the WFL compound value */ if (flag_emit_xref) - set_tree_file_line (decl, TREE_FILENAME (decl), - EXPR_WFL_LINECOL (wfl)); + DECL_SOURCE_LINE (decl) = EXPR_WFL_LINECOL (wfl); /* Don't try to use an INIT statement when an error was found */ if (init && java_error_count) @@ -7413,7 +7414,7 @@ create_artificial_method (tree class, int flags, tree type, static void start_artificial_method_body (tree mdecl) { - set_tree_file_line (mdecl, TREE_FILENAME (mdecl), 1); + DECL_SOURCE_LINE (mdecl) = 1; DECL_FUNCTION_LAST_LINE (mdecl) = 1; source_start_java_method (mdecl); enter_block (); @@ -7979,7 +7980,7 @@ start_complete_expand_method (tree mdecl) TREE_CHAIN (tem) = next; } pushdecl_force_head (DECL_ARGUMENTS (mdecl)); - input_location = TREE_LOCUS (mdecl); + input_line = DECL_SOURCE_LINE (mdecl); build_result_decl (mdecl); } @@ -10144,7 +10145,7 @@ check_deprecation (tree wfl, tree decl) to the record. */ decl = TYPE_NAME (TREE_TYPE (elt)); } - file = TREE_FILENAME (decl); + file = DECL_SOURCE_FILE (decl); /* Complain if the field is deprecated and the file it was defined in isn't compiled at the same time the file which contains its diff --git a/gcc/java/resource.c b/gcc/java/resource.c index 25b8a81010d..b71a6709f5e 100644 --- a/gcc/java/resource.c +++ b/gcc/java/resource.c @@ -114,6 +114,7 @@ write_resource_constructor (void) init_type = build_function_type (void_type_node, end_params_node); init_decl = build_decl (FUNCTION_DECL, init_name, init_type); + DECL_SOURCE_LINE (init_decl) = 0; SET_DECL_ASSEMBLER_NAME (init_decl, init_name); TREE_STATIC (init_decl) = 1; current_function_decl = init_decl; @@ -139,7 +140,7 @@ write_resource_constructor (void) Pmode); } - input_location = TREE_LOCUS (init_decl); + input_location = DECL_SOURCE_LOCATION (init_decl); expand_function_end (); poplevel (1, 0, 1); { diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 02678a4fb65..0c075430502 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -1984,12 +1984,13 @@ build_selector_translation_table (void) } if (!found) { - location_t loc = input_location; + /* Adjust line number for warning message. */ + int save_lineno = input_line; if (flag_next_runtime && TREE_PURPOSE (chain)) - loc = TREE_LOCUS (TREE_PURPOSE (chain)); - - warning ("%Hcreating selector for non existant method %s", - &loc, IDENTIFIER_POINTER (TREE_VALUE (chain))); + input_line = DECL_SOURCE_LINE (TREE_PURPOSE (chain)); + warning ("creating selector for non existant method %s", + IDENTIFIER_POINTER (TREE_VALUE (chain))); + input_line = save_lineno; } } @@ -2856,6 +2857,7 @@ build_tmp_function_decl (void) expr_decl = build1 (INDIRECT_REF, NULL_TREE, expr_decl); tmp_decl = define_decl (expr_decl, decl_specs); + DECL_SOURCE_LINE (tmp_decl) = 0; return tmp_decl; } diff --git a/gcc/print-tree.c b/gcc/print-tree.c index 40495009d9d..3d6c01e01ee 100644 --- a/gcc/print-tree.c +++ b/gcc/print-tree.c @@ -368,7 +368,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent) fprintf (file, " %s", GET_MODE_NAME (mode)); fprintf (file, " file %s line %d", - TREE_FILENAME (node), TREE_LINENO (node)); + DECL_SOURCE_FILE (node), DECL_SOURCE_LINE (node)); print_node (file, "size", DECL_SIZE (node), indent + 4); print_node (file, "unit size", DECL_SIZE_UNIT (node), indent + 4); diff --git a/gcc/stmt.c b/gcc/stmt.c index 40ad357a334..9d5553f2517 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -3981,7 +3981,7 @@ expand_decl_init (tree decl) } else if (DECL_INITIAL (decl) && TREE_CODE (DECL_INITIAL (decl)) != TREE_LIST) { - emit_line_note (TREE_LOCUS (decl)); + emit_line_note (DECL_SOURCE_LOCATION (decl)); expand_assignment (decl, DECL_INITIAL (decl), 0); emit_queue (); } diff --git a/gcc/toplev.c b/gcc/toplev.c index 559e6828990..03485bc8aed 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1709,7 +1709,7 @@ warn_deprecated_use (tree node) if (DECL_P (node)) warning ("`%s' is deprecated (declared at %s:%d)", IDENTIFIER_POINTER (DECL_NAME (node)), - TREE_FILENAME (node), TREE_LINENO (node)); + DECL_SOURCE_FILE (node), DECL_SOURCE_LINE (node)); else if (TYPE_P (node)) { const char *what = NULL; @@ -1725,13 +1725,13 @@ warn_deprecated_use (tree node) { if (decl) warning ("`%s' is deprecated (declared at %s:%d)", what, - TREE_FILENAME (decl), TREE_LINENO (decl)); + DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl)); else warning ("`%s' is deprecated", what); } else if (decl) warning ("type is deprecated (declared at %s:%d)", - TREE_FILENAME (decl), TREE_LINENO (decl)); + DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl)); else warning ("type is deprecated"); } diff --git a/gcc/tree-dump.c b/gcc/tree-dump.c index 296d19c992e..c3696336c44 100644 --- a/gcc/tree-dump.c +++ b/gcc/tree-dump.c @@ -321,18 +321,18 @@ dequeue_and_dump (dump_info_p di) queue_and_dump_type (di, t); dump_child ("scpe", DECL_CONTEXT (t)); /* And a source position. */ - if (TREE_FILENAME (t)) + if (DECL_SOURCE_FILE (t)) { - const char *filename = strrchr (TREE_FILENAME (t), '/'); + const char *filename = strrchr (DECL_SOURCE_FILE (t), '/'); if (!filename) - filename = TREE_FILENAME (t); + filename = DECL_SOURCE_FILE (t); else /* Skip the slash. */ ++filename; dump_maybe_newline (di); fprintf (di->stream, "srcp: %s:%-6d ", filename, - TREE_LINENO (t)); + DECL_SOURCE_LINE (t)); di->column += 6 + strlen (filename) + 8; } /* And any declaration can be compiler-generated. */ diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 13cb5bb19c1..e4e24b2b3b2 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -1322,7 +1322,7 @@ expand_call_inline (tree *tp, int *walk_subtrees, void *data) line numbers corresponding to the function we are calling. We wrap the whole inlined body in an EXPR_WITH_FILE_AND_LINE as well because individual statements don't record the filename. */ - push_srcloc (TREE_FILENAME (fn), TREE_LINENO (fn)); + push_srcloc (DECL_SOURCE_FILE (fn), DECL_SOURCE_LINE (fn)); #ifndef INLINER_FOR_JAVA /* Build a statement-expression containing code to initialize the @@ -1522,7 +1522,7 @@ expand_call_inline (tree *tp, int *walk_subtrees, void *data) #ifndef INLINER_FOR_JAVA chain = TREE_CHAIN (*tp); #endif /* INLINER_FOR_JAVA */ - *tp = build_expr_wfl (expr, TREE_FILENAME (fn), TREE_LINENO (fn), + *tp = build_expr_wfl (expr, DECL_SOURCE_FILE (fn), DECL_SOURCE_LINE (fn), /*col=*/0); EXPR_WFL_EMIT_LINE_NOTE (*tp) = 1; #ifndef INLINER_FOR_JAVA diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c index ab11f4d2ad3..e6049cb2b29 100644 --- a/gcc/tree-optimize.c +++ b/gcc/tree-optimize.c @@ -105,7 +105,7 @@ tree_rest_of_compilation (tree fndecl, bool nested_p) /* Initialize the RTL code for the function. */ current_function_decl = fndecl; saved_loc = input_location; - input_location = TREE_LOCUS (fndecl); + input_location = DECL_SOURCE_LOCATION (fndecl); init_function_start (fndecl); /* This function is being processed in whole-function mode. */ diff --git a/gcc/tree.c b/gcc/tree.c index ef720aea27b..b82a6bf6965 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -287,7 +287,7 @@ make_node (enum tree_code code) DECL_ALIGN (t) = 1; DECL_USER_ALIGN (t) = 0; DECL_IN_SYSTEM_HEADER (t) = in_system_header; - set_tree_locus (t, input_location); + DECL_SOURCE_LOCATION (t) = input_location; DECL_UID (t) = next_decl_uid++; /* We have not yet computed the alias set for this declaration. */ diff --git a/gcc/tree.def b/gcc/tree.def index f603f2455c0..4b6d236dde6 100644 --- a/gcc/tree.def +++ b/gcc/tree.def @@ -327,7 +327,7 @@ DEFTREECODE (STRING_CST, "string_cst", 'c', 0) built-in functions. Its value is an enum built_in_function that says which built-in function it is. - TREE_FILENAME holds a filename string and TREE_LINENO + DECL_SOURCE_FILE holds a filename string and DECL_SOURCE_LINE holds a line number. In some cases these can be the location of a reference, if no definition has been seen. diff --git a/gcc/tree.h b/gcc/tree.h index 2d879442a42..d742bc3d95b 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -802,29 +802,6 @@ struct tree_vec GTY(()) #define TREE_OPERAND(NODE, I) TREE_OPERAND_CHECK (NODE, I) #define TREE_COMPLEXITY(NODE) (EXPR_CHECK (NODE)->exp.complexity) -/* These macros access the location of a declaration. For 3.4, this is - only defined for DECLs, but for 3.5 it will be valid on EXPRs as well; - thus the name is not decl specific. The values accessed from the - uppercase macros are intentionally read-only. Use the setter functions - to write to this field. */ - -#define TREE_LOCUS(NODE) \ - (*(const location_t *)&DECL_CHECK (NODE)->decl.locus) -#define TREE_FILENAME(NODE) (TREE_LOCUS (NODE).file) -#define TREE_LINENO(NODE) (TREE_LOCUS (NODE).line) -#define TREE_LOCUS_SET_P(NODE) (TREE_LINENO (NODE) != 0) - -#define set_tree_locus(NODE, LOC) \ - ((void)(DECL_CHECK (NODE)->decl.locus = (LOC))) -#define copy_tree_locus(DEST, SRC) \ - ((void)(DECL_CHECK (DEST)->decl.locus = DECL_CHECK (SRC)->decl.locus)) -#define set_tree_file_line(NODE, FILE, LINE) \ - do { \ - location_t *l_ = &DECL_CHECK (NODE)->decl.locus; \ - l_->file = (FILE); \ - l_->line = (LINE); \ - } while (0) - /* In a LABELED_BLOCK_EXPR node. */ #define LABELED_BLOCK_LABEL(NODE) \ TREE_OPERAND_CHECK_CODE (NODE, LABELED_BLOCK_EXPR, 0) @@ -1332,6 +1309,13 @@ struct tree_type GTY(()) /* For a FIELD_DECL in a QUAL_UNION_TYPE, records the expression, which if nonzero, indicates that the field occupies the type. */ #define DECL_QUALIFIER(NODE) (FIELD_DECL_CHECK (NODE)->decl.initial) +/* These two fields describe where in the source code the declaration + was. If the declaration appears in several places (as for a C + function that is declared first and then defined later), this + information should refer to the definition. */ +#define DECL_SOURCE_LOCATION(NODE) (DECL_CHECK (NODE)->decl.locus) +#define DECL_SOURCE_FILE(NODE) (DECL_SOURCE_LOCATION (NODE).file) +#define DECL_SOURCE_LINE(NODE) (DECL_SOURCE_LOCATION (NODE).line) /* Holds the size of the datum, in bits, as a tree expression. Need not be constant. */ #define DECL_SIZE(NODE) (DECL_CHECK (NODE)->decl.size) diff --git a/gcc/treelang/ChangeLog b/gcc/treelang/ChangeLog index 75b9b2fefa2..3221ba8002a 100644 --- a/gcc/treelang/ChangeLog +++ b/gcc/treelang/ChangeLog @@ -1,5 +1,9 @@ 2003-09-21 Richard Henderson <rth@redhat.com> + * treetree.c: Revert. + +2003-09-21 Richard Henderson <rth@redhat.com> + * treetree.c: Update for DECL_SOURCE_LOCATION rename and change to const. diff --git a/gcc/treelang/treetree.c b/gcc/treelang/treetree.c index da92110b4b7..7697e3c49e5 100644 --- a/gcc/treelang/treetree.c +++ b/gcc/treelang/treetree.c @@ -313,9 +313,8 @@ tree_code_create_function_prototype (unsigned char* chars, id = get_identifier ((const char*)chars); fn_decl = build_decl (FUNCTION_DECL, id, fn_type); - /* Nested functions not supported here. */ - DECL_CONTEXT (fn_decl) = NULL_TREE; - set_tree_locus (fn_decl, loc); + DECL_CONTEXT (fn_decl) = NULL_TREE; /* Nested functions not supported here. */ + DECL_SOURCE_LOCATION (fn_decl) = loc; TREE_USED (fn_decl) = 1; @@ -388,14 +387,14 @@ tree_code_create_function_initial (tree prev_saved, current_function_decl = fn_decl; DECL_INITIAL (fn_decl) = error_mark_node; - set_tree_locus (fn_decl, loc); + DECL_SOURCE_LOCATION (fn_decl) = loc; /* Prepare creation of rtl for a new function. */ resultdecl = DECL_RESULT (fn_decl) = build_decl (RESULT_DECL, NULL_TREE, TREE_TYPE (TREE_TYPE (fn_decl))); DECL_CONTEXT (DECL_RESULT (fn_decl)) = fn_decl; - set_tree_locus (resultdecl, loc); + DECL_SOURCE_LOCATION (resultdecl) = loc; /* Work out the size. ??? is this needed. */ layout_decl (DECL_RESULT (fn_decl), 0); @@ -415,7 +414,7 @@ tree_code_create_function_initial (tree prev_saved, if (!fn_decl) abort (); DECL_CONTEXT (parm_decl) = fn_decl; - set_tree_locus (parm_decl, loc); + DECL_SOURCE_LOCATION (parm_decl) = loc; parm_list = chainon (parm_decl, parm_list); } @@ -583,7 +582,7 @@ tree_code_create_variable (unsigned int storage_class, DECL_CONTEXT (var_decl) = current_function_decl; - set_tree_locus (var_decl, loc); + DECL_SOURCE_LOCATION (var_decl) = loc; /* Set the storage mode and whether only visible in the same file. */ switch (storage_class) diff --git a/gcc/xcoffout.c b/gcc/xcoffout.c index 0999af941f4..7c03ca5b096 100644 --- a/gcc/xcoffout.c +++ b/gcc/xcoffout.c @@ -411,7 +411,7 @@ xcoffout_declare_function (FILE *file, tree decl, const char *name) /* Any pending .bi or .ei must occur before the .function pseudo op. Otherwise debuggers will think that the function is in the previous file and/or at the wrong line number. */ - xcoffout_source_file (file, TREE_FILENAME (decl), 0); + xcoffout_source_file (file, DECL_SOURCE_FILE (decl), 0); dbxout_symbol (decl, 0); /* .function NAME, TOP, MAPPING, TYPE, SIZE |