This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PR 16171, take 2: Check for namespace of basic_*stream


Hi folks

This is the second try to fix PR 16171.

The patch uses the predefined std substitution check instead of directly
check the name. Also it adds some tests for the correct substitutions.

It is tested against mainline on powerpc64 and the test output don't
show differences.

Bastian

Index: gcc/cp/mangle.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/cp/mangle.c,v
retrieving revision 1.127
diff -u -r1.127 mangle.c
--- gcc/cp/mangle.c	25 Jun 2005 00:58:12 -0000	1.127
+++ gcc/cp/mangle.c	11 Sep 2005 12:54:15 -0000
@@ -606,20 +606,19 @@
 				       SUBID_CHAR_TRAITS))
 	{
 	  /* Got them.  Is this basic_istream?  */
-	  tree name = DECL_NAME (CLASSTYPE_TI_TEMPLATE (type));
-	  if (name == subst_identifiers[SUBID_BASIC_ISTREAM])
+	  if (is_std_substitution (decl, SUBID_BASIC_ISTREAM))
 	    {
 	      write_string ("Si");
 	      return 1;
 	    }
 	  /* Or basic_ostream?  */
-	  else if (name == subst_identifiers[SUBID_BASIC_OSTREAM])
+	  else if (is_std_substitution (decl, SUBID_BASIC_OSTREAM))
 	    {
 	      write_string ("So");
 	      return 1;
 	    }
 	  /* Or basic_iostream?  */
-	  else if (name == subst_identifiers[SUBID_BASIC_IOSTREAM])
+	  else if (is_std_substitution (decl, SUBID_BASIC_IOSTREAM))
 	    {
 	      write_string ("Sd");
 	      return 1;
Index: gcc/testsuite/g++.dg/abi/mangle26.C
===================================================================
RCS file: gcc/testsuite/g++.dg/abi/mangle26.C
diff -N gcc/testsuite/g++.dg/abi/mangle26.C
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gcc/testsuite/g++.dg/abi/mangle26.C	11 Sep 2005 12:54:15 -0000
@@ -0,0 +1,14 @@
+// Test of std mangeling
+
+// { dg-do compile }
+// { dg-options "-fno-inline" }
+
+namespace std {
+  struct A {
+    virtual void f () { }
+  };
+}
+
+std::A a;
+
+// { dg-final { scan-assembler "\n_?_ZNSt1AC1Ev\[: \t\n\]" } }
Index: gcc/testsuite/g++.dg/abi/mangle27.C
===================================================================
RCS file: gcc/testsuite/g++.dg/abi/mangle27.C
diff -N gcc/testsuite/g++.dg/abi/mangle27.C
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gcc/testsuite/g++.dg/abi/mangle27.C	11 Sep 2005 12:54:15 -0000
@@ -0,0 +1,14 @@
+// Test of std::basic_iostream<char, std::char_traits<char> > mangeling
+
+// { dg-do compile }
+// { dg-options "-fno-inline" }
+
+namespace std {
+  template<typename> struct char_traits;
+
+  template<typename, typename> struct basic_iostream { basic_iostream(){} };
+}
+
+std::basic_iostream<char,std::char_traits<char> > s1;
+
+// { dg-final { scan-assembler "\n_?_ZNSdC1Ev\[: \t\n\]" } }
Index: gcc/testsuite/g++.dg/abi/mangle28.C
===================================================================
RCS file: gcc/testsuite/g++.dg/abi/mangle28.C
diff -N gcc/testsuite/g++.dg/abi/mangle28.C
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gcc/testsuite/g++.dg/abi/mangle28.C	11 Sep 2005 12:54:15 -0000
@@ -0,0 +1,14 @@
+// Test of std::basic_istream<char, std::char_traits<char> > mangeling
+
+// { dg-do compile }
+// { dg-options "-fno-inline" }
+
+namespace std {
+  template<typename> struct char_traits;
+
+  template<typename, typename> struct basic_istream { basic_istream(){} };
+}
+
+std::basic_istream<char,std::char_traits<char> > s1;
+
+// { dg-final { scan-assembler "\n_?_ZNSiC1Ev\[: \t\n\]" } }
Index: gcc/testsuite/g++.dg/abi/mangle29.C
===================================================================
RCS file: gcc/testsuite/g++.dg/abi/mangle29.C
diff -N gcc/testsuite/g++.dg/abi/mangle29.C
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gcc/testsuite/g++.dg/abi/mangle29.C	11 Sep 2005 12:54:15 -0000
@@ -0,0 +1,14 @@
+// Test of std::basic_ostream<char, std::char_traits<char> > mangeling
+
+// { dg-do compile }
+// { dg-options "-fno-inline" }
+
+namespace std {
+  template<typename> struct char_traits;
+
+  template<typename, typename> struct basic_ostream { basic_ostream(){} };
+}
+
+std::basic_ostream<char,std::char_traits<char> > s1;
+
+// { dg-final { scan-assembler "\n_?_ZNSoC1Ev\[: \t\n\]" } }
-

-- 
There's a way out of any cage.
		-- Captain Christopher Pike, "The Menagerie" ("The Cage"),
		   stardate unknown.

Attachment: signature.asc
Description: Digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]