Commit b02cec6e by Joseph Myers Committed by Joseph Myers

c-objc-common.c (c_tree_printer): Print identifiers with pp_identifier, not pp_string.

	* c-objc-common.c (c_tree_printer): Print identifiers with
	pp_identifier, not pp_string.  Mark "({anonymous})" for
	translation.
	* c-pretty-print.c (pp_c_ws_string): New.
	(pp_c_cv_qualifier, pp_c_type_specifier,
	pp_c_specifier_qualifier_list, pp_c_parameter_type_list,
	pp_c_storage_class_specifier, pp_c_function_specifier,
	pp_c_attributes, pp_c_bool_constant, pp_c_constant,
	pp_c_primary_expression, pp_c_postfix_expression,
	pp_c_unary_expression, pp_c_shift_expression,
	pp_c_relational_expression, pp_c_equality_expression,
	pp_c_logical_and_expression, pp_c_logical_or_expression): Mostly
	use pp_string and pp_c_ws_string in place of pp_identifier and
	pp_c_identifier for non-identifiers.  Mark English strings for
	translation.
	* c-pretty-print.h (pp_c_ws_string): Declare.

cp:
	* cxx-pretty-print.c (is_destructor_name, pp_cxx_unqualified_id,
	pp_cxx_template_keyword_if_needed, pp_cxx_postfix_expression,
	pp_cxx_new_expression, pp_cxx_delete_expression,
	pp_cxx_unary_expression, pp_cxx_assignment_operator,
	pp_cxx_assignment_expression, pp_cxx_expression,
	pp_cxx_function_specifier, pp_cxx_decl_specifier_seq,
	pp_cxx_simple_type_specifier, pp_cxx_type_specifier_seq,
	pp_cxx_exception_specification, pp_cxx_direct_declarator,
	pp_cxx_ctor_initializer, pp_cxx_type_id, pp_cxx_statement,
	pp_cxx_namespace_alias_definition, pp_cxx_template_parameter,
	pp_cxx_canonical_template_parameter, pp_cxx_template_declaration,
	pp_cxx_declaration, pp_cxx_typeid_expression,
	pp_cxx_va_arg_expression, pp_cxx_offsetof_expression,
	pp_cxx_trait_expression): Mostly use pp_string and
	pp_cxx_ws_string in place of pp_identifier and pp_cxx_identifier
	for non-identifiers.  Mark English strings for translation.
	* cxx-pretty-print.h (pp_cxx_ws_string): Define.
	* error.c (dump_template_parameter, dump_template_bindings,
	dump_type, dump_aggr_type, dump_type_prefix, dump_simple_decl,
	dump_decl, dump_template_decl, dump_function_decl,
	dump_parameters, dump_exception_spec, dump_template_parms,
	dump_expr, dump_binary_op, dump_unary_op, op_to_string,
	assop_to_string, args_to_string, cp_print_error_function,
	print_instantiation_full_context,
	print_instantiation_partial_context): Mostly use pp_string and
	pp_cxx_ws_string in place of pp_identifier and pp_cxx_identifier
	for non-identifiers.  Mark English strings for translation.
	(dump_global_iord): Mark strings for translation; use longer
	strings instead of substituting single words.
	(function_category): Return a format string marked for
	translation, not a single word or phrase to substitute in a longer
	phrase.

