Patchwork PR c++/44486 missing space in __PRETTY_FUNCTION__ expansion in anonymous namespace

login
register
mail settings
Submitter Manuel López-Ibáñez
Date June 11, 2010, 9:52 a.m.
Message ID <AANLkTimjbMvR7JeGceCrPzEgXJvy5YXoF32uyhN9qx2o@mail.gmail.com>
Download mbox | patch
Permalink /patch/55306/
State New
Headers show

Comments

Manuel López-Ibáñez - June 11, 2010, 9:52 a.m.
bootstrapped and regression tested on x86_64-linux-gnu.

OK?

2010-06-11  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR c++/44486
cp/	
	* error.c (dump_decl): Better wording for anonymous namespace.
testsuite/	
	* g++.dg/pr44486.C: New.
Gabriel Dos Reis - June 17, 2010, 5:06 a.m.
Manuel López-Ibáñez <lopezibanez@gmail.com> writes:

| bootstrapped and regression tested on x86_64-linux-gnu.
| 
| OK?

OK, thanks!

-- Gaby

Patch

Index: gcc/testsuite/g++.dg/pr44486.C
===================================================================
--- gcc/testsuite/g++.dg/pr44486.C	(revision 0)
+++ gcc/testsuite/g++.dg/pr44486.C	(revision 0)
@@ -0,0 +1,10 @@ 
+// PR c++/44486 missing space in __PRETTY_FUNCTION__ expansion in anonymous namespace
+// { dg-do compile }
+// { dg-options "" }
+
+struct S { };
+namespace { S f() { const char * s = __PRETTY_FUNCTION__; return S(); } }
+
+int main() { f(); }
+
+// { dg-final { scan-assembler "S \{anonymous\}::f" } }
Index: gcc/cp/error.c
===================================================================
--- gcc/cp/error.c	(revision 160464)
+++ gcc/cp/error.c	(working copy)
@@ -944,11 +944,11 @@  dump_decl (tree t, int flags)
 	{
 	  if (! (flags & TFF_UNQUALIFIED_NAME))
 	    dump_scope (CP_DECL_CONTEXT (t), flags);
 	  flags &= ~TFF_UNQUALIFIED_NAME;
 	  if (DECL_NAME (t) == NULL_TREE)
-	    pp_string (cxx_pp, M_("<unnamed>"));
+	    pp_cxx_ws_string (cxx_pp, M_("{anonymous}"));
 	  else
 	    pp_cxx_tree_identifier (cxx_pp, DECL_NAME (t));
 	}
       break;