From 7c43cc0e6b09b119d0a26236152ad6eac9408d53 Mon Sep 17 00:00:00 2001 From: jason Date: Tue, 5 May 1998 01:27:06 +0000 Subject: [PATCH] * tree.def: Add NAMESPACE_DECL. * dwarfout.c (type_ok_for_scope): Ignore NAMESPACE_DECLs for now. * dwarf2out.c (push_decl_scope): Likewise. (scope_die_for): Likewise. * tree.c (decl_function_context): Use TREE_CODE_CLASS to determine how to get next context level. * cp-tree.def: Remove NAMESPACE_DECL. * cp/Makefile.in: Add .SUFFIXES. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@19539 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/Makefile.in | 4 ++++ gcc/cp/cp-tree.def | 3 --- gcc/dwarf2out.c | 8 +++++++- gcc/dwarfout.c | 3 +++ gcc/tree.c | 6 ++---- gcc/tree.def | 4 ++++ 7 files changed, 26 insertions(+), 8 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a1bf5c9abe9..772c621456f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +Tue May 5 01:25:03 1998 Jason Merrill + + * Makefile.in: Add .SUFFIXES. + + * cp-tree.def: Remove NAMESPACE_DECL. + Sun May 3 01:32:14 1998 Jason Merrill * call.c (build_over_call): Do evaluate arg even if it has empty diff --git a/gcc/cp/Makefile.in b/gcc/cp/Makefile.in index b4a56ccd84c..84d7a0c33ab 100644 --- a/gcc/cp/Makefile.in +++ b/gcc/cp/Makefile.in @@ -156,6 +156,10 @@ INCLUDES = -I. -I.. -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../config .c.o: $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< +# The only suffixes we want for implicit rules are .c and .o. +.SUFFIXES: +.SUFFIXES: .c .o + # This tells GNU make version 3 not to export all the variables # defined in this file into the environment. .NOEXPORT: diff --git a/gcc/cp/cp-tree.def b/gcc/cp/cp-tree.def index 0a42d74a67b..25c64bfe0b1 100644 --- a/gcc/cp/cp-tree.def +++ b/gcc/cp/cp-tree.def @@ -151,9 +151,6 @@ DEFTREECODE (TYPENAME_TYPE, "typename_type", 't', 0) Other kinds of thunks may be defined later. */ DEFTREECODE (THUNK_DECL, "thunk_decl", 'd', 0) -/* A namespace declaration. */ -DEFTREECODE (NAMESPACE_DECL, "namespace_decl", 'd', 0) - /* A using declaration. DECL_INITIAL contains the specified scope. This is not an alias, but is later expanded into multiple aliases. */ DEFTREECODE (USING_DECL, "using_decl", 'd', 0) diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 71f2ec07de0..e8ba8e3995b 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -7523,6 +7523,8 @@ push_decl_scope (scope) /* The normal case. */ if (decl_scope_depth == 0 || containing_scope == NULL_TREE + /* Ignore namespaces for the moment. */ + || TREE_CODE (containing_scope) == NAMESPACE_DECL || containing_scope == decl_scope_table[decl_scope_depth - 1].scope) decl_scope_table[decl_scope_depth].previous = decl_scope_depth - 1; else @@ -7541,7 +7543,7 @@ push_decl_scope (scope) decl_scope_depth++; } -/* Return the DIE for the scope the immediately contains this declaration. */ +/* Return the DIE for the scope that immediately contains this declaration. */ static dw_die_ref scope_die_for (t, context_die) @@ -7561,6 +7563,10 @@ scope_die_for (t, context_die) else containing_scope = DECL_CONTEXT (t); + /* Ignore namespaces for the moment. */ + if (containing_scope && TREE_CODE (containing_scope) == NAMESPACE_DECL) + containing_scope = NULL_TREE; + /* Function-local tags and functions get stuck in limbo until they are fixed up by decls_for_scope. */ if (context_die == NULL && containing_scope != NULL_TREE diff --git a/gcc/dwarfout.c b/gcc/dwarfout.c index 8e1f2067f52..edcf82241b8 100644 --- a/gcc/dwarfout.c +++ b/gcc/dwarfout.c @@ -4136,6 +4136,9 @@ type_ok_for_scope (type, scope) return is_tagged_type (type) ? (TYPE_CONTEXT (type) == scope + /* Ignore namespaces for the moment. */ + || (scope == NULL_TREE + && TREE_CODE (TYPE_CONTEXT (type)) == NAMESPACE_DECL) || (scope == NULL_TREE && is_tagged_type (TYPE_CONTEXT (type)) && TREE_ASM_WRITTEN (TYPE_CONTEXT (type)))) : (scope == NULL_TREE || ! is_tagged_type (scope)); diff --git a/gcc/tree.c b/gcc/tree.c index 20805d5cef3..ff608db5360 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4654,11 +4654,9 @@ decl_function_context (decl) while (context && TREE_CODE (context) != FUNCTION_DECL) { - if (TREE_CODE (context) == RECORD_TYPE - || TREE_CODE (context) == UNION_TYPE - || TREE_CODE (context) == QUAL_UNION_TYPE) + if (TREE_CODE_CLASS (TREE_CODE (context)) == 't') context = TYPE_CONTEXT (context); - else if (TREE_CODE (context) == TYPE_DECL) + else if (TREE_CODE_CLASS (TREE_CODE (context)) == 'd') context = DECL_CONTEXT (context); else if (TREE_CODE (context) == BLOCK) context = BLOCK_SUPERCONTEXT (context); diff --git a/gcc/tree.def b/gcc/tree.def index 292a7ea27f2..5e18393303b 100644 --- a/gcc/tree.def +++ b/gcc/tree.def @@ -331,6 +331,10 @@ DEFTREECODE (VAR_DECL, "var_decl", 'd', 0) DEFTREECODE (PARM_DECL, "parm_decl", 'd', 0) DEFTREECODE (RESULT_DECL, "result_decl", 'd', 0) DEFTREECODE (FIELD_DECL, "field_decl", 'd', 0) + +/* A namespace declaration. Namespaces appear in DECL_CONTEXT of other + _DECLs, providing a hierarchy of names. */ +DEFTREECODE (NAMESPACE_DECL, "namespace_decl", 'd', 0) /* References to storage. */ -- 2.11.0