From 1717856ae12d13ae2407965ac044239e61026bd4 Mon Sep 17 00:00:00 2001
From: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Mon, 28 Jun 1999 00:13:17 +0000
Subject: [PATCH] 	* error.c (dump_type_real): Handle TREE_LIST again. 
 * typeck.c (comp_target_parms): Don't complain about 	converting from () to
 (...) if !flag_strict_prototype. 	* decl.c (grokdeclarator): Update the
 names of all variants when 	de-anonymizing.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@27792 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/cp/ChangeLog | 10 ++++++++++
 gcc/cp/decl.c    | 13 ++++++-------
 gcc/cp/error.c   |  5 +++++
 gcc/cp/typeck.c  |  9 +++++++--
 4 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index d7eeea4a2d71..ff7df31d9f4c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,13 @@
+1999-06-28  Jason Merrill  <jason@yorick.cygnus.com>
+
+	* error.c (dump_type_real): Handle TREE_LIST again.
+
+	* typeck.c (comp_target_parms): Don't complain about 
+	converting from () to (...) if !flag_strict_prototype.
+
+	* decl.c (grokdeclarator): Update the names of all variants when
+	de-anonymizing.
+
 1999-06-21  Mark Mitchell  <mark@codesourcery.com>
 
 	* init.c (expand_aggr_vbase_init): Rename to
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 0a4d5396bda5..9f98840aa9bd 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -11066,18 +11066,17 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
 	  && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
 	  && ANON_AGGRNAME_P (TYPE_IDENTIFIER (type)))
 	{
+	  tree oldname = TYPE_NAME (type);
+	  tree t;
+
 	  /* FIXME: This is bogus; we should not be doing this for
 	            cv-qualified types.  */
 
-	  /* For anonymous structs that are cv-qualified, need to use
-             TYPE_MAIN_VARIANT so that name will mangle correctly. As
-             type not referenced after this block, don't bother
-             resetting type to original type, ie. TREE_TYPE (decl). */
-	  type = TYPE_MAIN_VARIANT (type);
-
 	  /* Replace the anonymous name with the real name everywhere.  */
 	  lookup_tag_reverse (type, declarator);
-	  TYPE_NAME (type) = decl;
+	  for (t = TYPE_MAIN_VARIANT (type); t; t = TYPE_NEXT_VARIANT (t))
+	    if (TYPE_NAME (t) == oldname)
+	      TYPE_NAME (t) = decl;
 
 	  if (TYPE_LANG_SPECIFIC (type))
 	    TYPE_WAS_ANONYMOUS (type) = 1;
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index a79420ec7788..544e66e8e3b0 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -211,6 +211,11 @@ dump_type_real (t, v, canonical_name)
       OB_PUTS ("{unknown type}");
       break;
 
+    case TREE_LIST:
+      /* A list of function parms.  */
+      dump_parameters (t, 0, canonical_name);
+      break;
+
     case IDENTIFIER_NODE:
       OB_PUTID (t);
       break;
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index ead755d8371a..9e41af3f38d1 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -1357,8 +1357,13 @@ comp_target_parms (parms1, parms2, strict)
 
   if (t1 == 0 && t2 != 0)
     {
-      cp_pedwarn ("ANSI C++ prohibits conversion from `(%#T)' to `(...)'",
-		  parms2);
+      if (! flag_strict_prototype && t2 == void_list_node)
+	/* t1 might be the arglist of a function pointer in extern "C"
+	   declared to take (), which we fudged to (...).  Don't make the
+	   user pay for our mistake.  */;
+      else
+	cp_pedwarn ("ANSI C++ prohibits conversion from `%#T' to `(...)'",
+		    parms2);
       return self_promoting_args_p (t2);
     }
   if (t2 == 0)
-- 
GitLab