This is the first in a series of patches to get split-dwarf debug output
(AKA the Fission project: http://gcc.gnu.org/wiki/DebugFission)
contributed to the mainline.

Under certain circumstances, dwarf2out.c:dwarf_name calls into the front end's
decl pretty-printer to produce names for debug info. These are used in turn
by the linker and GDB to build .gdb_index, among other things. However, the
decl pretty-printer and the demangler use slightly different conventions for
certain constructs, which leads to various inconsistencies in the debug info.

This is the first of two patches to change the decl pretty printer to match
the demangler. It changes the testsuite's expected output to match what will
be produced by the changed pretty printer.

I submit it for review first so that the changes in output created by the second
patch are easy to see.

There are two significant changes. First, it switches the order between,
for example, "const char*" to "char const*".  Note that the front-end's
infrastructure does not record the source code's original order.

The other significant difference change involves switching the string
"{anonymous}" to "(anonymous namespace)".

Tested in conjunction with the second patch in this series by running
the testsuite and observing no regresssions other than those fixed by this
patch.

OK for mainline?

Sterling

2012-05-07   Sterling Augustine  <saugust...@google.com>

        * gcc/testsuite/g++.old-deja/g++.pt/memtemp77.C (int main):  Adjust
        expected output.
        * gcc/testsuite/g++.dg/ext/pretty3.C:  Likewise.
        * gcc/testsuite/g++.dg/diagnostic/bindings1.C:  Likewise.
        * gcc/testsuite/g++.dg/warn/Wuninitializable-member.C:  Likewise.
        * gcc/testsuite/g++.dg/warn/pr35711.C (int* foo):  Likewise.
        * gcc/testsuite/g++.dg/pr44486.C:  Likewise.

Index: gcc/testsuite/g++.old-deja/g++.pt/memtemp77.C
===================================================================
--- gcc/testsuite/g++.old-deja/g++.pt/memtemp77.C       (revision 187271)
+++ gcc/testsuite/g++.old-deja/g++.pt/memtemp77.C       (working copy)
@@ -19,7 +19,7 @@
 int main()
 {
   if (strcmp (S3<double>::h(7), 
-             "static const char* S3<T>::h(U) [with U = int; T = double]") == 0)
+             "static char const* S3<T>::h(U) [with U = int; T = double]") == 0)
     return 0;
   else 
     return 1;
Index: gcc/testsuite/g++.dg/ext/pretty3.C
===================================================================
--- gcc/testsuite/g++.dg/ext/pretty3.C  (revision 187271)
+++ gcc/testsuite/g++.dg/ext/pretty3.C  (working copy)
@@ -16,4 +16,4 @@
 {
   printf ("%s\n", D<int>().foo (0));
 }
-// { dg-final { scan-assembler "const char\\* D<U>::foo\\(typename B<U>::X\\)" 
} }
+// { dg-final { scan-assembler "char const\\* D<U>::foo\\(typename B<U>::X\\)" 
} }
Index: gcc/testsuite/g++.dg/diagnostic/bindings1.C
===================================================================
--- gcc/testsuite/g++.dg/diagnostic/bindings1.C (revision 187271)
+++ gcc/testsuite/g++.dg/diagnostic/bindings1.C (working copy)
@@ -10,7 +10,7 @@
 
 int main()
 {
-  if (strcmp (foo(x(), 3), "const char* foo(T, typename T::type) "
+  if (strcmp (foo(x(), 3), "char const* foo(T, typename T::type) "
              "[with T = x; typename T::type = int]") == 0)
     return 0;
   else 
Index: gcc/testsuite/g++.dg/warn/Wuninitializable-member.C
===================================================================
--- gcc/testsuite/g++.dg/warn/Wuninitializable-member.C (revision 187271)
+++ gcc/testsuite/g++.dg/warn/Wuninitializable-member.C (working copy)
@@ -8,7 +8,7 @@
 };
 
 class Y {
-  const int var;// { dg-warning "non-static const member 'const int Y::var' in 
class without a constructor" }
+  const int var;// { dg-warning "non-static const member 'int const Y::var' in 
class without a constructor" }
 public:
   int g(){ return 2*var; }
 };
Index: gcc/testsuite/g++.dg/warn/pr35711.C
===================================================================
--- gcc/testsuite/g++.dg/warn/pr35711.C (revision 187271)
+++ gcc/testsuite/g++.dg/warn/pr35711.C (working copy)
@@ -4,5 +4,5 @@
 
 int* foo (volatile int *p)
 {
-  return (int*)p; // { dg-warning "cast from type 'volatile int\\*' to type 
'int\\*' casts away qualifiers" }
+  return (int*)p; // { dg-warning "cast from type 'int volatile\\*' to type 
'int\\*' casts away qualifiers" }
 }
Index: gcc/testsuite/g++.dg/pr44486.C
===================================================================
--- gcc/testsuite/g++.dg/pr44486.C      (revision 187271)
+++ gcc/testsuite/g++.dg/pr44486.C      (working copy)
@@ -7,4 +7,4 @@
 
 int main() { f(); }
 
-// { dg-final { scan-assembler "S \{anonymous\}::f" } }
+// { dg-final { scan-assembler "S \\(anonymous namespace\\)::f" } }

--
This patch is available for review at http://codereview.appspot.com/6205043

Reply via email to