Blame SOURCES/gcc32-cxa_demangle-ambiguity.patch

6f1b0c
2005-02-13  Jason Merrill  <jason@redhat.com>
6f1b0c
6f1b0c
	* cp-demangle.c (__cxa_demangle): Change resolution of ambiguous
6f1b0c
	arguments.
6f1b0c
6f1b0c
2005-02-15  Jakub Jelinek  <jakub@redhat.com>
6f1b0c
6f1b0c
	PR libstdc++/19946
6f1b0c
	* testsuite/demangle/abi_examples/01.cc (main): Adjust for 2005-02-13
6f1b0c
	demangler change.
6f1b0c
	* testsuite/demangle/abi_examples/02.cc (main): Likewise.
6f1b0c
6f1b0c
--- libiberty/cp-demangle.c	24 Nov 2004 02:19:09 -0000	1.75
6f1b0c
+++ libiberty/cp-demangle.c	13 Feb 2005 06:58:20 -0000	1.76
6f1b0c
@@ -4047,21 +4047,6 @@ __cxa_demangle (mangled_name, output_buf
6f1b0c
       return NULL;
6f1b0c
     }
6f1b0c
 
6f1b0c
-  /* The specification for __cxa_demangle() is that if the mangled
6f1b0c
-     name could be either an extern "C" identifier, or an internal
6f1b0c
-     built-in type name, then we resolve it as the identifier.  All
6f1b0c
-     internal built-in type names are a single lower case character.
6f1b0c
-     Frankly, this simplistic disambiguation doesn't make sense to me,
6f1b0c
-     but it is documented, so we implement it here.  */
6f1b0c
-  if (IS_LOWER (mangled_name[0])
6f1b0c
-      && mangled_name[1] == '\0'
6f1b0c
-      && cplus_demangle_builtin_types[mangled_name[0] - 'a'].name != NULL)
6f1b0c
-    {
6f1b0c
-      if (status != NULL)
6f1b0c
-	*status = -2;
6f1b0c
-      return NULL;
6f1b0c
-    }
6f1b0c
-
6f1b0c
   demangled = d_demangle (mangled_name, DMGL_PARAMS | DMGL_TYPES, &alc;;
6f1b0c
 
6f1b0c
   if (demangled == NULL)
6f1b0c
--- libstdc++-v3/testsuite/demangle/abi_examples/01.cc.jj	2004-03-09 16:09:24.000000000 +0100
6f1b0c
+++ libstdc++-v3/testsuite/demangle/abi_examples/01.cc	2005-02-14 09:05:09.383834357 +0100
6f1b0c
@@ -1,6 +1,6 @@
6f1b0c
 // 2003-02-26 Benjamin Kosnik <bkoz@redhat.com>
6f1b0c
 
6f1b0c
-// Copyright (C) 2003 Free Software Foundation, Inc.
6f1b0c
+// Copyright (C) 2003, 2005 Free Software Foundation, Inc.
6f1b0c
 //
6f1b0c
 // This file is part of the GNU ISO C++ Library.  This library is free
6f1b0c
 // software; you can redistribute it and/or modify it under the
6f1b0c
@@ -31,7 +31,9 @@ int main()
6f1b0c
   // extern "C" function 
6f1b0c
   // extern "C" float f(void) { };
6f1b0c
   // T f
6f1b0c
-  verify_demangle("f", "error code = -2: invalid mangled name");
6f1b0c
+  // f is ambiguous between "C" external name and internal built-in type
6f1b0c
+  // name.  The ambiguity is resolved to the built-in type name.
6f1b0c
+  verify_demangle("f", "float");
6f1b0c
 
6f1b0c
   return 0;
6f1b0c
 }
6f1b0c
--- libstdc++-v3/testsuite/demangle/abi_examples/02.cc.jj	2004-03-09 16:09:24.000000000 +0100
6f1b0c
+++ libstdc++-v3/testsuite/demangle/abi_examples/02.cc	2005-02-14 09:05:59.661857808 +0100
6f1b0c
@@ -1,6 +1,6 @@
6f1b0c
 // 2003-02-26 Benjamin Kosnik <bkoz@redhat.com>
6f1b0c
 
6f1b0c
-// Copyright (C) 2003 Free Software Foundation, Inc.
6f1b0c
+// Copyright (C) 2003, 2005 Free Software Foundation, Inc.
6f1b0c
 //
6f1b0c
 // This file is part of the GNU ISO C++ Library.  This library is free
6f1b0c
 // software; you can redistribute it and/or modify it under the
6f1b0c
@@ -31,7 +31,9 @@ int main()
6f1b0c
   // or variable "f" 
6f1b0c
   // int f;
6f1b0c
   // B f
6f1b0c
-  verify_demangle("f", "error code = -2: invalid mangled name");
6f1b0c
+  // f is ambiguous between variable external name and internal built-in type
6f1b0c
+  // name.  The ambiguity is resolved to the built-in type name.
6f1b0c
+  verify_demangle("f", "float");
6f1b0c
 
6f1b0c
   return 0;
6f1b0c
 }