OSDN Git Service

* pt.c (do_decl_instantiation): Downgrade duplicate instantiation
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 9 Jul 1999 11:05:23 +0000 (11:05 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 9 Jul 1999 11:05:23 +0000 (11:05 +0000)
errors to pedwarn.
* typeck.c (comptypes): Simplify C code in look_hard.
* xref.c (PALLOC): Use xcalloc, not calloc.
(SALLOC): Use xmalloc, not malloc.
* rtti.c (synthesize_tinfo_fn): Add missing call to pop_momentary.
* search.c (note_debug_info_needed): Don't search if WRITE_SYMBOLS
is NO_DEBUG.
* decl.c (duplicate_decls): If a redeclaration doesn't match the
initial declaration, then don't save the inline info and by all
means don't mark the function as a builtin function.
* decl.c (lookup_name_real): Set NONCLASS to 1 if
CURRENT_CLASS_TYPE is 0.
* class.c (duplicate_tag_error): Set TYPE_NONCOPIED_PARTS to
NULL_TREE.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@28044 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/cp/decl.c
gcc/cp/init.c
gcc/cp/pt.c
gcc/cp/ptree.c
gcc/cp/rtti.c
gcc/cp/search.c
gcc/cp/typeck.c
gcc/cp/xref.c

index 50c3858..442e853 100644 (file)
@@ -1,3 +1,30 @@
+1999-07-09  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * pt.c (do_decl_instantiation): Downgrade duplicate instantiation
+       errors to pedwarn.
+
+1999-07-09  Michael Tiemann  <tiemann@happy.cygnus.com>
+
+       * typeck.c (comptypes): Simplify C code in look_hard.
+
+       * xref.c (PALLOC): Use xcalloc, not calloc.
+       (SALLOC): Use xmalloc, not malloc.
+
+       * rtti.c (synthesize_tinfo_fn): Add missing call to pop_momentary.
+
+       * search.c (note_debug_info_needed): Don't search if WRITE_SYMBOLS
+       is NO_DEBUG.
+
+       * decl.c (duplicate_decls): If a redeclaration doesn't match the
+       initial declaration, then don't save the inline info and by all
+       means don't mark the function as a builtin function.
+
+       * decl.c (lookup_name_real): Set NONCLASS to 1 if 
+       CURRENT_CLASS_TYPE is 0.
+
+       * class.c (duplicate_tag_error): Set TYPE_NONCOPIED_PARTS to
+       NULL_TREE.
+
 Wed Jul  7 01:26:47 1999  Alexandre Oliva  <oliva@dcc.unicamp.br>
 
        * decl2.c (mark_vtable_entries): Fix check for rtti offset.
index a04d2a0..4fcb2fd 100644 (file)
@@ -2146,6 +2146,7 @@ duplicate_tag_error (t)
   TYPE_METHODS (t) = NULL_TREE;
   TYPE_VFIELD (t) = NULL_TREE;
   TYPE_CONTEXT (t) = NULL_TREE;
+  TYPE_NONCOPIED_PARTS (t) = NULL_TREE;
 }
 
 /* finish up all new vtables.  */
@@ -4186,7 +4187,7 @@ finish_struct (t, attributes, warn_anon)
     {
       finish_struct_methods (t);
       TYPE_SIZE (t) = integer_zero_node;
-    }      
+    }
   else
     finish_struct_1 (t, warn_anon);
 
index cad878a..597a2ea 100644 (file)
@@ -3698,7 +3698,9 @@ duplicate_decls (newdecl, olddecl)
        }
       if (! types_match || new_defines_function)
        {
-         /* These need to be copied so that the names are available.  */
+         /* These need to be copied so that the names are available.
+            Note that if the types do match, we'll preserve inline
+            info and other bits, but if not, we won't.  */
          DECL_ARGUMENTS (olddecl) = DECL_ARGUMENTS (newdecl);
          DECL_RESULT (olddecl) = DECL_RESULT (newdecl);
        }
@@ -3706,7 +3708,7 @@ duplicate_decls (newdecl, olddecl)
        /* If defining a function declared with other language
           linkage, use the previously declared language linkage.  */
        DECL_LANGUAGE (newdecl) = DECL_LANGUAGE (olddecl);
-      else
+      else if (types_match)
        {
          /* If redeclaring a builtin function, and not a definition,
             it stays built in.  */
@@ -5858,6 +5860,10 @@ lookup_name_real (name, prefer_type, nonclass, namespaces_only)
     }
 
   /* First, look in non-namespace scopes.  */
