tree.def: Add NAMESPACE_DECL.
authorJason Merrill <jason@yorick.cygnus.com>
Tue, 5 May 1998 01:27:06 +0000 (01:27 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 5 May 1998 01:27:06 +0000 (21:27 -0400)
* 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.

From-SVN: r19539

gcc/cp/ChangeLog
gcc/cp/Makefile.in
gcc/cp/cp-tree.def
gcc/dwarf2out.c
gcc/dwarfout.c
gcc/tree.c
gcc/tree.def

index a1bf5c9abe98858fc2db0034bcf41b5e4a5a99a9..772c621456f5db2dd47709d5d93db83a5f8e92b2 100644 (file)
@@ -1,3 +1,9 @@
+Tue May  5 01:25:03 1998  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * Makefile.in: Add .SUFFIXES.
+
+       * cp-tree.def: Remove NAMESPACE_DECL.
+
 Sun May  3 01:32:14 1998  Jason Merrill  <jason@yorick.cygnus.com>
 
        * call.c (build_over_call): Do evaluate arg even if it has empty 
index b4a56ccd84c3b16639a7b2e91bbcd3d463ab4be6..84d7a0c33ab37e6c04c547e268cdf30a4c30efb9 100644 (file)
@@ -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:
index 0a42d74a67b80b100542b898884910440f90c4d0..25c64bfe0b1b7e9b217c5762e055e1848f036540 100644 (file)
@@ -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)
index 71f2ec07de0cababed4f1d367b8ed54030495ea8..e8ba8e3995bef663b49d958124d8c90f113c1273 100644 (file)
@@ -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
index 8e1f2067f523ce6bb8559d2492d1e6ab69f92e2e..edcf82241b81a222c29338129bb5a0c52de7755b 100644 (file)
@@ -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));
index 20805d5cef39bb6ed7e695b28f070656667f8cbb..ff608db5360a84a1323f4cb30908d206c144b8e2 100644 (file)
@@ -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);
index 292a7ea27f2e2047de1f137cf4e35e5c096851ef..5e18393303b10103250d3d9839a9b7b91ff46c39 100644 (file)
@@ -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)
 \f
 /* References to storage.  */