From-SVN: r147033
parent 3b0249cb
2009-05-01 Joseph Myers <joseph@codesourcery.com>
* c-objc-common.c (c_tree_printer): Print identifiers with
pp_identifier, not pp_string. Mark "({anonymous})" for
translation.
* c-pretty-print.c (pp_c_ws_string): New.
(pp_c_cv_qualifier, pp_c_type_specifier,
pp_c_specifier_qualifier_list, pp_c_parameter_type_list,
pp_c_storage_class_specifier, pp_c_function_specifier,
pp_c_attributes, pp_c_bool_constant, pp_c_constant,
pp_c_primary_expression, pp_c_postfix_expression,
pp_c_unary_expression, pp_c_shift_expression,
pp_c_relational_expression, pp_c_equality_expression,
pp_c_logical_and_expression, pp_c_logical_or_expression): Mostly
use pp_string and pp_c_ws_string in place of pp_identifier and
pp_c_identifier for non-identifiers. Mark English strings for
translation.
* c-pretty-print.h (pp_c_ws_string): Declare.
2009-04-30 Paul Pluzhnikov <ppluzhnikov@google.com> 2009-04-30 Paul Pluzhnikov <ppluzhnikov@google.com>
Roland McGrath <roland@redhat.com> Roland McGrath <roland@redhat.com>
......
/* Some code common to C and ObjC front ends. /* Some code common to C and ObjC front ends.
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007,
2009 Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
...@@ -26,6 +27,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -26,6 +27,7 @@ along with GCC; see the file COPYING3. If not see
#include "insn-config.h" #include "insn-config.h"
#include "integrate.h" #include "integrate.h"
#include "c-tree.h" #include "c-tree.h"
#include "intl.h"
#include "c-pretty-print.h" #include "c-pretty-print.h"
#include "function.h" #include "function.h"
#include "flags.h" #include "flags.h"
...@@ -98,7 +100,6 @@ c_tree_printer (pretty_printer *pp, text_info *text, const char *spec, ...@@ -98,7 +100,6 @@ c_tree_printer (pretty_printer *pp, text_info *text, const char *spec,
{ {
tree t = va_arg (*text->args_ptr, tree); tree t = va_arg (*text->args_ptr, tree);
tree name; tree name;
const char *n = "({anonymous})";
c_pretty_printer *cpp = (c_pretty_printer *) pp; c_pretty_printer *cpp = (c_pretty_printer *) pp;
pp->padding = pp_none; pp->padding = pp_none;
...@@ -124,7 +125,10 @@ c_tree_printer (pretty_printer *pp, text_info *text, const char *spec, ...@@ -124,7 +125,10 @@ c_tree_printer (pretty_printer *pp, text_info *text, const char *spec,
case 'F': case 'F':
if (DECL_NAME (t)) if (DECL_NAME (t))
n = lang_hooks.decl_printable_name (t, 2); {
pp_identifier (cpp, lang_hooks.decl_printable_name (t, 2));
return true;
}
break; break;
case 'T': case 'T':
...@@ -134,7 +138,7 @@ c_tree_printer (pretty_printer *pp, text_info *text, const char *spec, ...@@ -134,7 +138,7 @@ c_tree_printer (pretty_printer *pp, text_info *text, const char *spec,
if (name && TREE_CODE (name) == TYPE_DECL) if (name && TREE_CODE (name) == TYPE_DECL)
{ {
if (DECL_NAME (name)) if (DECL_NAME (name))
pp_string (cpp, lang_hooks.decl_printable_name (name, 2)); pp_identifier (cpp, lang_hooks.decl_printable_name (name, 2));
else else
pp_type_id (cpp, t); pp_type_id (cpp, t);
return true; return true;
...@@ -148,19 +152,16 @@ c_tree_printer (pretty_printer *pp, text_info *text, const char *spec, ...@@ -148,19 +152,16 @@ c_tree_printer (pretty_printer *pp, text_info *text, const char *spec,
case 'E': case 'E':
if (TREE_CODE (t) == IDENTIFIER_NODE) if (TREE_CODE (t) == IDENTIFIER_NODE)
n = IDENTIFIER_POINTER (t); pp_identifier (cpp, IDENTIFIER_POINTER (t));
else else
{ pp_expression (cpp, t);
pp_expression (cpp, t); return true;
return true;
}
break;
default: default:
return false; return false;
} }
pp_string (cpp, n); pp_string (cpp, _("({anonymous})"));
return true; return true;
} }
......
...@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h" #include "tm.h"
#include "real.h" #include "real.h"
#include "fixed-value.h" #include "fixed-value.h"
#include "intl.h"
#include "c-pretty-print.h" #include "c-pretty-print.h"
#include "c-tree.h" #include "c-tree.h"
#include "tree-iterator.h" #include "tree-iterator.h"
...@@ -177,7 +178,7 @@ pp_c_cv_qualifier (c_pretty_printer *pp, const char *cv) ...@@ -177,7 +178,7 @@ pp_c_cv_qualifier (c_pretty_printer *pp, const char *cv)
logic in the C++ pretty-printer. */ logic in the C++ pretty-printer. */
if (p != NULL && (*p == '*' || *p == '&')) if (p != NULL && (*p == '*' || *p == '&'))
pp_c_whitespace (pp); pp_c_whitespace (pp);
pp_c_identifier (pp, cv); pp_c_ws_string (pp, cv);
} }
/* Pretty-print T using the type-cast notation '( type-name )'. */ /* Pretty-print T using the type-cast notation '( type-name )'. */
...@@ -306,7 +307,7 @@ pp_c_type_specifier (c_pretty_printer *pp, tree t) ...@@ -306,7 +307,7 @@ pp_c_type_specifier (c_pretty_printer *pp, tree t)
switch (code) switch (code)
{ {
case ERROR_MARK: case ERROR_MARK:
pp_c_identifier (pp, "<type-error>"); pp_c_ws_string (pp, _("<type-error>"));
break; break;
case IDENTIFIER_NODE: case IDENTIFIER_NODE:
...@@ -345,14 +346,14 @@ pp_c_type_specifier (c_pretty_printer *pp, tree t) ...@@ -345,14 +346,14 @@ pp_c_type_specifier (c_pretty_printer *pp, tree t)
{ {
case INTEGER_TYPE: case INTEGER_TYPE:
pp_string (pp, (TYPE_UNSIGNED (t) pp_string (pp, (TYPE_UNSIGNED (t)
? "<unnamed-unsigned:" ? _("<unnamed-unsigned:")
: "<unnamed-signed:")); : _("<unnamed-signed:")));
break; break;
case REAL_TYPE: case REAL_TYPE:
pp_string (pp, "<unnamed-float:"); pp_string (pp, _("<unnamed-float:"));
break; break;
case FIXED_POINT_TYPE: case FIXED_POINT_TYPE:
pp_string (pp, "<unnamed-fixed:"); pp_string (pp, _("<unnamed-fixed:"));
break; break;
default: default:
gcc_unreachable (); gcc_unreachable ();
...@@ -367,25 +368,25 @@ pp_c_type_specifier (c_pretty_printer *pp, tree t) ...@@ -367,25 +368,25 @@ pp_c_type_specifier (c_pretty_printer *pp, tree t)
if (DECL_NAME (t)) if (DECL_NAME (t))
pp_id_expression (pp, t); pp_id_expression (pp, t);
else else
pp_c_identifier (pp, "<typedef-error>"); pp_c_ws_string (pp, _("<typedef-error>"));
break; break;
case UNION_TYPE: case UNION_TYPE:
case RECORD_TYPE: case RECORD_TYPE:
case ENUMERAL_TYPE: case ENUMERAL_TYPE:
if (code == UNION_TYPE) if (code == UNION_TYPE)
pp_c_identifier (pp, "union"); pp_c_ws_string (pp, "union");
else if (code == RECORD_TYPE) else if (code == RECORD_TYPE)
pp_c_identifier (pp, "struct"); pp_c_ws_string (pp, "struct");
else if (code == ENUMERAL_TYPE) else if (code == ENUMERAL_TYPE)
pp_c_identifier (pp, "enum"); pp_c_ws_string (pp, "enum");
else else
pp_c_identifier (pp, "<tag-error>"); pp_c_ws_string (pp, _("<tag-error>"));
if (TYPE_NAME (t)) if (TYPE_NAME (t))
pp_id_expression (pp, TYPE_NAME (t)); pp_id_expression (pp, TYPE_NAME (t));
else else
pp_c_identifier (pp, "<anonymous>"); pp_c_ws_string (pp, _("<anonymous>"));
break; break;
default: default:
...@@ -441,9 +442,9 @@ pp_c_specifier_qualifier_list (c_pretty_printer *pp, tree t) ...@@ -441,9 +442,9 @@ pp_c_specifier_qualifier_list (c_pretty_printer *pp, tree t)
case COMPLEX_TYPE: case COMPLEX_TYPE:
pp_c_specifier_qualifier_list (pp, TREE_TYPE (t)); pp_c_specifier_qualifier_list (pp, TREE_TYPE (t));
if (code == COMPLEX_TYPE) if (code == COMPLEX_TYPE)
pp_c_identifier (pp, flag_isoc99 ? "_Complex" : "__complex__"); pp_c_ws_string (pp, flag_isoc99 ? "_Complex" : "__complex__");
else if (code == VECTOR_TYPE) else if (code == VECTOR_TYPE)
pp_c_identifier (pp, "__vector__"); pp_c_ws_string (pp, "__vector__");
break; break;
default: default:
...@@ -471,7 +472,7 @@ pp_c_parameter_type_list (c_pretty_printer *pp, tree t) ...@@ -471,7 +472,7 @@ pp_c_parameter_type_list (c_pretty_printer *pp, tree t)
tree parms = want_parm_decl ? DECL_ARGUMENTS (t) : TYPE_ARG_TYPES (t); tree parms = want_parm_decl ? DECL_ARGUMENTS (t) : TYPE_ARG_TYPES (t);
pp_c_left_paren (pp); pp_c_left_paren (pp);
if (parms == void_list_node) if (parms == void_list_node)
pp_c_identifier (pp, "void"); pp_c_ws_string (pp, "void");
else else
{ {
bool first = true; bool first = true;
...@@ -587,13 +588,13 @@ void ...@@ -587,13 +588,13 @@ void
pp_c_storage_class_specifier (c_pretty_printer *pp, tree t) pp_c_storage_class_specifier (c_pretty_printer *pp, tree t)
{ {
if (TREE_CODE (t) == TYPE_DECL) if (TREE_CODE (t) == TYPE_DECL)
pp_c_identifier (pp, "typedef"); pp_c_ws_string (pp, "typedef");
else if (DECL_P (t)) else if (DECL_P (t))
{ {
if (DECL_REGISTER (t)) if (DECL_REGISTER (t))
pp_c_identifier (pp, "register"); pp_c_ws_string (pp, "register");
else if (TREE_STATIC (t) && TREE_CODE (t) == VAR_DECL) else if (TREE_STATIC (t) && TREE_CODE (t) == VAR_DECL)
pp_c_identifier (pp, "static"); pp_c_ws_string (pp, "static");
} }
} }
...@@ -604,7 +605,7 @@ void ...@@ -604,7 +605,7 @@ void
pp_c_function_specifier (c_pretty_printer *pp, tree t) pp_c_function_specifier (c_pretty_printer *pp, tree t)
{ {
if (TREE_CODE (t) == FUNCTION_DECL && DECL_DECLARED_INLINE_P (t)) if (TREE_CODE (t) == FUNCTION_DECL && DECL_DECLARED_INLINE_P (t))
pp_c_identifier (pp, "inline"); pp_c_ws_string (pp, "inline");
} }
/* declaration-specifiers: /* declaration-specifiers:
...@@ -733,7 +734,7 @@ pp_c_attributes (c_pretty_printer *pp, tree attributes) ...@@ -733,7 +734,7 @@ pp_c_attributes (c_pretty_printer *pp, tree attributes)
if (attributes == NULL_TREE) if (attributes == NULL_TREE)
return; return;
pp_c_identifier (pp, "__attribute__"); pp_c_ws_string (pp, "__attribute__");
pp_c_left_paren (pp); pp_c_left_paren (pp);
pp_c_left_paren (pp); pp_c_left_paren (pp);
for (; attributes != NULL_TREE; attributes = TREE_CHAIN (attributes)) for (; attributes != NULL_TREE; attributes = TREE_CHAIN (attributes))
...@@ -869,18 +870,18 @@ pp_c_bool_constant (c_pretty_printer *pp, tree b) ...@@ -869,18 +870,18 @@ pp_c_bool_constant (c_pretty_printer *pp, tree b)
if (b == boolean_false_node) if (b == boolean_false_node)
{ {
if (c_dialect_cxx ()) if (c_dialect_cxx ())
pp_c_identifier (pp, "false"); pp_c_ws_string (pp, "false");
else if (flag_isoc99) else if (flag_isoc99)
pp_c_identifier (pp, "_False"); pp_c_ws_string (pp, "_False");
else else
pp_unsupported_tree (pp, b); pp_unsupported_tree (pp, b);
} }
else if (b == boolean_true_node) else if (b == boolean_true_node)
{ {
if (c_dialect_cxx ()) if (c_dialect_cxx ())
pp_c_identifier (pp, "true"); pp_c_ws_string (pp, "true");
else if (flag_isoc99) else if (flag_isoc99)
pp_c_identifier (pp, "_True"); pp_c_ws_string (pp, "_True");
else else
pp_unsupported_tree (pp, b); pp_unsupported_tree (pp, b);
} }
...@@ -1069,7 +1070,20 @@ pp_c_constant (c_pretty_printer *pp, tree e) ...@@ -1069,7 +1070,20 @@ pp_c_constant (c_pretty_printer *pp, tree e)
} }
} }
/* Pretty-print an IDENTIFIER_NODE, preceded by whitespace is necessary. */ /* Pretty-print a string such as an identifier, without changing its
encoding, preceded by whitespace is necessary. */
void
pp_c_ws_string (c_pretty_printer *pp, const char *str)
{
pp_c_maybe_whitespace (pp);
pp_string (pp, str);
pp_base (pp)->padding = pp_before;
}
/* Pretty-print an IDENTIFIER_NODE, which may contain UTF-8 sequences
that need converting to the locale encoding, preceded by whitespace
is necessary. */
void void
pp_c_identifier (c_pretty_printer *pp, const char *id) pp_c_identifier (c_pretty_printer *pp, const char *id)
...@@ -1105,11 +1119,11 @@ pp_c_primary_expression (c_pretty_printer *pp, tree e) ...@@ -1105,11 +1119,11 @@ pp_c_primary_expression (c_pretty_printer *pp, tree e)
break; break;
case ERROR_MARK: case ERROR_MARK:
pp_c_identifier (pp, "<erroneous-expression>"); pp_c_ws_string (pp, _("<erroneous-expression>"));
break; break;
case RESULT_DECL: case RESULT_DECL:
pp_c_identifier (pp, "<return-value>"); pp_c_ws_string (pp, _("<return-value>"));
break; break;
case INTEGER_CST: case INTEGER_CST:
...@@ -1120,7 +1134,7 @@ pp_c_primary_expression (c_pretty_printer *pp, tree e) ...@@ -1120,7 +1134,7 @@ pp_c_primary_expression (c_pretty_printer *pp, tree e)
break; break;
case TARGET_EXPR: case TARGET_EXPR:
pp_c_identifier (pp, "__builtin_memcpy"); pp_c_ws_string (pp, "__builtin_memcpy");
pp_c_left_paren (pp); pp_c_left_paren (pp);
pp_ampersand (pp); pp_ampersand (pp);
pp_primary_expression (pp, TREE_OPERAND (e, 0)); pp_primary_expression (pp, TREE_OPERAND (e, 0));
...@@ -1338,7 +1352,7 @@ pp_c_postfix_expression (c_pretty_printer *pp, tree e) ...@@ -1338,7 +1352,7 @@ pp_c_postfix_expression (c_pretty_printer *pp, tree e)
case POSTINCREMENT_EXPR: case POSTINCREMENT_EXPR:
case POSTDECREMENT_EXPR: case POSTDECREMENT_EXPR:
pp_postfix_expression (pp, TREE_OPERAND (e, 0)); pp_postfix_expression (pp, TREE_OPERAND (e, 0));
pp_identifier (pp, code == POSTINCREMENT_EXPR ? "++" : "--"); pp_string (pp, code == POSTINCREMENT_EXPR ? "++" : "--");
break; break;
case ARRAY_REF: case ARRAY_REF:
...@@ -1365,49 +1379,49 @@ pp_c_postfix_expression (c_pretty_printer *pp, tree e) ...@@ -1365,49 +1379,49 @@ pp_c_postfix_expression (c_pretty_printer *pp, tree e)
} }
case UNORDERED_EXPR: case UNORDERED_EXPR:
pp_c_identifier (pp, flag_isoc99 pp_c_ws_string (pp, flag_isoc99
? "isunordered" ? "isunordered"
: "__builtin_isunordered"); : "__builtin_isunordered");
goto two_args_fun; goto two_args_fun;
case ORDERED_EXPR: case ORDERED_EXPR:
pp_c_identifier (pp, flag_isoc99 pp_c_ws_string (pp, flag_isoc99
? "!isunordered" ? "!isunordered"
: "!__builtin_isunordered"); : "!__builtin_isunordered");
goto two_args_fun; goto two_args_fun;
case UNLT_EXPR: case UNLT_EXPR:
pp_c_identifier (pp, flag_isoc99 pp_c_ws_string (pp, flag_isoc99
? "!isgreaterequal" ? "!isgreaterequal"
: "!__builtin_isgreaterequal"); : "!__builtin_isgreaterequal");
goto two_args_fun; goto two_args_fun;
case UNLE_EXPR: case UNLE_EXPR:
pp_c_identifier (pp, flag_isoc99 pp_c_ws_string (pp, flag_isoc99
? "!isgreater" ? "!isgreater"
: "!__builtin_isgreater"); : "!__builtin_isgreater");
goto two_args_fun; goto two_args_fun;
case UNGT_EXPR: case UNGT_EXPR:
pp_c_identifier (pp, flag_isoc99 pp_c_ws_string (pp, flag_isoc99
? "!islessequal" ? "!islessequal"
: "!__builtin_islessequal"); : "!__builtin_islessequal");
goto two_args_fun; goto two_args_fun;
case UNGE_EXPR: case UNGE_EXPR:
pp_c_identifier (pp, flag_isoc99 pp_c_ws_string (pp, flag_isoc99
? "!isless" ? "!isless"
: "!__builtin_isless"); : "!__builtin_isless");
goto two_args_fun; goto two_args_fun;
case UNEQ_EXPR: case UNEQ_EXPR:
pp_c_identifier (pp, flag_isoc99 pp_c_ws_string (pp, flag_isoc99
? "!islessgreater" ? "!islessgreater"
: "!__builtin_islessgreater"); : "!__builtin_islessgreater");
goto two_args_fun; goto two_args_fun;
case LTGT_EXPR: case LTGT_EXPR:
pp_c_identifier (pp, flag_isoc99 pp_c_ws_string (pp, flag_isoc99
? "islessgreater" ? "islessgreater"
: "__builtin_islessgreater"); : "__builtin_islessgreater");
goto two_args_fun; goto two_args_fun;
...@@ -1421,7 +1435,7 @@ pp_c_postfix_expression (c_pretty_printer *pp, tree e) ...@@ -1421,7 +1435,7 @@ pp_c_postfix_expression (c_pretty_printer *pp, tree e)
break; break;
case ABS_EXPR: case ABS_EXPR:
pp_c_identifier (pp, "__builtin_abs"); pp_c_ws_string (pp, "__builtin_abs");
pp_c_left_paren (pp); pp_c_left_paren (pp);
pp_expression (pp, TREE_OPERAND (e, 0)); pp_expression (pp, TREE_OPERAND (e, 0));
pp_c_right_paren (pp); pp_c_right_paren (pp);
...@@ -1491,7 +1505,7 @@ pp_c_postfix_expression (c_pretty_printer *pp, tree e) ...@@ -1491,7 +1505,7 @@ pp_c_postfix_expression (c_pretty_printer *pp, tree e)
break; break;
case VA_ARG_EXPR: case VA_ARG_EXPR:
pp_c_identifier (pp, "__builtin_va_arg"); pp_c_ws_string (pp, "__builtin_va_arg");
pp_c_left_paren (pp); pp_c_left_paren (pp);
pp_assignment_expression (pp, TREE_OPERAND (e, 0)); pp_assignment_expression (pp, TREE_OPERAND (e, 0));
pp_separate_with (pp, ','); pp_separate_with (pp, ',');
...@@ -1580,7 +1594,7 @@ pp_c_unary_expression (c_pretty_printer *pp, tree e) ...@@ -1580,7 +1594,7 @@ pp_c_unary_expression (c_pretty_printer *pp, tree e)
{ {
case PREINCREMENT_EXPR: case PREINCREMENT_EXPR:
case PREDECREMENT_EXPR: case PREDECREMENT_EXPR:
pp_identifier (pp, code == PREINCREMENT_EXPR ? "++" : "--"); pp_string (pp, code == PREINCREMENT_EXPR ? "++" : "--");
pp_c_unary_expression (pp, TREE_OPERAND (e, 0)); pp_c_unary_expression (pp, TREE_OPERAND (e, 0));
break; break;
...@@ -1606,7 +1620,7 @@ pp_c_unary_expression (c_pretty_printer *pp, tree e) ...@@ -1606,7 +1620,7 @@ pp_c_unary_expression (c_pretty_printer *pp, tree e)
case REALPART_EXPR: case REALPART_EXPR:
case IMAGPART_EXPR: case IMAGPART_EXPR:
pp_c_identifier (pp, code == REALPART_EXPR ? "__real__" : "__imag__"); pp_c_ws_string (pp, code == REALPART_EXPR ? "__real__" : "__imag__");
pp_c_whitespace (pp); pp_c_whitespace (pp);
pp_unary_expression (pp, TREE_OPERAND (e, 0)); pp_unary_expression (pp, TREE_OPERAND (e, 0));
break; break;
...@@ -1717,7 +1731,7 @@ pp_c_shift_expression (c_pretty_printer *pp, tree e) ...@@ -1717,7 +1731,7 @@ pp_c_shift_expression (c_pretty_printer *pp, tree e)
case RSHIFT_EXPR: case RSHIFT_EXPR:
pp_c_shift_expression (pp, TREE_OPERAND (e, 0)); pp_c_shift_expression (pp, TREE_OPERAND (e, 0));
pp_c_whitespace (pp); pp_c_whitespace (pp);
pp_identifier (pp, code == LSHIFT_EXPR ? "<<" : ">>"); pp_string (pp, code == LSHIFT_EXPR ? "<<" : ">>");
pp_c_whitespace (pp); pp_c_whitespace (pp);
pp_c_additive_expression (pp, TREE_OPERAND (e, 1)); pp_c_additive_expression (pp, TREE_OPERAND (e, 1));
break; break;
...@@ -1751,9 +1765,9 @@ pp_c_relational_expression (c_pretty_printer *pp, tree e) ...@@ -1751,9 +1765,9 @@ pp_c_relational_expression (c_pretty_printer *pp, tree e)
else if (code == GT_EXPR) else if (code == GT_EXPR)
pp_greater (pp); pp_greater (pp);
else if (code == LE_EXPR) else if (code == LE_EXPR)
pp_identifier (pp, "<="); pp_string (pp, "<=");
else if (code == GE_EXPR) else if (code == GE_EXPR)
pp_identifier (pp, ">="); pp_string (pp, ">=");
pp_c_whitespace (pp); pp_c_whitespace (pp);
pp_c_shift_expression (pp, TREE_OPERAND (e, 1)); pp_c_shift_expression (pp, TREE_OPERAND (e, 1));
break; break;
...@@ -1779,7 +1793,7 @@ pp_c_equality_expression (c_pretty_printer *pp, tree e) ...@@ -1779,7 +1793,7 @@ pp_c_equality_expression (c_pretty_printer *pp, tree e)
case NE_EXPR: case NE_EXPR:
pp_c_equality_expression (pp, TREE_OPERAND (e, 0)); pp_c_equality_expression (pp, TREE_OPERAND (e, 0));
pp_c_whitespace (pp); pp_c_whitespace (pp);
pp_identifier (pp, code == EQ_EXPR ? "==" : "!="); pp_string (pp, code == EQ_EXPR ? "==" : "!=");
pp_c_whitespace (pp); pp_c_whitespace (pp);
pp_c_relational_expression (pp, TREE_OPERAND (e, 1)); pp_c_relational_expression (pp, TREE_OPERAND (e, 1));
break; break;
...@@ -1863,7 +1877,7 @@ pp_c_logical_and_expression (c_pretty_printer *pp, tree e) ...@@ -1863,7 +1877,7 @@ pp_c_logical_and_expression (c_pretty_printer *pp, tree e)
{ {
pp_c_logical_and_expression (pp, TREE_OPERAND (e, 0)); pp_c_logical_and_expression (pp, TREE_OPERAND (e, 0));
pp_c_whitespace (pp); pp_c_whitespace (pp);
pp_identifier (pp, "&&"); pp_string (pp, "&&");
pp_c_whitespace (pp); pp_c_whitespace (pp);
pp_c_inclusive_or_expression (pp, TREE_OPERAND (e, 1)); pp_c_inclusive_or_expression (pp, TREE_OPERAND (e, 1));
} }
...@@ -1883,7 +1897,7 @@ pp_c_logical_or_expression (c_pretty_printer *pp, tree e) ...@@ -1883,7 +1897,7 @@ pp_c_logical_or_expression (c_pretty_printer *pp, tree e)
{ {
pp_c_logical_or_expression (pp, TREE_OPERAND (e, 0)); pp_c_logical_or_expression (pp, TREE_OPERAND (e, 0));
pp_c_whitespace (pp); pp_c_whitespace (pp);
pp_identifier (pp, "||"); pp_string (pp, "||");
pp_c_whitespace (pp); pp_c_whitespace (pp);
pp_c_logical_and_expression (pp, TREE_OPERAND (e, 1)); pp_c_logical_and_expression (pp, TREE_OPERAND (e, 1));
} }
......
/* Various declarations for the C and C++ pretty-printers. /* Various declarations for the C and C++ pretty-printers.
Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc. Copyright (C) 2002, 2003, 2004, 2007, 2009 Free Software Foundation, Inc.
Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net> Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
This file is part of GCC. This file is part of GCC.
...@@ -203,6 +203,7 @@ void pp_c_primary_expression (c_pretty_printer *, tree); ...@@ -203,6 +203,7 @@ void pp_c_primary_expression (c_pretty_printer *, tree);
void pp_c_init_declarator (c_pretty_printer *, tree); void pp_c_init_declarator (c_pretty_printer *, tree);
void pp_c_constant (c_pretty_printer *, tree); void pp_c_constant (c_pretty_printer *, tree);
void pp_c_id_expression (c_pretty_printer *, tree); void pp_c_id_expression (c_pretty_printer *, tree);
void pp_c_ws_string (c_pretty_printer *, const char *);
void pp_c_identifier (c_pretty_printer *, const char *); void pp_c_identifier (c_pretty_printer *, const char *);
void pp_c_string_literal (c_pretty_printer *, tree); void pp_c_string_literal (c_pretty_printer *, tree);
......
2009-05-01 Joseph Myers <joseph@codesourcery.com>
* cxx-pretty-print.c (is_destructor_name, pp_cxx_unqualified_id,
pp_cxx_template_keyword_if_needed, pp_cxx_postfix_expression,
pp_cxx_new_expression, pp_cxx_delete_expression,
pp_cxx_unary_expression, pp_cxx_assignment_operator,
pp_cxx_assignment_expression, pp_cxx_expression,
pp_cxx_function_specifier, pp_cxx_decl_specifier_seq,
pp_cxx_simple_type_specifier, pp_cxx_type_specifier_seq,
pp_cxx_exception_specification, pp_cxx_direct_declarator,
pp_cxx_ctor_initializer, pp_cxx_type_id, pp_cxx_statement,
pp_cxx_namespace_alias_definition, pp_cxx_template_parameter,
pp_cxx_canonical_template_parameter, pp_cxx_template_declaration,
pp_cxx_declaration, pp_cxx_typeid_expression,
pp_cxx_va_arg_expression, pp_cxx_offsetof_expression,
pp_cxx_trait_expression): Mostly use pp_string and
pp_cxx_ws_string in place of pp_identifier and pp_cxx_identifier
for non-identifiers. Mark English strings for translation.
* cxx-pretty-print.h (pp_cxx_ws_string): Define.
* error.c (dump_template_parameter, dump_template_bindings,
dump_type, dump_aggr_type, dump_type_prefix, dump_simple_decl,
dump_decl, dump_template_decl, dump_function_decl,
dump_parameters, dump_exception_spec, dump_template_parms,
dump_expr, dump_binary_op, dump_unary_op, op_to_string,
assop_to_string, args_to_string, cp_print_error_function,
print_instantiation_full_context,
print_instantiation_partial_context): Mostly use pp_string and
pp_cxx_ws_string in place of pp_identifier and pp_cxx_identifier
for non-identifiers. Mark English strings for translation.
(dump_global_iord): Mark strings for translation; use longer
strings instead of substituting single words.
(function_category): Return a format string marked for
translation, not a single word or phrase to substitute in a longer
phrase.
2009-04-28 Ben Elliston <bje@au.ibm.com> 2009-04-28 Ben Elliston <bje@au.ibm.com>
PR c++/35652 PR c++/35652
......
/* Implementation of subroutines for the GNU C++ pretty-printer. /* Implementation of subroutines for the GNU C++ pretty-printer.
Copyright (C) 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc. Copyright (C) 2003, 2004, 2005, 2007, 2008,
2009 Free Software Foundation, Inc.
Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net> Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
This file is part of GCC. This file is part of GCC.
...@@ -23,6 +24,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -23,6 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h" #include "coretypes.h"
#include "tm.h" #include "tm.h"
#include "real.h" #include "real.h"
#include "intl.h"
#include "cxx-pretty-print.h" #include "cxx-pretty-print.h"
#include "cp-tree.h" #include "cp-tree.h"
#include "toplev.h" #include "toplev.h"
...@@ -116,7 +118,7 @@ is_destructor_name (tree name) ...@@ -116,7 +118,7 @@ is_destructor_name (tree name)
static inline void static inline void
pp_cxx_conversion_function_id (cxx_pretty_printer *pp, tree t) pp_cxx_conversion_function_id (cxx_pretty_printer *pp, tree t)
{ {
pp_cxx_identifier (pp, "operator"); pp_cxx_ws_string (pp, "operator");
pp_cxx_type_specifier_seq (pp, TREE_TYPE (t)); pp_cxx_type_specifier_seq (pp, TREE_TYPE (t));
} }
...@@ -145,7 +147,7 @@ pp_cxx_unqualified_id (cxx_pretty_printer *pp, tree t) ...@@ -145,7 +147,7 @@ pp_cxx_unqualified_id (cxx_pretty_printer *pp, tree t)
switch (code) switch (code)
{ {
case RESULT_DECL: case RESULT_DECL:
pp_cxx_identifier (pp, "<return-value>"); pp_cxx_ws_string (pp, _("<return-value>"));
break; break;
case OVERLOAD: case OVERLOAD:
...@@ -164,7 +166,7 @@ pp_cxx_unqualified_id (cxx_pretty_printer *pp, tree t) ...@@ -164,7 +166,7 @@ pp_cxx_unqualified_id (cxx_pretty_printer *pp, tree t)
case IDENTIFIER_NODE: case IDENTIFIER_NODE:
if (t == NULL) if (t == NULL)
pp_cxx_identifier (pp, "<unnamed>"); pp_cxx_ws_string (pp, _("<unnamed>"));
else if (IDENTIFIER_TYPENAME_P (t)) else if (IDENTIFIER_TYPENAME_P (t))
pp_cxx_conversion_function_id (pp, t); pp_cxx_conversion_function_id (pp, t);
else else
...@@ -237,7 +239,7 @@ pp_cxx_template_keyword_if_needed (cxx_pretty_printer *pp, tree scope, tree t) ...@@ -237,7 +239,7 @@ pp_cxx_template_keyword_if_needed (cxx_pretty_printer *pp, tree scope, tree t)
{ {
if (TREE_CODE (t) == TEMPLATE_ID_EXPR if (TREE_CODE (t) == TEMPLATE_ID_EXPR
&& TYPE_P (scope) && dependent_type_p (scope)) && TYPE_P (scope) && dependent_type_p (scope))
pp_cxx_identifier (pp, "template"); pp_cxx_ws_string (pp, "template");
} }
/* nested-name-specifier: /* nested-name-specifier:
...@@ -566,13 +568,13 @@ pp_cxx_postfix_expression (cxx_pretty_printer *pp, tree t) ...@@ -566,13 +568,13 @@ pp_cxx_postfix_expression (cxx_pretty_printer *pp, tree t)
case REINTERPRET_CAST_EXPR: case REINTERPRET_CAST_EXPR:
case CONST_CAST_EXPR: case CONST_CAST_EXPR:
if (code == DYNAMIC_CAST_EXPR) if (code == DYNAMIC_CAST_EXPR)
pp_cxx_identifier (pp, "dynamic_cast"); pp_cxx_ws_string (pp, "dynamic_cast");
else if (code == STATIC_CAST_EXPR) else if (code == STATIC_CAST_EXPR)
pp_cxx_identifier (pp, "static_cast"); pp_cxx_ws_string (pp, "static_cast");
else if (code == REINTERPRET_CAST_EXPR) else if (code == REINTERPRET_CAST_EXPR)
pp_cxx_identifier (pp, "reinterpret_cast"); pp_cxx_ws_string (pp, "reinterpret_cast");
else else
pp_cxx_identifier (pp, "const_cast"); pp_cxx_ws_string (pp, "const_cast");
pp_cxx_begin_template_argument_list (pp); pp_cxx_begin_template_argument_list (pp);
pp_cxx_type_id (pp, TREE_TYPE (t)); pp_cxx_type_id (pp, TREE_TYPE (t));
pp_cxx_end_template_argument_list (pp); pp_cxx_end_template_argument_list (pp);
...@@ -644,7 +646,7 @@ pp_cxx_new_expression (cxx_pretty_printer *pp, tree t) ...@@ -644,7 +646,7 @@ pp_cxx_new_expression (cxx_pretty_printer *pp, tree t)
case VEC_NEW_EXPR: case VEC_NEW_EXPR:
if (NEW_EXPR_USE_GLOBAL (t)) if (NEW_EXPR_USE_GLOBAL (t))
pp_cxx_colon_colon (pp); pp_cxx_colon_colon (pp);
pp_cxx_identifier (pp, "new"); pp_cxx_ws_string (pp, "new");
if (TREE_OPERAND (t, 0)) if (TREE_OPERAND (t, 0))
{ {
pp_cxx_call_argument_list (pp, TREE_OPERAND (t, 0)); pp_cxx_call_argument_list (pp, TREE_OPERAND (t, 0));
...@@ -689,7 +691,7 @@ pp_cxx_delete_expression (cxx_pretty_printer *pp, tree t) ...@@ -689,7 +691,7 @@ pp_cxx_delete_expression (cxx_pretty_printer *pp, tree t)
case VEC_DELETE_EXPR: case VEC_DELETE_EXPR:
if (DELETE_EXPR_USE_GLOBAL (t)) if (DELETE_EXPR_USE_GLOBAL (t))
pp_cxx_colon_colon (pp); pp_cxx_colon_colon (pp);
pp_cxx_identifier (pp, "delete"); pp_cxx_ws_string (pp, "delete");
pp_space (pp); pp_space (pp);
if (code == VEC_DELETE_EXPR if (code == VEC_DELETE_EXPR
|| DELETE_EXPR_USE_VEC (t)) || DELETE_EXPR_USE_VEC (t))
...@@ -743,8 +745,8 @@ pp_cxx_unary_expression (cxx_pretty_printer *pp, tree t) ...@@ -743,8 +745,8 @@ pp_cxx_unary_expression (cxx_pretty_printer *pp, tree t)
case SIZEOF_EXPR: case SIZEOF_EXPR:
if (PACK_EXPANSION_P (TREE_OPERAND (t, 0))) if (PACK_EXPANSION_P (TREE_OPERAND (t, 0)))
{ {
pp_cxx_identifier (pp, "sizeof"); pp_cxx_ws_string (pp, "sizeof");
pp_cxx_identifier (pp, "..."); pp_cxx_ws_string (pp, "...");
pp_cxx_whitespace (pp); pp_cxx_whitespace (pp);
pp_cxx_left_paren (pp); pp_cxx_left_paren (pp);
if (TYPE_P (TREE_OPERAND (t, 0))) if (TYPE_P (TREE_OPERAND (t, 0)))
...@@ -757,7 +759,7 @@ pp_cxx_unary_expression (cxx_pretty_printer *pp, tree t) ...@@ -757,7 +759,7 @@ pp_cxx_unary_expression (cxx_pretty_printer *pp, tree t)
/* Fall through */ /* Fall through */
case ALIGNOF_EXPR: case ALIGNOF_EXPR:
pp_cxx_identifier (pp, code == SIZEOF_EXPR ? "sizeof" : "__alignof__"); pp_cxx_ws_string (pp, code == SIZEOF_EXPR ? "sizeof" : "__alignof__");
pp_cxx_whitespace (pp); pp_cxx_whitespace (pp);
if (TYPE_P (TREE_OPERAND (t, 0))) if (TYPE_P (TREE_OPERAND (t, 0)))
{ {
...@@ -924,7 +926,7 @@ pp_cxx_assignment_operator (cxx_pretty_printer *pp, tree t) ...@@ -924,7 +926,7 @@ pp_cxx_assignment_operator (cxx_pretty_printer *pp, tree t)
break; break;
} }
pp_cxx_identifier (pp, op); pp_cxx_ws_string (pp, op);
} }
...@@ -954,7 +956,7 @@ pp_cxx_assignment_expression (cxx_pretty_printer *pp, tree e) ...@@ -954,7 +956,7 @@ pp_cxx_assignment_expression (cxx_pretty_printer *pp, tree e)
break; break;
case THROW_EXPR: case THROW_EXPR:
pp_cxx_identifier (pp, "throw"); pp_cxx_ws_string (pp, "throw");
if (TREE_OPERAND (e, 0)) if (TREE_OPERAND (e, 0))
pp_cxx_assignment_expression (pp, TREE_OPERAND (e, 0)); pp_cxx_assignment_expression (pp, TREE_OPERAND (e, 0));
break; break;
...@@ -1076,7 +1078,7 @@ pp_cxx_expression (cxx_pretty_printer *pp, tree t) ...@@ -1076,7 +1078,7 @@ pp_cxx_expression (cxx_pretty_printer *pp, tree t)
case EXPR_PACK_EXPANSION: case EXPR_PACK_EXPANSION:
pp_cxx_expression (pp, PACK_EXPANSION_PATTERN (t)); pp_cxx_expression (pp, PACK_EXPANSION_PATTERN (t));
pp_cxx_identifier (pp, "..."); pp_cxx_ws_string (pp, "...");
break; break;
case NONTYPE_ARGUMENT_PACK: case NONTYPE_ARGUMENT_PACK:
...@@ -1113,9 +1115,9 @@ pp_cxx_function_specifier (cxx_pretty_printer *pp, tree t) ...@@ -1113,9 +1115,9 @@ pp_cxx_function_specifier (cxx_pretty_printer *pp, tree t)
{ {
case FUNCTION_DECL: case FUNCTION_DECL:
if (DECL_VIRTUAL_P (t)) if (DECL_VIRTUAL_P (t))
pp_cxx_identifier (pp, "virtual"); pp_cxx_ws_string (pp, "virtual");
else if (DECL_CONSTRUCTOR_P (t) && DECL_NONCONVERTING_P (t)) else if (DECL_CONSTRUCTOR_P (t) && DECL_NONCONVERTING_P (t))
pp_cxx_identifier (pp, "explicit"); pp_cxx_ws_string (pp, "explicit");
else else
pp_c_function_specifier (pp_c_base (pp), t); pp_c_function_specifier (pp_c_base (pp), t);
...@@ -1148,7 +1150,7 @@ pp_cxx_decl_specifier_seq (cxx_pretty_printer *pp, tree t) ...@@ -1148,7 +1150,7 @@ pp_cxx_decl_specifier_seq (cxx_pretty_printer *pp, tree t)
break; break;
case TYPE_DECL: case TYPE_DECL:
pp_cxx_identifier (pp, "typedef"); pp_cxx_ws_string (pp, "typedef");
pp_cxx_decl_specifier_seq (pp, TREE_TYPE (t)); pp_cxx_decl_specifier_seq (pp, TREE_TYPE (t));
break; break;
...@@ -1209,7 +1211,7 @@ pp_cxx_simple_type_specifier (cxx_pretty_printer *pp, tree t) ...@@ -1209,7 +1211,7 @@ pp_cxx_simple_type_specifier (cxx_pretty_printer *pp, tree t)
break; break;
case TYPENAME_TYPE: case TYPENAME_TYPE:
pp_cxx_identifier (pp, "typename"); pp_cxx_ws_string (pp, "typename");
pp_cxx_nested_name_specifier (pp, TYPE_CONTEXT (t)); pp_cxx_nested_name_specifier (pp, TYPE_CONTEXT (t));
pp_cxx_unqualified_id (pp, TYPE_NAME (t)); pp_cxx_unqualified_id (pp, TYPE_NAME (t));
break; break;
...@@ -1251,7 +1253,7 @@ pp_cxx_type_specifier_seq (cxx_pretty_printer *pp, tree t) ...@@ -1251,7 +1253,7 @@ pp_cxx_type_specifier_seq (cxx_pretty_printer *pp, tree t)
break; break;
case DECLTYPE_TYPE: case DECLTYPE_TYPE:
pp_cxx_identifier (pp, "decltype"); pp_cxx_ws_string (pp, "decltype");
pp_cxx_left_paren (pp); pp_cxx_left_paren (pp);
pp_cxx_expression (pp, DECLTYPE_TYPE_EXPR (t)); pp_cxx_expression (pp, DECLTYPE_TYPE_EXPR (t));
pp_cxx_right_paren (pp); pp_cxx_right_paren (pp);
...@@ -1393,7 +1395,7 @@ pp_cxx_exception_specification (cxx_pretty_printer *pp, tree t) ...@@ -1393,7 +1395,7 @@ pp_cxx_exception_specification (cxx_pretty_printer *pp, tree t)
if (!TYPE_NOTHROW_P (t) && ex_spec == NULL) if (!TYPE_NOTHROW_P (t) && ex_spec == NULL)
return; return;
pp_cxx_identifier (pp, "throw"); pp_cxx_ws_string (pp, "throw");
pp_cxx_left_paren (pp); pp_cxx_left_paren (pp);
for (; ex_spec && TREE_VALUE (ex_spec); ex_spec = TREE_CHAIN (ex_spec)) for (; ex_spec && TREE_VALUE (ex_spec); ex_spec = TREE_CHAIN (ex_spec))
{ {
...@@ -1447,7 +1449,7 @@ pp_cxx_direct_declarator (cxx_pretty_printer *pp, tree t) ...@@ -1447,7 +1449,7 @@ pp_cxx_direct_declarator (cxx_pretty_printer *pp, tree t)
|| template_parameter_pack_p (t)) || template_parameter_pack_p (t))
/* A function parameter pack or non-type template /* A function parameter pack or non-type template
parameter pack. */ parameter pack. */
pp_cxx_identifier (pp, "..."); pp_cxx_ws_string (pp, "...");
pp_cxx_id_expression (pp, DECL_NAME (t)); pp_cxx_id_expression (pp, DECL_NAME (t));
} }
...@@ -1523,7 +1525,7 @@ pp_cxx_ctor_initializer (cxx_pretty_printer *pp, tree t) ...@@ -1523,7 +1525,7 @@ pp_cxx_ctor_initializer (cxx_pretty_printer *pp, tree t)
pp_cxx_primary_expression (pp, purpose); pp_cxx_primary_expression (pp, purpose);
pp_cxx_call_argument_list (pp, TREE_VALUE (t)); pp_cxx_call_argument_list (pp, TREE_VALUE (t));
if (is_pack) if (is_pack)
pp_cxx_identifier (pp, "..."); pp_cxx_ws_string (pp, "...");
if (TREE_CHAIN (t)) if (TREE_CHAIN (t))
pp_cxx_separate_with (pp, ','); pp_cxx_separate_with (pp, ',');
} }
...@@ -1647,7 +1649,7 @@ pp_cxx_type_id (cxx_pretty_printer *pp, tree t) ...@@ -1647,7 +1649,7 @@ pp_cxx_type_id (cxx_pretty_printer *pp, tree t)
case TYPE_PACK_EXPANSION: case TYPE_PACK_EXPANSION:
pp_cxx_type_id (pp, PACK_EXPANSION_PATTERN (t)); pp_cxx_type_id (pp, PACK_EXPANSION_PATTERN (t));
pp_cxx_identifier (pp, "..."); pp_cxx_ws_string (pp, "...");
break; break;
default: default:
...@@ -1730,15 +1732,15 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t) ...@@ -1730,15 +1732,15 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
break; break;
case USING_STMT: case USING_STMT:
pp_cxx_identifier (pp, "using"); pp_cxx_ws_string (pp, "using");
pp_cxx_identifier (pp, "namespace"); pp_cxx_ws_string (pp, "namespace");
if (DECL_CONTEXT (t)) if (DECL_CONTEXT (t))
pp_cxx_nested_name_specifier (pp, DECL_CONTEXT (t)); pp_cxx_nested_name_specifier (pp, DECL_CONTEXT (t));
pp_cxx_qualified_id (pp, USING_STMT_NAMESPACE (t)); pp_cxx_qualified_id (pp, USING_STMT_NAMESPACE (t));
break; break;
case USING_DECL: case USING_DECL:
pp_cxx_identifier (pp, "using"); pp_cxx_ws_string (pp, "using");
pp_cxx_nested_name_specifier (pp, USING_DECL_SCOPE (t)); pp_cxx_nested_name_specifier (pp, USING_DECL_SCOPE (t));
pp_cxx_unqualified_id (pp, DECL_NAME (t)); pp_cxx_unqualified_id (pp, DECL_NAME (t));
break; break;
...@@ -1750,7 +1752,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t) ...@@ -1750,7 +1752,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
try compound-statement handler-seq */ try compound-statement handler-seq */
case TRY_BLOCK: case TRY_BLOCK:
pp_maybe_newline_and_indent (pp, 0); pp_maybe_newline_and_indent (pp, 0);
pp_cxx_identifier (pp, "try"); pp_cxx_ws_string (pp, "try");
pp_newline_and_indent (pp, 3); pp_newline_and_indent (pp, 3);
pp_cxx_statement (pp, TRY_STMTS (t)); pp_cxx_statement (pp, TRY_STMTS (t));
pp_newline_and_indent (pp, -3); pp_newline_and_indent (pp, -3);
...@@ -1772,7 +1774,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t) ...@@ -1772,7 +1774,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
type-specifier-seq abstract-declarator type-specifier-seq abstract-declarator
... */ ... */
case HANDLER: case HANDLER:
pp_cxx_identifier (pp, "catch"); pp_cxx_ws_string (pp, "catch");
pp_cxx_left_paren (pp); pp_cxx_left_paren (pp);
pp_cxx_exception_declaration (pp, HANDLER_PARMS (t)); pp_cxx_exception_declaration (pp, HANDLER_PARMS (t));
pp_cxx_right_paren (pp); pp_cxx_right_paren (pp);
...@@ -1787,7 +1789,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t) ...@@ -1787,7 +1789,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
if ( expression ) statement if ( expression ) statement
if ( expression ) statement else statement */ if ( expression ) statement else statement */
case IF_STMT: case IF_STMT:
pp_cxx_identifier (pp, "if"); pp_cxx_ws_string (pp, "if");
pp_cxx_whitespace (pp); pp_cxx_whitespace (pp);
pp_cxx_left_paren (pp); pp_cxx_left_paren (pp);
pp_cxx_expression (pp, IF_COND (t)); pp_cxx_expression (pp, IF_COND (t));
...@@ -1798,7 +1800,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t) ...@@ -1798,7 +1800,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
if (ELSE_CLAUSE (t)) if (ELSE_CLAUSE (t))
{ {
tree else_clause = ELSE_CLAUSE (t); tree else_clause = ELSE_CLAUSE (t);
pp_cxx_identifier (pp, "else"); pp_cxx_ws_string (pp, "else");
if (TREE_CODE (else_clause) == IF_STMT) if (TREE_CODE (else_clause) == IF_STMT)
pp_cxx_whitespace (pp); pp_cxx_whitespace (pp);
else else
...@@ -1810,7 +1812,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t) ...@@ -1810,7 +1812,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
break; break;
case SWITCH_STMT: case SWITCH_STMT:
pp_cxx_identifier (pp, "switch"); pp_cxx_ws_string (pp, "switch");
pp_space (pp); pp_space (pp);
pp_cxx_left_paren (pp); pp_cxx_left_paren (pp);
pp_cxx_expression (pp, SWITCH_STMT_COND (t)); pp_cxx_expression (pp, SWITCH_STMT_COND (t));
...@@ -1827,7 +1829,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t) ...@@ -1827,7 +1829,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
for ( expression(opt) ; expression(opt) ; expression(opt) ) statement for ( expression(opt) ; expression(opt) ; expression(opt) ) statement
for ( declaration expression(opt) ; expression(opt) ) statement */ for ( declaration expression(opt) ; expression(opt) ) statement */
case WHILE_STMT: case WHILE_STMT:
pp_cxx_identifier (pp, "while"); pp_cxx_ws_string (pp, "while");
pp_space (pp); pp_space (pp);
pp_cxx_left_paren (pp); pp_cxx_left_paren (pp);
pp_cxx_expression (pp, WHILE_COND (t)); pp_cxx_expression (pp, WHILE_COND (t));
...@@ -1839,11 +1841,11 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t) ...@@ -1839,11 +1841,11 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
break; break;
case DO_STMT: case DO_STMT:
pp_cxx_identifier (pp, "do"); pp_cxx_ws_string (pp, "do");
pp_newline_and_indent (pp, 3); pp_newline_and_indent (pp, 3);
pp_cxx_statement (pp, DO_BODY (t)); pp_cxx_statement (pp, DO_BODY (t));
pp_newline_and_indent (pp, -3); pp_newline_and_indent (pp, -3);
pp_cxx_identifier (pp, "while"); pp_cxx_ws_string (pp, "while");
pp_space (pp); pp_space (pp);
pp_cxx_left_paren (pp); pp_cxx_left_paren (pp);
pp_cxx_expression (pp, DO_COND (t)); pp_cxx_expression (pp, DO_COND (t));
...@@ -1853,7 +1855,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t) ...@@ -1853,7 +1855,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
break; break;
case FOR_STMT: case FOR_STMT:
pp_cxx_identifier (pp, "for"); pp_cxx_ws_string (pp, "for");
pp_space (pp); pp_space (pp);
pp_cxx_left_paren (pp); pp_cxx_left_paren (pp);
if (FOR_INIT_STMT (t)) if (FOR_INIT_STMT (t))
...@@ -1882,7 +1884,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t) ...@@ -1882,7 +1884,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
return expression(opt) ; */ return expression(opt) ; */
case BREAK_STMT: case BREAK_STMT:
case CONTINUE_STMT: case CONTINUE_STMT:
pp_identifier (pp, TREE_CODE (t) == BREAK_STMT ? "break" : "continue"); pp_string (pp, TREE_CODE (t) == BREAK_STMT ? "break" : "continue");
pp_cxx_semicolon (pp); pp_cxx_semicolon (pp);
pp_needs_newline (pp) = true; pp_needs_newline (pp) = true;
break; break;
...@@ -1896,11 +1898,11 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t) ...@@ -1896,11 +1898,11 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
break; break;
case CLEANUP_STMT: case CLEANUP_STMT:
pp_cxx_identifier (pp, "try"); pp_cxx_ws_string (pp, "try");
pp_newline_and_indent (pp, 2); pp_newline_and_indent (pp, 2);
pp_cxx_statement (pp, CLEANUP_BODY (t)); pp_cxx_statement (pp, CLEANUP_BODY (t));
pp_newline_and_indent (pp, -2); pp_newline_and_indent (pp, -2);
pp_cxx_identifier (pp, CLEANUP_EH_ONLY (t) ? "catch" : "finally"); pp_cxx_ws_string (pp, CLEANUP_EH_ONLY (t) ? "catch" : "finally");
pp_newline_and_indent (pp, 2); pp_newline_and_indent (pp, 2);
pp_cxx_statement (pp, CLEANUP_EXPR (t)); pp_cxx_statement (pp, CLEANUP_EXPR (t));
pp_newline_and_indent (pp, -2); pp_newline_and_indent (pp, -2);
...@@ -1924,7 +1926,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t) ...@@ -1924,7 +1926,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
static void static void
pp_cxx_original_namespace_definition (cxx_pretty_printer *pp, tree t) pp_cxx_original_namespace_definition (cxx_pretty_printer *pp, tree t)
{ {
pp_cxx_identifier (pp, "namespace"); pp_cxx_ws_string (pp, "namespace");
if (DECL_CONTEXT (t)) if (DECL_CONTEXT (t))
pp_cxx_nested_name_specifier (pp, DECL_CONTEXT (t)); pp_cxx_nested_name_specifier (pp, DECL_CONTEXT (t));
if (DECL_NAME (t)) if (DECL_NAME (t))
...@@ -1948,7 +1950,7 @@ pp_cxx_original_namespace_definition (cxx_pretty_printer *pp, tree t) ...@@ -1948,7 +1950,7 @@ pp_cxx_original_namespace_definition (cxx_pretty_printer *pp, tree t)
static void static void
pp_cxx_namespace_alias_definition (cxx_pretty_printer *pp, tree t) pp_cxx_namespace_alias_definition (cxx_pretty_printer *pp, tree t)
{ {
pp_cxx_identifier (pp, "namespace"); pp_cxx_ws_string (pp, "namespace");
if (DECL_CONTEXT (t)) if (DECL_CONTEXT (t))
pp_cxx_nested_name_specifier (pp, DECL_CONTEXT (t)); pp_cxx_nested_name_specifier (pp, DECL_CONTEXT (t));
pp_cxx_unqualified_id (pp, t); pp_cxx_unqualified_id (pp, t);
...@@ -2011,9 +2013,9 @@ pp_cxx_template_parameter (cxx_pretty_printer *pp, tree t) ...@@ -2011,9 +2013,9 @@ pp_cxx_template_parameter (cxx_pretty_printer *pp, tree t)
switch (TREE_CODE (parameter)) switch (TREE_CODE (parameter))
{ {
case TYPE_DECL: case TYPE_DECL:
pp_cxx_identifier (pp, "class"); pp_cxx_ws_string (pp, "class");
if (TEMPLATE_TYPE_PARAMETER_PACK (TREE_TYPE (t))) if (TEMPLATE_TYPE_PARAMETER_PACK (TREE_TYPE (t)))
pp_cxx_identifier (pp, "..."); pp_cxx_ws_string (pp, "...");
if (DECL_NAME (parameter)) if (DECL_NAME (parameter))
pp_cxx_tree_identifier (pp, DECL_NAME (parameter)); pp_cxx_tree_identifier (pp, DECL_NAME (parameter));
/* FIXME: Check if we should print also default argument. */ /* FIXME: Check if we should print also default argument. */
...@@ -2046,7 +2048,7 @@ pp_cxx_canonical_template_parameter (cxx_pretty_printer *pp, tree parm) ...@@ -2046,7 +2048,7 @@ pp_cxx_canonical_template_parameter (cxx_pretty_printer *pp, tree parm)
parm = TEMPLATE_TYPE_PARM_INDEX (parm); parm = TEMPLATE_TYPE_PARM_INDEX (parm);
pp_cxx_begin_template_argument_list (pp); pp_cxx_begin_template_argument_list (pp);
pp_cxx_identifier (pp, "template-parameter-"); pp_cxx_ws_string (pp, _("template-parameter-"));
pp_wide_integer (pp, TEMPLATE_PARM_LEVEL (parm)); pp_wide_integer (pp, TEMPLATE_PARM_LEVEL (parm));
pp_minus (pp); pp_minus (pp);
pp_wide_integer (pp, TEMPLATE_PARM_IDX (parm) + 1); pp_wide_integer (pp, TEMPLATE_PARM_IDX (parm) + 1);
...@@ -2067,7 +2069,7 @@ pp_cxx_template_declaration (cxx_pretty_printer *pp, tree t) ...@@ -2067,7 +2069,7 @@ pp_cxx_template_declaration (cxx_pretty_printer *pp, tree t)
pp_maybe_newline_and_indent (pp, 0); pp_maybe_newline_and_indent (pp, 0);
for (level = DECL_TEMPLATE_PARMS (tmpl); level; level = TREE_CHAIN (level)) for (level = DECL_TEMPLATE_PARMS (tmpl); level; level = TREE_CHAIN (level))
{ {
pp_cxx_identifier (pp, "template"); pp_cxx_ws_string (pp, "template");
pp_cxx_begin_template_argument_list (pp); pp_cxx_begin_template_argument_list (pp);
pp_cxx_template_parameter_list (pp, TREE_VALUE (level)); pp_cxx_template_parameter_list (pp, TREE_VALUE (level));
pp_cxx_end_template_argument_list (pp); pp_cxx_end_template_argument_list (pp);
...@@ -2114,7 +2116,7 @@ pp_cxx_declaration (cxx_pretty_printer *pp, tree t) ...@@ -2114,7 +2116,7 @@ pp_cxx_declaration (cxx_pretty_printer *pp, tree t)
{ {
if (TREE_CODE (t) == STATIC_ASSERT) if (TREE_CODE (t) == STATIC_ASSERT)
{ {
pp_cxx_identifier (pp, "static_assert"); pp_cxx_ws_string (pp, "static_assert");
pp_cxx_left_paren (pp); pp_cxx_left_paren (pp);
pp_cxx_expression (pp, STATIC_ASSERT_CONDITION (t)); pp_cxx_expression (pp, STATIC_ASSERT_CONDITION (t));
pp_cxx_separate_with (pp, ','); pp_cxx_separate_with (pp, ',');
...@@ -2172,7 +2174,7 @@ static void ...@@ -2172,7 +2174,7 @@ static void
pp_cxx_typeid_expression (cxx_pretty_printer *pp, tree t) pp_cxx_typeid_expression (cxx_pretty_printer *pp, tree t)
{ {
t = TREE_OPERAND (t, 0); t = TREE_OPERAND (t, 0);
pp_cxx_identifier (pp, "typeid"); pp_cxx_ws_string (pp, "typeid");
pp_cxx_left_paren (pp); pp_cxx_left_paren (pp);
if (TYPE_P (t)) if (TYPE_P (t))
pp_cxx_type_id (pp, t); pp_cxx_type_id (pp, t);
...@@ -2184,7 +2186,7 @@ pp_cxx_typeid_expression (cxx_pretty_printer *pp, tree t) ...@@ -2184,7 +2186,7 @@ pp_cxx_typeid_expression (cxx_pretty_printer *pp, tree t)
void void
pp_cxx_va_arg_expression (cxx_pretty_printer *pp, tree t) pp_cxx_va_arg_expression (cxx_pretty_printer *pp, tree t)
{ {
pp_cxx_identifier (pp, "va_arg"); pp_cxx_ws_string (pp, "va_arg");
pp_cxx_left_paren (pp); pp_cxx_left_paren (pp);
pp_cxx_assignment_expression (pp, TREE_OPERAND (t, 0)); pp_cxx_assignment_expression (pp, TREE_OPERAND (t, 0));
pp_cxx_separate_with (pp, ','); pp_cxx_separate_with (pp, ',');
...@@ -2228,7 +2230,7 @@ pp_cxx_offsetof_expression_1 (cxx_pretty_printer *pp, tree t) ...@@ -2228,7 +2230,7 @@ pp_cxx_offsetof_expression_1 (cxx_pretty_printer *pp, tree t)
void void
pp_cxx_offsetof_expression (cxx_pretty_printer *pp, tree t) pp_cxx_offsetof_expression (cxx_pretty_printer *pp, tree t)
{ {
pp_cxx_identifier (pp, "offsetof"); pp_cxx_ws_string (pp, "offsetof");
pp_cxx_left_paren (pp); pp_cxx_left_paren (pp);
if (!pp_cxx_offsetof_expression_1 (pp, TREE_OPERAND (t, 0))) if (!pp_cxx_offsetof_expression_1 (pp, TREE_OPERAND (t, 0)))
pp_cxx_expression (pp, TREE_OPERAND (t, 0)); pp_cxx_expression (pp, TREE_OPERAND (t, 0));
...@@ -2243,55 +2245,55 @@ pp_cxx_trait_expression (cxx_pretty_printer *pp, tree t) ...@@ -2243,55 +2245,55 @@ pp_cxx_trait_expression (cxx_pretty_printer *pp, tree t)
switch (kind) switch (kind)
{ {
case CPTK_HAS_NOTHROW_ASSIGN: case CPTK_HAS_NOTHROW_ASSIGN:
pp_cxx_identifier (pp, "__has_nothrow_assign"); pp_cxx_ws_string (pp, "__has_nothrow_assign");
break; break;
case CPTK_HAS_TRIVIAL_ASSIGN: case CPTK_HAS_TRIVIAL_ASSIGN:
pp_cxx_identifier (pp, "__has_trivial_assign"); pp_cxx_ws_string (pp, "__has_trivial_assign");
break; break;
case CPTK_HAS_NOTHROW_CONSTRUCTOR: case CPTK_HAS_NOTHROW_CONSTRUCTOR:
pp_cxx_identifier (pp, "__has_nothrow_constructor"); pp_cxx_ws_string (pp, "__has_nothrow_constructor");
break; break;
case CPTK_HAS_TRIVIAL_CONSTRUCTOR: case CPTK_HAS_TRIVIAL_CONSTRUCTOR:
pp_cxx_identifier (pp, "__has_trivial_constructor"); pp_cxx_ws_string (pp, "__has_trivial_constructor");
break; break;
case CPTK_HAS_NOTHROW_COPY: case CPTK_HAS_NOTHROW_COPY:
pp_cxx_identifier (pp, "__has_nothrow_copy"); pp_cxx_ws_string (pp, "__has_nothrow_copy");
break; break;
case CPTK_HAS_TRIVIAL_COPY: case CPTK_HAS_TRIVIAL_COPY:
pp_cxx_identifier (pp, "__has_trivial_copy"); pp_cxx_ws_string (pp, "__has_trivial_copy");
break; break;
case CPTK_HAS_TRIVIAL_DESTRUCTOR: case CPTK_HAS_TRIVIAL_DESTRUCTOR:
pp_cxx_identifier (pp, "__has_trivial_destructor"); pp_cxx_ws_string (pp, "__has_trivial_destructor");
break; break;
case CPTK_HAS_VIRTUAL_DESTRUCTOR: case CPTK_HAS_VIRTUAL_DESTRUCTOR:
pp_cxx_identifier (pp, "__has_virtual_destructor"); pp_cxx_ws_string (pp, "__has_virtual_destructor");
break; break;
case CPTK_IS_ABSTRACT: case CPTK_IS_ABSTRACT:
pp_cxx_identifier (pp, "__is_abstract"); pp_cxx_ws_string (pp, "__is_abstract");
break; break;
case CPTK_IS_BASE_OF: case CPTK_IS_BASE_OF:
pp_cxx_identifier (pp, "__is_base_of"); pp_cxx_ws_string (pp, "__is_base_of");
break; break;
case CPTK_IS_CLASS: case CPTK_IS_CLASS:
pp_cxx_identifier (pp, "__is_class"); pp_cxx_ws_string (pp, "__is_class");
break; break;
case CPTK_IS_CONVERTIBLE_TO: case CPTK_IS_CONVERTIBLE_TO:
pp_cxx_identifier (pp, "__is_convertible_to"); pp_cxx_ws_string (pp, "__is_convertible_to");
break; break;
case CPTK_IS_EMPTY: case CPTK_IS_EMPTY:
pp_cxx_identifier (pp, "__is_empty"); pp_cxx_ws_string (pp, "__is_empty");
break; break;
case CPTK_IS_ENUM: case CPTK_IS_ENUM:
pp_cxx_identifier (pp, "__is_enum"); pp_cxx_ws_string (pp, "__is_enum");
break; break;
case CPTK_IS_POD: case CPTK_IS_POD:
pp_cxx_identifier (pp, "__is_pod"); pp_cxx_ws_string (pp, "__is_pod");
break; break;
case CPTK_IS_POLYMORPHIC: case CPTK_IS_POLYMORPHIC:
pp_cxx_identifier (pp, "__is_polymorphic"); pp_cxx_ws_string (pp, "__is_polymorphic");
break; break;
case CPTK_IS_UNION: case CPTK_IS_UNION:
pp_cxx_identifier (pp, "__is_union"); pp_cxx_ws_string (pp, "__is_union");
break; break;
default: default:
......
/* Interface for the GNU C++ pretty-printer. /* Interface for the GNU C++ pretty-printer.
Copyright (C) 2003, 2004, 2005, 2007 Free Software Foundation, Inc. Copyright (C) 2003, 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net> Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
This file is part of GCC. This file is part of GCC.
...@@ -57,6 +57,7 @@ typedef struct ...@@ -57,6 +57,7 @@ typedef struct
#define pp_cxx_semicolon(PP) pp_c_semicolon (pp_c_base (PP)) #define pp_cxx_semicolon(PP) pp_c_semicolon (pp_c_base (PP))
#define pp_cxx_complement(PP) pp_c_complement (pp_c_base (PP)) #define pp_cxx_complement(PP) pp_c_complement (pp_c_base (PP))
#define pp_cxx_ws_string(PP, I) pp_c_ws_string (pp_c_base (PP), I)
#define pp_cxx_identifier(PP, I) pp_c_identifier (pp_c_base (PP), I) #define pp_cxx_identifier(PP, I) pp_c_identifier (pp_c_base (PP), I)
#define pp_cxx_tree_identifier(PP, T) \ #define pp_cxx_tree_identifier(PP, T) \
pp_c_tree_identifier (pp_c_base (PP), T) pp_c_tree_identifier (pp_c_base (PP), T)
......
...@@ -29,6 +29,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -29,6 +29,7 @@ along with GCC; see the file COPYING3. If not see
#include "flags.h" #include "flags.h"
#include "diagnostic.h" #include "diagnostic.h"
#include "langhooks-def.h" #include "langhooks-def.h"
#include "intl.h"
#include "cxx-pretty-print.h" #include "cxx-pretty-print.h"
#include "pointer-set.h" #include "pointer-set.h"
...@@ -231,9 +232,9 @@ dump_template_parameter (tree parm, int flags) ...@@ -231,9 +232,9 @@ dump_template_parameter (tree parm, int flags)
{ {
if (flags & TFF_DECL_SPECIFIERS) if (flags & TFF_DECL_SPECIFIERS)
{ {
pp_cxx_identifier (cxx_pp, "class"); pp_cxx_ws_string (cxx_pp, "class");
if (TEMPLATE_TYPE_PARAMETER_PACK (TREE_TYPE (p))) if (TEMPLATE_TYPE_PARAMETER_PACK (TREE_TYPE (p)))
pp_cxx_identifier (cxx_pp, "..."); pp_cxx_ws_string (cxx_pp, "...");
if (DECL_NAME (p)) if (DECL_NAME (p))
pp_cxx_tree_identifier (cxx_pp, DECL_NAME (p)); pp_cxx_tree_identifier (cxx_pp, DECL_NAME (p));
} }
...@@ -297,7 +298,7 @@ dump_template_bindings (tree parms, tree args, VEC(tree,gc)* typenames) ...@@ -297,7 +298,7 @@ dump_template_bindings (tree parms, tree args, VEC(tree,gc)* typenames)
if (arg) if (arg)
dump_template_argument (arg, TFF_PLAIN_IDENTIFIER); dump_template_argument (arg, TFF_PLAIN_IDENTIFIER);
else else
pp_identifier (cxx_pp, "<missing>"); pp_string (cxx_pp, _("<missing>"));
++arg_idx; ++arg_idx;
need_comma = 1; need_comma = 1;
...@@ -338,9 +339,9 @@ dump_type (tree t, int flags) ...@@ -338,9 +339,9 @@ dump_type (tree t, int flags)
{ {
case UNKNOWN_TYPE: case UNKNOWN_TYPE:
if (t == init_list_type_node) if (t == init_list_type_node)
pp_identifier (cxx_pp, "<brace-enclosed initializer list>"); pp_string (cxx_pp, _("<brace-enclosed initializer list>"));
else else
pp_identifier (cxx_pp, "<unresolved overloaded function type>"); pp_string (cxx_pp, _("<unresolved overloaded function type>"));
break; break;
case TREE_LIST: case TREE_LIST:
...@@ -436,7 +437,7 @@ dump_type (tree t, int flags) ...@@ -436,7 +437,7 @@ dump_type (tree t, int flags)
break; break;
} }
pp_cxx_cv_qualifier_seq (cxx_pp, t); pp_cxx_cv_qualifier_seq (cxx_pp, t);
pp_cxx_identifier (cxx_pp, pp_cxx_ws_string (cxx_pp,
TYPENAME_IS_ENUM_P (t) ? "enum" TYPENAME_IS_ENUM_P (t) ? "enum"
: TYPENAME_IS_CLASS_P (t) ? "class" : TYPENAME_IS_CLASS_P (t) ? "class"
: "typename"); : "typename");
...@@ -446,12 +447,12 @@ dump_type (tree t, int flags) ...@@ -446,12 +447,12 @@ dump_type (tree t, int flags)
case UNBOUND_CLASS_TEMPLATE: case UNBOUND_CLASS_TEMPLATE:
dump_type (TYPE_CONTEXT (t), flags); dump_type (TYPE_CONTEXT (t), flags);
pp_cxx_colon_colon (cxx_pp); pp_cxx_colon_colon (cxx_pp);
pp_cxx_identifier (cxx_pp, "template"); pp_cxx_ws_string (cxx_pp, "template");
dump_type (DECL_NAME (TYPE_NAME (t)), flags); dump_type (DECL_NAME (TYPE_NAME (t)), flags);
break; break;
case TYPEOF_TYPE: case TYPEOF_TYPE:
pp_cxx_identifier (cxx_pp, "__typeof__"); pp_cxx_ws_string (cxx_pp, "__typeof__");
pp_cxx_whitespace (cxx_pp); pp_cxx_whitespace (cxx_pp);
pp_cxx_left_paren (cxx_pp); pp_cxx_left_paren (cxx_pp);
dump_expr (TYPEOF_TYPE_EXPR (t), flags & ~TFF_EXPR_IN_PARENS); dump_expr (TYPEOF_TYPE_EXPR (t), flags & ~TFF_EXPR_IN_PARENS);
...@@ -460,7 +461,7 @@ dump_type (tree t, int flags) ...@@ -460,7 +461,7 @@ dump_type (tree t, int flags)
case TYPE_PACK_EXPANSION: case TYPE_PACK_EXPANSION:
dump_type (PACK_EXPANSION_PATTERN (t), flags); dump_type (PACK_EXPANSION_PATTERN (t), flags);
pp_cxx_identifier (cxx_pp, "..."); pp_cxx_ws_string (cxx_pp, "...");
break; break;
case TYPE_ARGUMENT_PACK: case TYPE_ARGUMENT_PACK:
...@@ -468,7 +469,7 @@ dump_type (tree t, int flags) ...@@ -468,7 +469,7 @@ dump_type (tree t, int flags)
break; break;
case DECLTYPE_TYPE: case DECLTYPE_TYPE:
pp_cxx_identifier (cxx_pp, "decltype"); pp_cxx_ws_string (cxx_pp, "decltype");
pp_cxx_whitespace (cxx_pp); pp_cxx_whitespace (cxx_pp);
pp_cxx_left_paren (cxx_pp); pp_cxx_left_paren (cxx_pp);
dump_expr (DECLTYPE_TYPE_EXPR (t), flags & ~TFF_EXPR_IN_PARENS); dump_expr (DECLTYPE_TYPE_EXPR (t), flags & ~TFF_EXPR_IN_PARENS);
...@@ -480,7 +481,7 @@ dump_type (tree t, int flags) ...@@ -480,7 +481,7 @@ dump_type (tree t, int flags)
/* Fall through to error. */ /* Fall through to error. */
case ERROR_MARK: case ERROR_MARK:
pp_identifier (cxx_pp, "<type error>"); pp_string (cxx_pp, _("<type error>"));
break; break;
} }
} }
...@@ -535,7 +536,7 @@ dump_aggr_type (tree t, int flags) ...@@ -535,7 +536,7 @@ dump_aggr_type (tree t, int flags)
pp_cxx_cv_qualifier_seq (cxx_pp, t); pp_cxx_cv_qualifier_seq (cxx_pp, t);
if (flags & TFF_CLASS_KEY_OR_ENUM) if (flags & TFF_CLASS_KEY_OR_ENUM)
pp_cxx_identifier (cxx_pp, variety); pp_cxx_ws_string (cxx_pp, variety);
name = TYPE_NAME (t); name = TYPE_NAME (t);
...@@ -577,9 +578,9 @@ dump_aggr_type (tree t, int flags) ...@@ -577,9 +578,9 @@ dump_aggr_type (tree t, int flags)
if (name == 0 || ANON_AGGRNAME_P (name)) if (name == 0 || ANON_AGGRNAME_P (name))
{ {
if (flags & TFF_CLASS_KEY_OR_ENUM) if (flags & TFF_CLASS_KEY_OR_ENUM)
pp_identifier (cxx_pp, "<anonymous>"); pp_string (cxx_pp, _("<anonymous>"));
else else
pp_printf (pp_base (cxx_pp), "<anonymous %s>", variety); pp_printf (pp_base (cxx_pp), _("<anonymous %s>"), variety);
} }
else else
pp_cxx_tree_identifier (cxx_pp, name); pp_cxx_tree_identifier (cxx_pp, name);
...@@ -701,7 +702,7 @@ dump_type_prefix (tree t, int flags) ...@@ -701,7 +702,7 @@ dump_type_prefix (tree t, int flags)
pp_unsupported_tree (cxx_pp, t); pp_unsupported_tree (cxx_pp, t);
/* fall through. */ /* fall through. */
case ERROR_MARK: case ERROR_MARK:
pp_identifier (cxx_pp, "<typeprefixerror>"); pp_string (cxx_pp, _("<typeprefixerror>"));
break; break;
} }
} }
...@@ -811,13 +812,13 @@ dump_global_iord (tree t) ...@@ -811,13 +812,13 @@ dump_global_iord (tree t)
const char *p = NULL; const char *p = NULL;
if (DECL_GLOBAL_CTOR_P (t)) if (DECL_GLOBAL_CTOR_P (t))
p = "initializers"; p = _("(static initializers for %s)");
else if (DECL_GLOBAL_DTOR_P (t)) else if (DECL_GLOBAL_DTOR_P (t))
p = "destructors"; p = _("(static destructors for %s)");
else else
gcc_unreachable (); gcc_unreachable ();
pp_printf (pp_base (cxx_pp), "(static %s for %s)", p, input_filename); pp_printf (pp_base (cxx_pp), p, input_filename);
} }
static void static void
...@@ -836,11 +837,11 @@ dump_simple_decl (tree t, tree type, int flags) ...@@ -836,11 +837,11 @@ dump_simple_decl (tree t, tree type, int flags)
if ((flags & TFF_DECL_SPECIFIERS) if ((flags & TFF_DECL_SPECIFIERS)
&& DECL_TEMPLATE_PARM_P (t) && DECL_TEMPLATE_PARM_P (t)
&& TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (t))) && TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (t)))
pp_identifier (cxx_pp, "..."); pp_string (cxx_pp, "...");
if (DECL_NAME (t)) if (DECL_NAME (t))
dump_decl (DECL_NAME (t), flags); dump_decl (DECL_NAME (t), flags);
else else
pp_identifier (cxx_pp, "<anonymous>"); pp_string (cxx_pp, _("<anonymous>"));
if (flags & TFF_DECL_SPECIFIERS) if (flags & TFF_DECL_SPECIFIERS)
dump_type_suffix (type, flags); dump_type_suffix (type, flags);
} }
...@@ -863,18 +864,18 @@ dump_decl (tree t, int flags) ...@@ -863,18 +864,18 @@ dump_decl (tree t, int flags)
&& TREE_CODE (TREE_TYPE (t)) == TEMPLATE_TYPE_PARM) && TREE_CODE (TREE_TYPE (t)) == TEMPLATE_TYPE_PARM)
{ {
/* Say `class T' not just `T'. */ /* Say `class T' not just `T'. */
pp_cxx_identifier (cxx_pp, "class"); pp_cxx_ws_string (cxx_pp, "class");
/* Emit the `...' for a parameter pack. */ /* Emit the `...' for a parameter pack. */
if (TEMPLATE_TYPE_PARAMETER_PACK (TREE_TYPE (t))) if (TEMPLATE_TYPE_PARAMETER_PACK (TREE_TYPE (t)))
pp_cxx_identifier (cxx_pp, "..."); pp_cxx_ws_string (cxx_pp, "...");
} }
dump_type (TREE_TYPE (t), flags); dump_type (TREE_TYPE (t), flags);
break; break;
} }
if (flags & TFF_DECL_SPECIFIERS) if (flags & TFF_DECL_SPECIFIERS)
pp_cxx_identifier (cxx_pp, "typedef"); pp_cxx_ws_string (cxx_pp, "typedef");
dump_simple_decl (t, DECL_ORIGINAL_TYPE (t) dump_simple_decl (t, DECL_ORIGINAL_TYPE (t)
? DECL_ORIGINAL_TYPE (t) : TREE_TYPE (t), ? DECL_ORIGINAL_TYPE (t) : TREE_TYPE (t),
flags); flags);
...@@ -883,7 +884,7 @@ dump_decl (tree t, int flags) ...@@ -883,7 +884,7 @@ dump_decl (tree t, int flags)
case VAR_DECL: case VAR_DECL:
if (DECL_NAME (t) && VTABLE_NAME_P (DECL_NAME (t))) if (DECL_NAME (t) && VTABLE_NAME_P (DECL_NAME (t)))
{ {
pp_string (cxx_pp, "vtable for "); pp_string (cxx_pp, _("vtable for "));
gcc_assert (TYPE_P (DECL_CONTEXT (t))); gcc_assert (TYPE_P (DECL_CONTEXT (t)));
dump_type (DECL_CONTEXT (t), flags); dump_type (DECL_CONTEXT (t), flags);
break; break;
...@@ -895,7 +896,7 @@ dump_decl (tree t, int flags) ...@@ -895,7 +896,7 @@ dump_decl (tree t, int flags)
break; break;
case RESULT_DECL: case RESULT_DECL:
pp_string (cxx_pp, "<return value> "); pp_string (cxx_pp, _("<return value> "));
dump_simple_decl (t, TREE_TYPE (t), flags); dump_simple_decl (t, TREE_TYPE (t), flags);
break; break;
...@@ -908,7 +909,7 @@ dump_decl (tree t, int flags) ...@@ -908,7 +909,7 @@ dump_decl (tree t, int flags)
dump_scope (CP_DECL_CONTEXT (t), flags); dump_scope (CP_DECL_CONTEXT (t), flags);
flags &= ~TFF_UNQUALIFIED_NAME; flags &= ~TFF_UNQUALIFIED_NAME;
if (DECL_NAME (t) == NULL_TREE) if (DECL_NAME (t) == NULL_TREE)
pp_identifier (cxx_pp, "<unnamed>"); pp_string (cxx_pp, _("<unnamed>"));
else else
pp_cxx_tree_identifier (cxx_pp, DECL_NAME (t)); pp_cxx_tree_identifier (cxx_pp, DECL_NAME (t));
} }
...@@ -948,7 +949,7 @@ dump_decl (tree t, int flags) ...@@ -948,7 +949,7 @@ dump_decl (tree t, int flags)
case IDENTIFIER_NODE: case IDENTIFIER_NODE:
if (IDENTIFIER_TYPENAME_P (t)) if (IDENTIFIER_TYPENAME_P (t))
{ {
pp_cxx_identifier (cxx_pp, "operator"); pp_cxx_ws_string (cxx_pp, "operator");
/* Not exactly IDENTIFIER_TYPE_VALUE. */ /* Not exactly IDENTIFIER_TYPE_VALUE. */
dump_type (TREE_TYPE (t), flags); dump_type (TREE_TYPE (t), flags);
break; break;
...@@ -982,7 +983,7 @@ dump_decl (tree t, int flags) ...@@ -982,7 +983,7 @@ dump_decl (tree t, int flags)
case FUNCTION_DECL: case FUNCTION_DECL:
if (! DECL_LANG_SPECIFIC (t)) if (! DECL_LANG_SPECIFIC (t))
pp_identifier (cxx_pp, "<built-in>"); pp_string (cxx_pp, _("<built-in>"));
else if (DECL_GLOBAL_CTOR_P (t) || DECL_GLOBAL_DTOR_P (t)) else if (DECL_GLOBAL_CTOR_P (t) || DECL_GLOBAL_DTOR_P (t))
dump_global_iord (t); dump_global_iord (t);
else else
...@@ -1021,11 +1022,11 @@ dump_decl (tree t, int flags) ...@@ -1021,11 +1022,11 @@ dump_decl (tree t, int flags)
else if (DECL_INITIAL (t)) else if (DECL_INITIAL (t))
dump_expr (DECL_INITIAL (t), flags | TFF_EXPR_IN_PARENS); dump_expr (DECL_INITIAL (t), flags | TFF_EXPR_IN_PARENS);
else else
pp_identifier (cxx_pp, "<enumerator>"); pp_string (cxx_pp, _("<enumerator>"));
break; break;
case USING_DECL: case USING_DECL:
pp_cxx_identifier (cxx_pp, "using"); pp_cxx_ws_string (cxx_pp, "using");
dump_type (USING_DECL_SCOPE (t), flags); dump_type (USING_DECL_SCOPE (t), flags);
pp_cxx_colon_colon (cxx_pp); pp_cxx_colon_colon (cxx_pp);
dump_decl (DECL_NAME (t), flags); dump_decl (DECL_NAME (t), flags);
...@@ -1061,7 +1062,7 @@ dump_decl (tree t, int flags) ...@@ -1061,7 +1062,7 @@ dump_decl (tree t, int flags)
/* Fall through to error. */ /* Fall through to error. */
case ERROR_MARK: case ERROR_MARK:
pp_identifier (cxx_pp, "<declaration error>"); pp_string (cxx_pp, _("<declaration error>"));
break; break;
} }
} }
...@@ -1085,7 +1086,7 @@ dump_template_decl (tree t, int flags) ...@@ -1085,7 +1086,7 @@ dump_template_decl (tree t, int flags)
tree inner_parms = INNERMOST_TEMPLATE_PARMS (parms); tree inner_parms = INNERMOST_TEMPLATE_PARMS (parms);
int len = TREE_VEC_LENGTH (inner_parms); int len = TREE_VEC_LENGTH (inner_parms);
pp_cxx_identifier (cxx_pp, "template"); pp_cxx_ws_string (cxx_pp, "template");
pp_cxx_begin_template_argument_list (cxx_pp); pp_cxx_begin_template_argument_list (cxx_pp);
/* If we've shown the template prefix, we'd better show the /* If we've shown the template prefix, we'd better show the
...@@ -1106,11 +1107,11 @@ dump_template_decl (tree t, int flags) ...@@ -1106,11 +1107,11 @@ dump_template_decl (tree t, int flags)
if (DECL_TEMPLATE_TEMPLATE_PARM_P (t)) if (DECL_TEMPLATE_TEMPLATE_PARM_P (t))
{ {
/* Say `template<arg> class TT' not just `template<arg> TT'. */ /* Say `template<arg> class TT' not just `template<arg> TT'. */
pp_cxx_identifier (cxx_pp, "class"); pp_cxx_ws_string (cxx_pp, "class");
/* If this is a parameter pack, print the ellipsis. */ /* If this is a parameter pack, print the ellipsis. */
if (TEMPLATE_TYPE_PARAMETER_PACK (TREE_TYPE (t))) if (TEMPLATE_TYPE_PARAMETER_PACK (TREE_TYPE (t)))
pp_cxx_identifier (cxx_pp, "..."); pp_cxx_ws_string (cxx_pp, "...");
} }
} }
...@@ -1241,9 +1242,9 @@ dump_function_decl (tree t, int flags) ...@@ -1241,9 +1242,9 @@ dump_function_decl (tree t, int flags)
if (!(flags & TFF_DECL_SPECIFIERS)) if (!(flags & TFF_DECL_SPECIFIERS))
/* OK */; /* OK */;
else if (DECL_STATIC_FUNCTION_P (t)) else if (DECL_STATIC_FUNCTION_P (t))
pp_cxx_identifier (cxx_pp, "static"); pp_cxx_ws_string (cxx_pp, "static");
else if (DECL_VIRTUAL_P (t)) else if (DECL_VIRTUAL_P (t))
pp_cxx_identifier (cxx_pp, "virtual"); pp_cxx_ws_string (cxx_pp, "virtual");
/* Print the return type? */ /* Print the return type? */
if (show_return) if (show_return)
...@@ -1291,7 +1292,7 @@ dump_function_decl (tree t, int flags) ...@@ -1291,7 +1292,7 @@ dump_function_decl (tree t, int flags)
{ {
pp_cxx_whitespace (cxx_pp); pp_cxx_whitespace (cxx_pp);
pp_cxx_left_bracket (cxx_pp); pp_cxx_left_bracket (cxx_pp);
pp_cxx_identifier (cxx_pp, "with"); pp_cxx_ws_string (cxx_pp, _("with"));
pp_cxx_whitespace (cxx_pp); pp_cxx_whitespace (cxx_pp);
dump_template_bindings (template_parms, template_args, typenames); dump_template_bindings (template_parms, template_args, typenames);
pp_cxx_right_bracket (cxx_pp); pp_cxx_right_bracket (cxx_pp);
...@@ -1316,7 +1317,7 @@ dump_parameters (tree parmtypes, int flags) ...@@ -1316,7 +1317,7 @@ dump_parameters (tree parmtypes, int flags)
first = 0; first = 0;
if (!parmtypes) if (!parmtypes)
{ {
pp_cxx_identifier (cxx_pp, "..."); pp_cxx_ws_string (cxx_pp, "...");
break; break;
} }
...@@ -1341,7 +1342,7 @@ dump_exception_spec (tree t, int flags) ...@@ -1341,7 +1342,7 @@ dump_exception_spec (tree t, int flags)
{ {
if (t) if (t)
{ {
pp_cxx_identifier (cxx_pp, "throw"); pp_cxx_ws_string (cxx_pp, "throw");
pp_cxx_whitespace (cxx_pp); pp_cxx_whitespace (cxx_pp);
pp_cxx_left_paren (cxx_pp); pp_cxx_left_paren (cxx_pp);
if (TREE_VALUE (t) != NULL_TREE) if (TREE_VALUE (t) != NULL_TREE)
...@@ -1397,7 +1398,7 @@ dump_function_name (tree t, int flags) ...@@ -1397,7 +1398,7 @@ dump_function_name (tree t, int flags)
declarations, both will have the same name, yet declarations, both will have the same name, yet
the types will be different, hence the TREE_TYPE field the types will be different, hence the TREE_TYPE field
of the first name will be clobbered by the second. */ of the first name will be clobbered by the second. */
pp_cxx_identifier (cxx_pp, "operator"); pp_cxx_ws_string (cxx_pp, "operator");
dump_type (TREE_TYPE (TREE_TYPE (t)), flags); dump_type (TREE_TYPE (TREE_TYPE (t)), flags);
} }
else if (IDENTIFIER_OPNAME_P (name)) else if (IDENTIFIER_OPNAME_P (name))
...@@ -1456,7 +1457,7 @@ dump_template_parms (tree info, int primary, int flags) ...@@ -1456,7 +1457,7 @@ dump_template_parms (tree info, int primary, int flags)
pp_separate_with_comma (cxx_pp); pp_separate_with_comma (cxx_pp);
if (!arg) if (!arg)
pp_identifier (cxx_pp, "<template parameter error>"); pp_string (cxx_pp, _("<template parameter error>"));
else else
dump_template_argument (arg, flags); dump_template_argument (arg, flags);
} }
...@@ -1476,7 +1477,7 @@ dump_template_parms (tree info, int primary, int flags) ...@@ -1476,7 +1477,7 @@ dump_template_parms (tree info, int primary, int flags)
if (TREE_VEC_ELT (parms, ix) == error_mark_node) if (TREE_VEC_ELT (parms, ix) == error_mark_node)
{ {
pp_identifier (cxx_pp, "<template parameter error>"); pp_string (cxx_pp, _("<template parameter error>"));
continue; continue;
} }
...@@ -1602,7 +1603,7 @@ dump_expr (tree t, int flags) ...@@ -1602,7 +1603,7 @@ dump_expr (tree t, int flags)
if (STATEMENT_CLASS_P (t)) if (STATEMENT_CLASS_P (t))
{ {
pp_cxx_identifier (cxx_pp, "<statement>"); pp_cxx_ws_string (cxx_pp, _("<statement>"));
return; return;
} }
...@@ -1631,7 +1632,7 @@ dump_expr (tree t, int flags) ...@@ -1631,7 +1632,7 @@ dump_expr (tree t, int flags)
case THROW_EXPR: case THROW_EXPR:
/* While waiting for caret diagnostics, avoid printing /* While waiting for caret diagnostics, avoid printing
__cxa_allocate_exception, __cxa_throw, and the like. */ __cxa_allocate_exception, __cxa_throw, and the like. */
pp_cxx_identifier (cxx_pp, "<throw-expression>"); pp_cxx_ws_string (cxx_pp, _("<throw-expression>"));
break; break;
case PTRMEM_CST: case PTRMEM_CST:
...@@ -1662,7 +1663,7 @@ dump_expr (tree t, int flags) ...@@ -1662,7 +1663,7 @@ dump_expr (tree t, int flags)
case SAVE_EXPR: case SAVE_EXPR:
if (TREE_HAS_CONSTRUCTOR (t)) if (TREE_HAS_CONSTRUCTOR (t))
{ {
pp_cxx_identifier (cxx_pp, "new"); pp_cxx_ws_string (cxx_pp, "new");
pp_cxx_whitespace (cxx_pp); pp_cxx_whitespace (cxx_pp);
dump_type (TREE_TYPE (TREE_TYPE (t)), flags); dump_type (TREE_TYPE (TREE_TYPE (t)), flags);
} }
...@@ -1856,7 +1857,7 @@ dump_expr (tree t, int flags) ...@@ -1856,7 +1857,7 @@ dump_expr (tree t, int flags)
case POSTINCREMENT_EXPR: case POSTINCREMENT_EXPR:
pp_cxx_left_paren (cxx_pp); pp_cxx_left_paren (cxx_pp);
dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS); dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
pp_cxx_identifier (cxx_pp, operator_name_info[(int)TREE_CODE (t)].name); pp_cxx_ws_string (cxx_pp, operator_name_info[(int)TREE_CODE (t)].name);
pp_cxx_right_paren (cxx_pp); pp_cxx_right_paren (cxx_pp);
break; break;
...@@ -2027,16 +2028,16 @@ dump_expr (tree t, int flags) ...@@ -2027,16 +2028,16 @@ dump_expr (tree t, int flags)
break; break;
case STATIC_CAST_EXPR: case STATIC_CAST_EXPR:
pp_cxx_identifier (cxx_pp, "static_cast"); pp_cxx_ws_string (cxx_pp, "static_cast");
goto cast; goto cast;
case REINTERPRET_CAST_EXPR: case REINTERPRET_CAST_EXPR:
pp_cxx_identifier (cxx_pp, "reinterpret_cast"); pp_cxx_ws_string (cxx_pp, "reinterpret_cast");
goto cast; goto cast;
case CONST_CAST_EXPR: case CONST_CAST_EXPR:
pp_cxx_identifier (cxx_pp, "const_cast"); pp_cxx_ws_string (cxx_pp, "const_cast");
goto cast; goto cast;
case DYNAMIC_CAST_EXPR: case DYNAMIC_CAST_EXPR:
pp_cxx_identifier (cxx_pp, "dynamic_cast"); pp_cxx_ws_string (cxx_pp, "dynamic_cast");
cast: cast:
pp_cxx_begin_template_argument_list (cxx_pp); pp_cxx_begin_template_argument_list (cxx_pp);
dump_type (TREE_TYPE (t), flags); dump_type (TREE_TYPE (t), flags);
...@@ -2054,11 +2055,11 @@ dump_expr (tree t, int flags) ...@@ -2054,11 +2055,11 @@ dump_expr (tree t, int flags)
case SIZEOF_EXPR: case SIZEOF_EXPR:
case ALIGNOF_EXPR: case ALIGNOF_EXPR:
if (TREE_CODE (t) == SIZEOF_EXPR) if (TREE_CODE (t) == SIZEOF_EXPR)
pp_cxx_identifier (cxx_pp, "sizeof"); pp_cxx_ws_string (cxx_pp, "sizeof");
else else
{ {
gcc_assert (TREE_CODE (t) == ALIGNOF_EXPR); gcc_assert (TREE_CODE (t) == ALIGNOF_EXPR);
pp_cxx_identifier (cxx_pp, "__alignof__"); pp_cxx_ws_string (cxx_pp, "__alignof__");
} }
pp_cxx_whitespace (cxx_pp); pp_cxx_whitespace (cxx_pp);
pp_cxx_left_paren (cxx_pp); pp_cxx_left_paren (cxx_pp);
...@@ -2071,13 +2072,13 @@ dump_expr (tree t, int flags) ...@@ -2071,13 +2072,13 @@ dump_expr (tree t, int flags)
case REALPART_EXPR: case REALPART_EXPR:
case IMAGPART_EXPR: case IMAGPART_EXPR:
pp_cxx_identifier (cxx_pp, operator_name_info[TREE_CODE (t)].name); pp_cxx_ws_string (cxx_pp, operator_name_info[TREE_CODE (t)].name);
pp_cxx_whitespace (cxx_pp); pp_cxx_whitespace (cxx_pp);
dump_expr (TREE_OPERAND (t, 0), flags); dump_expr (TREE_OPERAND (t, 0), flags);
break; break;
case DEFAULT_ARG: case DEFAULT_ARG:
pp_identifier (cxx_pp, "<unparsed>"); pp_string (cxx_pp, _("<unparsed>"));
break; break;
case TRY_CATCH_EXPR: case TRY_CATCH_EXPR:
...@@ -2223,7 +2224,7 @@ dump_expr (tree t, int flags) ...@@ -2223,7 +2224,7 @@ dump_expr (tree t, int flags)
pp_unsupported_tree (cxx_pp, t); pp_unsupported_tree (cxx_pp, t);
/* fall through to ERROR_MARK... */ /* fall through to ERROR_MARK... */
case ERROR_MARK: case ERROR_MARK:
pp_identifier (cxx_pp, "<expression error>"); pp_string (cxx_pp, _("<expression error>"));
break; break;
} }
} }
...@@ -2235,9 +2236,9 @@ dump_binary_op (const char *opstring, tree t, int flags) ...@@ -2235,9 +2236,9 @@ dump_binary_op (const char *opstring, tree t, int flags)
dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS); dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
pp_cxx_whitespace (cxx_pp); pp_cxx_whitespace (cxx_pp);
if (opstring) if (opstring)
pp_cxx_identifier (cxx_pp, opstring); pp_cxx_ws_string (cxx_pp, opstring);
else else
pp_identifier (cxx_pp, "<unknown operator>"); pp_string (cxx_pp, _("<unknown operator>"));
pp_cxx_whitespace (cxx_pp); pp_cxx_whitespace (cxx_pp);
dump_expr (TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS); dump_expr (TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
pp_cxx_right_paren (cxx_pp); pp_cxx_right_paren (cxx_pp);
...@@ -2248,7 +2249,7 @@ dump_unary_op (const char *opstring, tree t, int flags) ...@@ -2248,7 +2249,7 @@ dump_unary_op (const char *opstring, tree t, int flags)
{ {
if (flags & TFF_EXPR_IN_PARENS) if (flags & TFF_EXPR_IN_PARENS)
pp_cxx_left_paren (cxx_pp); pp_cxx_left_paren (cxx_pp);
pp_cxx_identifier (cxx_pp, opstring); pp_cxx_ws_string (cxx_pp, opstring);
dump_expr (TREE_OPERAND (t, 0), flags & ~TFF_EXPR_IN_PARENS); dump_expr (TREE_OPERAND (t, 0), flags & ~TFF_EXPR_IN_PARENS);
if (flags & TFF_EXPR_IN_PARENS) if (flags & TFF_EXPR_IN_PARENS)
pp_cxx_right_paren (cxx_pp); pp_cxx_right_paren (cxx_pp);
...@@ -2419,7 +2420,7 @@ static const char * ...@@ -2419,7 +2420,7 @@ static const char *
op_to_string (enum tree_code p) op_to_string (enum tree_code p)
{ {
tree id = operator_name_info[(int) p].identifier; tree id = operator_name_info[(int) p].identifier;
return id ? IDENTIFIER_POINTER (id) : "<unknown>"; return id ? IDENTIFIER_POINTER (id) : _("<unknown>");
} }
static const char * static const char *
...@@ -2439,7 +2440,7 @@ static const char * ...@@ -2439,7 +2440,7 @@ static const char *
assop_to_string (enum tree_code p) assop_to_string (enum tree_code p)
{ {
tree id = assignment_operator_name_info[(int) p].identifier; tree id = assignment_operator_name_info[(int) p].identifier;
return id ? IDENTIFIER_POINTER (id) : "{unknown}"; return id ? IDENTIFIER_POINTER (id) : _("{unknown}");
} }
static const char * static const char *
...@@ -2459,7 +2460,7 @@ args_to_string (tree p, int verbose) ...@@ -2459,7 +2460,7 @@ args_to_string (tree p, int verbose)
for (; p; p = TREE_CHAIN (p)) for (; p; p = TREE_CHAIN (p))
{ {
if (TREE_VALUE (p) == null_node) if (TREE_VALUE (p) == null_node)
pp_cxx_identifier (cxx_pp, "NULL"); pp_cxx_ws_string (cxx_pp, "NULL");
else else
dump_type (error_type (TREE_VALUE (p)), flags); dump_type (error_type (TREE_VALUE (p)), flags);
if (TREE_CHAIN (p)) if (TREE_CHAIN (p))
...@@ -2521,7 +2522,7 @@ cp_print_error_function (diagnostic_context *context, ...@@ -2521,7 +2522,7 @@ cp_print_error_function (diagnostic_context *context,
pp_base_set_prefix (context->printer, new_prefix); pp_base_set_prefix (context->printer, new_prefix);
if (current_function_decl == NULL) if (current_function_decl == NULL)
pp_base_string (context->printer, "At global scope:"); pp_base_string (context->printer, _("At global scope:"));
else else
{ {
tree fndecl, ao; tree fndecl, ao;
...@@ -2539,8 +2540,7 @@ cp_print_error_function (diagnostic_context *context, ...@@ -2539,8 +2540,7 @@ cp_print_error_function (diagnostic_context *context,
else else
fndecl = current_function_decl; fndecl = current_function_decl;
pp_printf (context->printer, "In %s %qs", pp_printf (context->printer, function_category (fndecl),
function_category (fndecl),
cxx_printable_name (fndecl, 2)); cxx_printable_name (fndecl, 2));
while (abstract_origin) while (abstract_origin)
...@@ -2591,18 +2591,18 @@ cp_print_error_function (diagnostic_context *context, ...@@ -2591,18 +2591,18 @@ cp_print_error_function (diagnostic_context *context,
{ {
if (flag_show_column && s.column != 0) if (flag_show_column && s.column != 0)
pp_printf (context->printer, pp_printf (context->printer,
" inlined from %qs at %s:%d:%d", _(" inlined from %qs at %s:%d:%d"),
cxx_printable_name (fndecl, 2), cxx_printable_name (fndecl, 2),
s.file, s.line, s.column); s.file, s.line, s.column);
else else
pp_printf (context->printer, pp_printf (context->printer,
" inlined from %qs at %s:%d", _(" inlined from %qs at %s:%d"),
cxx_printable_name (fndecl, 2), cxx_printable_name (fndecl, 2),
s.file, s.line); s.file, s.line);
} }
else else
pp_printf (context->printer, " inlined from %qs", pp_printf (context->printer, _(" inlined from %qs"),
cxx_printable_name (fndecl, 2)); cxx_printable_name (fndecl, 2));
} }
} }
...@@ -2616,25 +2616,26 @@ cp_print_error_function (diagnostic_context *context, ...@@ -2616,25 +2616,26 @@ cp_print_error_function (diagnostic_context *context,
} }
} }
/* Returns a description of FUNCTION using standard terminology. */ /* Returns a description of FUNCTION using standard terminology. The
result is a format string of the form "In CATEGORY %qs". */
static const char * static const char *
function_category (tree fn) function_category (tree fn)
{ {
if (DECL_FUNCTION_MEMBER_P (fn)) if (DECL_FUNCTION_MEMBER_P (fn))
{ {
if (DECL_STATIC_FUNCTION_P (fn)) if (DECL_STATIC_FUNCTION_P (fn))
return "static member function"; return _("In static member function %qs");
else if (DECL_COPY_CONSTRUCTOR_P (fn)) else if (DECL_COPY_CONSTRUCTOR_P (fn))
return "copy constructor"; return _("In copy constructor %qs");
else if (DECL_CONSTRUCTOR_P (fn)) else if (DECL_CONSTRUCTOR_P (fn))
return "constructor"; return _("In constructor %qs");
else if (DECL_DESTRUCTOR_P (fn)) else if (DECL_DESTRUCTOR_P (fn))
return "destructor"; return _("In destructor %qs");
else else
return "member function"; return _("In member function %qs");
} }
else else
return "function"; return _("In function %qs");
} }
/* Report the full context of a current template instantiation, /* Report the full context of a current template instantiation,
...@@ -2659,7 +2660,7 @@ print_instantiation_full_context (diagnostic_context *context) ...@@ -2659,7 +2660,7 @@ print_instantiation_full_context (diagnostic_context *context)
/* Avoid redundancy with the "In function" line. */; /* Avoid redundancy with the "In function" line. */;
else else
pp_verbatim (context->printer, pp_verbatim (context->printer,
"%s: In instantiation of %qs:\n", _("%s: In instantiation of %qs:\n"),
LOCATION_FILE (location), LOCATION_FILE (location),
decl_as_string (p->decl, decl_as_string (p->decl,
TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE)); TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE));
...@@ -2683,13 +2684,13 @@ print_instantiation_partial_context (diagnostic_context *context, ...@@ -2683,13 +2684,13 @@ print_instantiation_partial_context (diagnostic_context *context,
xloc = expand_location (loc); xloc = expand_location (loc);
if (t == NULL) if (t == NULL)
break; break;
pp_verbatim (context->printer, "%s:%d: instantiated from %qs\n", pp_verbatim (context->printer, _("%s:%d: instantiated from %qs\n"),
xloc.file, xloc.line, xloc.file, xloc.line,
decl_as_string (t->decl, decl_as_string (t->decl,
TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE)); TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE));
loc = t->locus; loc = t->locus;
} }
pp_verbatim (context->printer, "%s:%d: instantiated from here", pp_verbatim (context->printer, _("%s:%d: instantiated from here"),
xloc.file, xloc.line); xloc.file, xloc.line);
pp_base_newline (context->printer); pp_base_newline (context->printer);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment