aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@gcc.gnu.org>2004-07-05 17:28:37 +0000
committerZack Weinberg <zack@gcc.gnu.org>2004-07-05 17:28:37 +0000
commit6de66680858ea8af546c6d74bd77f236e234607a (patch)
tree3123dea64dc9e9124841c660cee9869693ee9f00 /gcc/tree.c
parentab0e8f666d04db063342c726ea95a91401ec7545 (diff)
downloadgcc-6de66680858ea8af546c6d74bd77f236e234607a.zip
gcc-6de66680858ea8af546c6d74bd77f236e234607a.tar.gz
gcc-6de66680858ea8af546c6d74bd77f236e234607a.tar.bz2
langhooks.c: Don't include gt-langhooks.h.
* langhooks.c: Don't include gt-langhooks.h. (var_labelno): Delete. (lhd_set_decl_assembler_name): Do not append a distinguishing number to file-scope internal-linkage declarations for the first input file, even if they have DECL_CONTEXT set. Use DECL_UID of the declaration itself (if at block scope), or its containing TRANSLATION_UNIT_DECL (if at file scope) for the distinguishing number. * opts.c (cur_in_fname): New global. * opts.h: Declare it. * tree.c: Include opts.h. (make_node_stat): If creating a TRANSLATION_UNIT_DECL, give it DECL_UID equal to cur_in_fname. (copy_node_stat): Do not change DECL_UID when copying a TRANSLATION_UNIT_DECL. (build_common_tree_nodes): Adjust next_decl_uid to reserve the range 0 .. num_in_fnames-1 for TRANSLATION_UNIT_DECLs. * c-decl.c (c_static_assembler_name): Delete. * c-tree.h (c_static_assembler_name): Delete prototype. * c-lang.c, objc/objc-lang.c: Don't override LANG_HOOKS_SET_DECL_ASSEMBLER_NAME. * Makefile.in (tree.o): Update dependencies. (GTFILES): Remove langhooks.c. cp: * decl.c (cxx_init_decl_processing): Call build_common_tree_nodes before creating the global NAMESPACE_DECL. From-SVN: r84123
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index a4bbd66..9183a5c 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -48,6 +48,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "tree-iterator.h"
#include "basic-block.h"
#include "tree-flow.h"
+#include "opts.h"
/* obstack.[ch] explicitly declined to prototype this. */
extern int _obstack_allocated_p (struct obstack *h, void *obj);
@@ -309,7 +310,10 @@ make_node_stat (enum tree_code code MEM_STAT_DECL)
DECL_USER_ALIGN (t) = 0;
DECL_IN_SYSTEM_HEADER (t) = in_system_header;
DECL_SOURCE_LOCATION (t) = input_location;
- DECL_UID (t) = next_decl_uid++;
+ if (code == TRANSLATION_UNIT_DECL)
+ DECL_UID (t) = cur_in_fname;
+ else
+ DECL_UID (t) = next_decl_uid++;
/* We have not yet computed the alias set for this declaration. */
DECL_POINTER_ALIAS_SET (t) = -1;
@@ -382,7 +386,7 @@ copy_node_stat (tree node MEM_STAT_DECL)
TREE_VISITED (t) = 0;
t->common.ann = 0;
- if (TREE_CODE_CLASS (code) == 'd')
+ if (TREE_CODE_CLASS (code) == 'd' && code != TRANSLATION_UNIT_DECL)
DECL_UID (t) = next_decl_uid++;
else if (TREE_CODE_CLASS (code) == 't')
{
@@ -5310,6 +5314,14 @@ make_or_reuse_type (unsigned size, int unsignedp)
void
build_common_tree_nodes (int signed_char)
{
+ /* This function is called after command line parsing is complete,
+ but before any DECL nodes should have been created. Therefore,
+ now is the appropriate time to adjust next_decl_uid so that the
+ range 0 .. num_in_fnames-1 is reserved for TRANSLATION_UNIT_DECLs. */
+ if (next_decl_uid)
+ abort ();
+ next_decl_uid = num_in_fnames;
+
error_mark_node = make_node (ERROR_MARK);
TREE_TYPE (error_mark_node) = error_mark_node;