+
+  if (current_class_type == NULL_TREE)
+    nonclass = 1;
+
   for (t = IDENTIFIER_BINDING (name); t; t = TREE_CHAIN (t))
     {
       tree binding;
index cba2842..de3491a 100644 (file)
@@ -696,7 +696,8 @@ emit_base_init (t, immediately)
 }
 
 /* Check that all fields are properly initialized after
-   an assignment to `this'.  */
+   an assignment to `this'.  Called only when such an assignment
+   is actually noted.  */
 
 void
 check_base_init (t)
index 712ad6c..d591c46 100644 (file)
@@ -8952,8 +8952,8 @@ do_decl_instantiation (declspecs, declarator, storage)
 
         No program shall both explicitly instantiate and explicitly
         specialize a template.  */
-      cp_error ("explicit instantiation of `%#D' after", result);
-      cp_error_at ("explicit specialization here", result);
+      cp_pedwarn ("explicit instantiation of `%#D' after", result);
+      cp_pedwarn_at ("explicit specialization here", result);
       return;
     }
   else if (DECL_EXPLICIT_INSTANTIATION (result))
@@ -8967,7 +8967,7 @@ do_decl_instantiation (declspecs, declarator, storage)
         first instantiation was `extern' and the second is not, and
         EXTERN_P for the opposite case.  */
       if (DECL_INTERFACE_KNOWN (result) && !extern_p)
-       cp_error ("duplicate explicit instantiation of `%#D'", result);
+       cp_pedwarn ("duplicate explicit instantiation of `%#D'", result);
 
       /* If we've already instantiated the template, just return now.  */
       if (DECL_INTERFACE_KNOWN (result))
index 502c1f0..4008e39 100644 (file)
@@ -128,6 +128,8 @@ print_lang_type (file, node, indent)
        fprintf (file, " interface-only");
       if (CLASSTYPE_INTERFACE_UNKNOWN (node))
        fprintf (file, " interface-unknown");
+      if (CLASSTYPE_VTABLE_NEEDS_WRITING (node))
+       fprintf (file, " vtable-needs-writing");
       print_node (file, "member-functions", CLASSTYPE_METHOD_VEC (node),
                  indent + 4);
     }
index e0ce5cd..4dec4cb 100644 (file)
@@ -1178,5 +1178,6 @@ synthesize_tinfo_fn (fndecl)
   tmp = cp_convert (build_pointer_type (type_info_type_node), addr);
   tmp = build_indirect_ref (tmp, 0);
   c_expand_return (tmp);
+  pop_momentary ();
   finish_function (lineno, 0, 0);
 }
index 75a1ac2..f2e9aa7 100644 (file)
@@ -2799,7 +2799,8 @@ note_debug_info_needed (type)
      could, but that would mean putting global labels in the debug output
      before each exported type and each of its functions and static data
      members.  */
-  if (write_symbols == DWARF_DEBUG || write_symbols == DWARF2_DEBUG)
+  if (write_symbols == DWARF_DEBUG || write_symbols == DWARF2_DEBUG
+      || write_symbols == NO_DEBUG)
     return;
 
   dfs_walk (TYPE_BINFO (type), dfs_debug_mark, dfs_debug_unmarkedp, 0);
index 8829d9d..fa54e37 100644 (file)
@@ -906,15 +906,9 @@ comptypes (type1, type2, strict)
                                  TYPE_TI_ARGS (t2));
     look_hard:
       if ((strict & COMPARE_BASE) && DERIVED_FROM_P (t1, t2))
-       {
-         val = 1;
-         break;
-       }
-      if ((strict & COMPARE_RELAXED) && DERIVED_FROM_P (t2, t1))
-       {
-         val = 1;
-         break;
-       }
+       val = 1;
+      else if ((strict & COMPARE_RELAXED) && DERIVED_FROM_P (t2, t1))
+       val = 1;
       break;
 
     case OFFSET_TYPE:
index 6e06eda..003910c 100644 (file)
@@ -58,13 +58,13 @@ int flag_gnu_xref;
 #define FALSE 0
 #endif
 
-#define PALLOC(typ) ((typ *) calloc(1,sizeof(typ)))
+#define PALLOC(typ) ((typ *) xcalloc(1,sizeof(typ)))
 
 
 /* Return a malloc'd copy of STR.  */
 #define SALLOC(str) \
  ((char *) ((str) == NULL ? NULL       \
-           : (char *) strcpy ((char *) malloc (strlen ((str)) + 1), (str))))
+           : (char *) strcpy ((char *) xmalloc (strlen ((str)) + 1), (str))))
 #define SFREE(str) (str != NULL && (free(str),0))
 
 #define STREQL(s1,s2) (strcmp((s1),(s2)) == 0)