This is the second in the series of patches to make c decl pretty printing more closely match the demangler. A full explanation is here: http://gcc.gnu.org/ml/gcc-patches/2012-05/msg00512.html OK for mainline? Sterling 2012-05-07 Sterling Augustine <saugustine@google.com> * c-family/c-pretty-print.c (pp_c_specifier_qualifier_list): Move call to pp_c_type_qualifier_list from start to end of function. * cp/error.c (dump_decl): Change "{anonymous}" to "(anonymous namespace)" (lang_decl_name): Handle "(anonymous namespace)" correctly. Index: c-family/c-pretty-print.c =================================================================== --- c-family/c-pretty-print.c (revision 187271) +++ c-family/c-pretty-print.c (working copy) @@ -446,8 +446,6 @@ pp_c_specifier_qualifier_list (c_pretty_printer *p { const enum tree_code code = TREE_CODE (t); - if (TREE_CODE (t) != POINTER_TYPE) - pp_c_type_qualifier_list (pp, t); switch (code) { case REFERENCE_TYPE: @@ -494,6 +492,8 @@ pp_c_specifier_qualifier_list (c_pretty_printer *p pp_simple_type_specifier (pp, t); break; } + if (TREE_CODE (t) != POINTER_TYPE) + pp_c_type_qualifier_list (pp, t); } /* parameter-type-list: Index: cp/error.c =================================================================== --- cp/error.c (revision 187271) +++ cp/error.c (working copy) @@ -1028,7 +1028,7 @@ dump_decl (tree t, int flags) dump_scope (CP_DECL_CONTEXT (t), flags); flags &= ~TFF_UNQUALIFIED_NAME; if (DECL_NAME (t) == NULL_TREE) - pp_cxx_ws_string (cxx_pp, M_("{anonymous}")); + pp_cxx_ws_string (cxx_pp, M_("(anonymous namespace)")); else pp_cxx_tree_identifier (cxx_pp, DECL_NAME (t)); } @@ -2596,6 +2596,8 @@ lang_decl_name (tree decl, int v, bool translate) if (TREE_CODE (decl) == FUNCTION_DECL) dump_function_name (decl, TFF_PLAIN_IDENTIFIER); + else if (DECL_NAME (decl) == NULL && TREE_CODE (decl) == NAMESPACE_DECL) + pp_string (cxx_pp, M_("(anonymous namespace)")); else dump_decl (DECL_NAME (decl), TFF_PLAIN_IDENTIFIER); -- This patch is available for review at http://codereview.appspot.com/6195056