+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>
Roland McGrath <roland@redhat.com>
/* 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.
#include "insn-config.h"
#include "integrate.h"
#include "c-tree.h"
+#include "intl.h"
#include "c-pretty-print.h"
#include "function.h"
#include "flags.h"
{
tree t = va_arg (*text->args_ptr, tree);
tree name;
- const char *n = "({anonymous})";
c_pretty_printer *cpp = (c_pretty_printer *) pp;
pp->padding = pp_none;
case 'F':
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;
case 'T':
if (name && TREE_CODE (name) == TYPE_DECL)
{
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
pp_type_id (cpp, t);
return true;
case 'E':
if (TREE_CODE (t) == IDENTIFIER_NODE)
- n = IDENTIFIER_POINTER (t);
+ pp_identifier (cpp, IDENTIFIER_POINTER (t));
else
- {
- pp_expression (cpp, t);
- return true;
- }
- break;
+ pp_expression (cpp, t);
+ return true;
default:
return false;
}
- pp_string (cpp, n);
+ pp_string (cpp, _("({anonymous})"));
return true;
}
#include "tm.h"
#include "real.h"
#include "fixed-value.h"
+#include "intl.h"
#include "c-pretty-print.h"
#include "c-tree.h"
#include "tree-iterator.h"
logic in the C++ pretty-printer. */
if (p != NULL && (*p == '*' || *p == '&'))
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 )'. */
switch (code)
{
case ERROR_MARK:
- pp_c_identifier (pp, "<type-error>");
+ pp_c_ws_string (pp, _("<type-error>"));
break;
case IDENTIFIER_NODE:
{
case INTEGER_TYPE:
pp_string (pp, (TYPE_UNSIGNED (t)
- ? "<unnamed-unsigned:"
- : "<unnamed-signed:"));
+ ? _("<unnamed-unsigned:")
+ : _("<unnamed-signed:")));
break;
case REAL_TYPE:
- pp_string (pp, "<unnamed-float:");
+ pp_string (pp, _("<unnamed-float:"));
break;
case FIXED_POINT_TYPE:
- pp_string (pp, "<unnamed-fixed:");
+ pp_string (pp, _("<unnamed-fixed:"));
break;
default:
gcc_unreachable ();
if (DECL_NAME (t))
pp_id_expression (pp, t);
else
- pp_c_identifier (pp, "<typedef-error>");
+ pp_c_ws_string (pp, _("<typedef-error>"));
break;
case UNION_TYPE:
case RECORD_TYPE:
case ENUMERAL_TYPE:
if (code == UNION_TYPE)
- pp_c_identifier (pp, "union");
+ pp_c_ws_string (pp, "union");
else if (code == RECORD_TYPE)
- pp_c_identifier (pp, "struct");
+ pp_c_ws_string (pp, "struct");
else if (code == ENUMERAL_TYPE)
- pp_c_identifier (pp, "enum");
+ pp_c_ws_string (pp, "enum");
else
- pp_c_identifier (pp, "<tag-error>");
+ pp_c_ws_string (pp, _("<tag-error>"));
if (TYPE_NAME (t))
pp_id_expression (pp, TYPE_NAME (t));
else
- pp_c_identifier (pp, "<anonymous>");
+ pp_c_ws_string (pp, _("<anonymous>"));
break;
default:
case COMPLEX_TYPE:
pp_c_specifier_qualifier_list (pp, TREE_TYPE (t));
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)
- pp_c_identifier (pp, "__vector__");
+ pp_c_ws_string (pp, "__vector__");
break;
default:
tree parms = want_parm_decl ? DECL_ARGUMENTS (t) : TYPE_ARG_TYPES (t);
pp_c_left_paren (pp);
if (parms == void_list_node)
- pp_c_identifier (pp, "void");
+ pp_c_ws_string (pp, "void");
else
{
bool first = true;
pp_c_storage_class_specifier (c_pretty_printer *pp, tree t)
{
if (TREE_CODE (t) == TYPE_DECL)
- pp_c_identifier (pp, "typedef");
+ pp_c_ws_string (pp, "typedef");
else if (DECL_P (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)
- pp_c_identifier (pp, "static");
+ pp_c_ws_string (pp, "static");
}
}
pp_c_function_specifier (c_pretty_printer *pp, tree 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:
if (attributes == NULL_TREE)
return;
- pp_c_identifier (pp, "__attribute__");
+ pp_c_ws_string (pp, "__attribute__");
pp_c_left_paren (pp);
pp_c_left_paren (pp);
for (; attributes != NULL_TREE; attributes = TREE_CHAIN (attributes))
if (b == boolean_false_node)
{
if (c_dialect_cxx ())
- pp_c_identifier (pp, "false");
+ pp_c_ws_string (pp, "false");
else if (flag_isoc99)
- pp_c_identifier (pp, "_False");
+ pp_c_ws_string (pp, "_False");
else
pp_unsupported_tree (pp, b);
}
else if (b == boolean_true_node)
{
if (c_dialect_cxx ())
- pp_c_identifier (pp, "true");
+ pp_c_ws_string (pp, "true");
else if (flag_isoc99)
- pp_c_identifier (pp, "_True");
+ pp_c_ws_string (pp, "_True");
else
pp_unsupported_tree (pp, b);
}
}
}
-/* 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
pp_c_identifier (c_pretty_printer *pp, const char *id)
break;
case ERROR_MARK:
- pp_c_identifier (pp, "<erroneous-expression>");
+ pp_c_ws_string (pp, _("<erroneous-expression>"));
break;
case RESULT_DECL:
- pp_c_identifier (pp, "<return-value>");
+ pp_c_ws_string (pp, _("<return-value>"));
break;
case INTEGER_CST:
break;
case TARGET_EXPR:
- pp_c_identifier (pp, "__builtin_memcpy");
+ pp_c_ws_string (pp, "__builtin_memcpy");
pp_c_left_paren (pp);
pp_ampersand (pp);
pp_primary_expression (pp, TREE_OPERAND (e, 0));
case POSTINCREMENT_EXPR:
case POSTDECREMENT_EXPR:
pp_postfix_expression (pp, TREE_OPERAND (e, 0));
- pp_identifier (pp, code == POSTINCREMENT_EXPR ? "++" : "--");
+ pp_string (pp, code == POSTINCREMENT_EXPR ? "++" : "--");
break;
case ARRAY_REF:
}
case UNORDERED_EXPR:
- pp_c_identifier (pp, flag_isoc99
+ pp_c_ws_string (pp, flag_isoc99
? "isunordered"
: "__builtin_isunordered");
goto two_args_fun;
case ORDERED_EXPR:
- pp_c_identifier (pp, flag_isoc99
+ pp_c_ws_string (pp, flag_isoc99
? "!isunordered"
: "!__builtin_isunordered");
goto two_args_fun;
case UNLT_EXPR:
- pp_c_identifier (pp, flag_isoc99
+ pp_c_ws_string (pp, flag_isoc99
? "!isgreaterequal"
: "!__builtin_isgreaterequal");
goto two_args_fun;
case UNLE_EXPR:
- pp_c_identifier (pp, flag_isoc99
+ pp_c_ws_string (pp, flag_isoc99
? "!isgreater"
: "!__builtin_isgreater");
goto two_args_fun;
case UNGT_EXPR:
- pp_c_identifier (pp, flag_isoc99
+ pp_c_ws_string (pp, flag_isoc99
? "!islessequal"
: "!__builtin_islessequal");
goto two_args_fun;
case UNGE_EXPR:
- pp_c_identifier (pp, flag_isoc99
+ pp_c_ws_string (pp, flag_isoc99
? "!isless"
: "!__builtin_isless");
goto two_args_fun;
case UNEQ_EXPR:
- pp_c_identifier (pp, flag_isoc99
+ pp_c_ws_string (pp, flag_isoc99
? "!islessgreater"
: "!__builtin_islessgreater");
goto two_args_fun;
case LTGT_EXPR:
- pp_c_identifier (pp, flag_isoc99
+ pp_c_ws_string (pp, flag_isoc99
? "islessgreater"
: "__builtin_islessgreater");
goto two_args_fun;
break;
case ABS_EXPR:
- pp_c_identifier (pp, "__builtin_abs");
+ pp_c_ws_string (pp, "__builtin_abs");
pp_c_left_paren (pp);
pp_expression (pp, TREE_OPERAND (e, 0));
pp_c_right_paren (pp);
break;
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_assignment_expression (pp, TREE_OPERAND (e, 0));
pp_separate_with (pp, ',');
{
case PREINCREMENT_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));
break;
case REALPART_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_unary_expression (pp, TREE_OPERAND (e, 0));
break;
case RSHIFT_EXPR:
pp_c_shift_expression (pp, TREE_OPERAND (e, 0));
pp_c_whitespace (pp);
- pp_identifier (pp, code == LSHIFT_EXPR ? "<<" : ">>");
+ pp_string (pp, code == LSHIFT_EXPR ? "<<" : ">>");
pp_c_whitespace (pp);
pp_c_additive_expression (pp, TREE_OPERAND (e, 1));
break;
else if (code == GT_EXPR)
pp_greater (pp);
else if (code == LE_EXPR)
- pp_identifier (pp, "<=");
+ pp_string (pp, "<=");
else if (code == GE_EXPR)
- pp_identifier (pp, ">=");
+ pp_string (pp, ">=");
pp_c_whitespace (pp);
pp_c_shift_expression (pp, TREE_OPERAND (e, 1));
break;
case NE_EXPR:
pp_c_equality_expression (pp, TREE_OPERAND (e, 0));
pp_c_whitespace (pp);
- pp_identifier (pp, code == EQ_EXPR ? "==" : "!=");
+ pp_string (pp, code == EQ_EXPR ? "==" : "!=");
pp_c_whitespace (pp);
pp_c_relational_expression (pp, TREE_OPERAND (e, 1));
break;
{
pp_c_logical_and_expression (pp, TREE_OPERAND (e, 0));
pp_c_whitespace (pp);
- pp_identifier (pp, "&&");
+ pp_string (pp, "&&");
pp_c_whitespace (pp);
pp_c_inclusive_or_expression (pp, TREE_OPERAND (e, 1));
}
{
pp_c_logical_or_expression (pp, TREE_OPERAND (e, 0));
pp_c_whitespace (pp);
- pp_identifier (pp, "||");
+ pp_string (pp, "||");
pp_c_whitespace (pp);
pp_c_logical_and_expression (pp, TREE_OPERAND (e, 1));
}
/* 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>
This file is part of GCC.
void pp_c_init_declarator (c_pretty_printer *, tree);
void pp_c_constant (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_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>
PR c++/35652
/* 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>
This file is part of GCC.
#include "coretypes.h"
#include "tm.h"
#include "real.h"
+#include "intl.h"
#include "cxx-pretty-print.h"
#include "cp-tree.h"
#include "toplev.h"
static inline void
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));
}
switch (code)
{
case RESULT_DECL:
- pp_cxx_identifier (pp, "<return-value>");
+ pp_cxx_ws_string (pp, _("<return-value>"));
break;
case OVERLOAD:
case IDENTIFIER_NODE:
if (t == NULL)
- pp_cxx_identifier (pp, "<unnamed>");
+ pp_cxx_ws_string (pp, _("<unnamed>"));
else if (IDENTIFIER_TYPENAME_P (t))
pp_cxx_conversion_function_id (pp, t);
else
{
if (TREE_CODE (t) == TEMPLATE_ID_EXPR
&& TYPE_P (scope) && dependent_type_p (scope))
- pp_cxx_identifier (pp, "template");
+ pp_cxx_ws_string (pp, "template");
}
/* nested-name-specifier:
case REINTERPRET_CAST_EXPR:
case CONST_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)
- pp_cxx_identifier (pp, "static_cast");
+ pp_cxx_ws_string (pp, "static_cast");
else if (code == REINTERPRET_CAST_EXPR)
- pp_cxx_identifier (pp, "reinterpret_cast");
+ pp_cxx_ws_string (pp, "reinterpret_cast");
else
- pp_cxx_identifier (pp, "const_cast");
+ pp_cxx_ws_string (pp, "const_cast");
pp_cxx_begin_template_argument_list (pp);
pp_cxx_type_id (pp, TREE_TYPE (t));
pp_cxx_end_template_argument_list (pp);
case VEC_NEW_EXPR:
if (NEW_EXPR_USE_GLOBAL (t))
pp_cxx_colon_colon (pp);
- pp_cxx_identifier (pp, "new");
+ pp_cxx_ws_string (pp, "new");
if (TREE_OPERAND (t, 0))
{
pp_cxx_call_argument_list (pp, TREE_OPERAND (t, 0));
case VEC_DELETE_EXPR:
if (DELETE_EXPR_USE_GLOBAL (t))
pp_cxx_colon_colon (pp);
- pp_cxx_identifier (pp, "delete");
+ pp_cxx_ws_string (pp, "delete");
pp_space (pp);
if (code == VEC_DELETE_EXPR
|| DELETE_EXPR_USE_VEC (t))
case SIZEOF_EXPR:
if (PACK_EXPANSION_P (TREE_OPERAND (t, 0)))
{
- pp_cxx_identifier (pp, "sizeof");
- pp_cxx_identifier (pp, "...");
+ pp_cxx_ws_string (pp, "sizeof");
+ pp_cxx_ws_string (pp, "...");
pp_cxx_whitespace (pp);
pp_cxx_left_paren (pp);
if (TYPE_P (TREE_OPERAND (t, 0)))
/* Fall through */
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);
if (TYPE_P (TREE_OPERAND (t, 0)))
{
break;
}
- pp_cxx_identifier (pp, op);
+ pp_cxx_ws_string (pp, op);
}
break;
case THROW_EXPR:
- pp_cxx_identifier (pp, "throw");
+ pp_cxx_ws_string (pp, "throw");
if (TREE_OPERAND (e, 0))
pp_cxx_assignment_expression (pp, TREE_OPERAND (e, 0));
break;
case EXPR_PACK_EXPANSION:
pp_cxx_expression (pp, PACK_EXPANSION_PATTERN (t));
- pp_cxx_identifier (pp, "...");
+ pp_cxx_ws_string (pp, "...");
break;
case NONTYPE_ARGUMENT_PACK:
{
case FUNCTION_DECL:
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))
- pp_cxx_identifier (pp, "explicit");
+ pp_cxx_ws_string (pp, "explicit");
else
pp_c_function_specifier (pp_c_base (pp), t);
break;
case TYPE_DECL:
- pp_cxx_identifier (pp, "typedef");
+ pp_cxx_ws_string (pp, "typedef");
pp_cxx_decl_specifier_seq (pp, TREE_TYPE (t));
break;
break;
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_unqualified_id (pp, TYPE_NAME (t));
break;
break;
case DECLTYPE_TYPE:
- pp_cxx_identifier (pp, "decltype");
+ pp_cxx_ws_string (pp, "decltype");
pp_cxx_left_paren (pp);
pp_cxx_expression (pp, DECLTYPE_TYPE_EXPR (t));
pp_cxx_right_paren (pp);
if (!TYPE_NOTHROW_P (t) && ex_spec == NULL)
return;
- pp_cxx_identifier (pp, "throw");
+ pp_cxx_ws_string (pp, "throw");
pp_cxx_left_paren (pp);
for (; ex_spec && TREE_VALUE (ex_spec); ex_spec = TREE_CHAIN (ex_spec))
{
|| template_parameter_pack_p (t))
/* A function parameter pack or non-type template
parameter pack. */
- pp_cxx_identifier (pp, "...");
+ pp_cxx_ws_string (pp, "...");
pp_cxx_id_expression (pp, DECL_NAME (t));
}
pp_cxx_primary_expression (pp, purpose);
pp_cxx_call_argument_list (pp, TREE_VALUE (t));
if (is_pack)
- pp_cxx_identifier (pp, "...");
+ pp_cxx_ws_string (pp, "...");
if (TREE_CHAIN (t))
pp_cxx_separate_with (pp, ',');
}
case TYPE_PACK_EXPANSION:
pp_cxx_type_id (pp, PACK_EXPANSION_PATTERN (t));
- pp_cxx_identifier (pp, "...");
+ pp_cxx_ws_string (pp, "...");
break;
default:
break;
case USING_STMT:
- pp_cxx_identifier (pp, "using");
- pp_cxx_identifier (pp, "namespace");
+ pp_cxx_ws_string (pp, "using");
+ pp_cxx_ws_string (pp, "namespace");
if (DECL_CONTEXT (t))
pp_cxx_nested_name_specifier (pp, DECL_CONTEXT (t));
pp_cxx_qualified_id (pp, USING_STMT_NAMESPACE (t));
break;
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_unqualified_id (pp, DECL_NAME (t));
break;
try compound-statement handler-seq */
case TRY_BLOCK:
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_cxx_statement (pp, TRY_STMTS (t));
pp_newline_and_indent (pp, -3);
type-specifier-seq abstract-declarator
... */
case HANDLER:
- pp_cxx_identifier (pp, "catch");
+ pp_cxx_ws_string (pp, "catch");
pp_cxx_left_paren (pp);
pp_cxx_exception_declaration (pp, HANDLER_PARMS (t));
pp_cxx_right_paren (pp);
if ( expression ) statement
if ( expression ) statement else statement */
case IF_STMT:
- pp_cxx_identifier (pp, "if");
+ pp_cxx_ws_string (pp, "if");
pp_cxx_whitespace (pp);
pp_cxx_left_paren (pp);
pp_cxx_expression (pp, IF_COND (t));
if (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)
pp_cxx_whitespace (pp);
else
break;
case SWITCH_STMT:
- pp_cxx_identifier (pp, "switch");
+ pp_cxx_ws_string (pp, "switch");
pp_space (pp);
pp_cxx_left_paren (pp);
pp_cxx_expression (pp, SWITCH_STMT_COND (t));
for ( expression(opt) ; expression(opt) ; expression(opt) ) statement
for ( declaration expression(opt) ; expression(opt) ) statement */
case WHILE_STMT:
- pp_cxx_identifier (pp, "while");
+ pp_cxx_ws_string (pp, "while");
pp_space (pp);
pp_cxx_left_paren (pp);
pp_cxx_expression (pp, WHILE_COND (t));
break;
case DO_STMT:
- pp_cxx_identifier (pp, "do");
+ pp_cxx_ws_string (pp, "do");
pp_newline_and_indent (pp, 3);
pp_cxx_statement (pp, DO_BODY (t));
pp_newline_and_indent (pp, -3);
- pp_cxx_identifier (pp, "while");
+ pp_cxx_ws_string (pp, "while");
pp_space (pp);
pp_cxx_left_paren (pp);
pp_cxx_expression (pp, DO_COND (t));
break;
case FOR_STMT:
- pp_cxx_identifier (pp, "for");
+ pp_cxx_ws_string (pp, "for");
pp_space (pp);
pp_cxx_left_paren (pp);
if (FOR_INIT_STMT (t))
return expression(opt) ; */
case BREAK_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_needs_newline (pp) = true;
break;
break;
case CLEANUP_STMT:
- pp_cxx_identifier (pp, "try");
+ pp_cxx_ws_string (pp, "try");
pp_newline_and_indent (pp, 2);
pp_cxx_statement (pp, CLEANUP_BODY (t));
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_cxx_statement (pp, CLEANUP_EXPR (t));
pp_newline_and_indent (pp, -2);
static void
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))
pp_cxx_nested_name_specifier (pp, DECL_CONTEXT (t));
if (DECL_NAME (t))
static void
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))
pp_cxx_nested_name_specifier (pp, DECL_CONTEXT (t));
pp_cxx_unqualified_id (pp, t);
switch (TREE_CODE (parameter))
{
case TYPE_DECL:
- pp_cxx_identifier (pp, "class");
+ pp_cxx_ws_string (pp, "class");
if (TEMPLATE_TYPE_PARAMETER_PACK (TREE_TYPE (t)))
- pp_cxx_identifier (pp, "...");
+ pp_cxx_ws_string (pp, "...");
if (DECL_NAME (parameter))
pp_cxx_tree_identifier (pp, DECL_NAME (parameter));
/* FIXME: Check if we should print also default argument. */
parm = TEMPLATE_TYPE_PARM_INDEX (parm);
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_minus (pp);
pp_wide_integer (pp, TEMPLATE_PARM_IDX (parm) + 1);
pp_maybe_newline_and_indent (pp, 0);
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_template_parameter_list (pp, TREE_VALUE (level));
pp_cxx_end_template_argument_list (pp);
{
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_expression (pp, STATIC_ASSERT_CONDITION (t));
pp_cxx_separate_with (pp, ',');
pp_cxx_typeid_expression (cxx_pretty_printer *pp, tree t)
{
t = TREE_OPERAND (t, 0);
- pp_cxx_identifier (pp, "typeid");
+ pp_cxx_ws_string (pp, "typeid");
pp_cxx_left_paren (pp);
if (TYPE_P (t))
pp_cxx_type_id (pp, t);
void
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_assignment_expression (pp, TREE_OPERAND (t, 0));
pp_cxx_separate_with (pp, ',');
void
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);
if (!pp_cxx_offsetof_expression_1 (pp, TREE_OPERAND (t, 0)))
pp_cxx_expression (pp, TREE_OPERAND (t, 0));
switch (kind)
{
case CPTK_HAS_NOTHROW_ASSIGN:
- pp_cxx_identifier (pp, "__has_nothrow_assign");
+ pp_cxx_ws_string (pp, "__has_nothrow_assign");
break;
case CPTK_HAS_TRIVIAL_ASSIGN:
- pp_cxx_identifier (pp, "__has_trivial_assign");
+ pp_cxx_ws_string (pp, "__has_trivial_assign");
break;
case CPTK_HAS_NOTHROW_CONSTRUCTOR:
- pp_cxx_identifier (pp, "__has_nothrow_constructor");
+ pp_cxx_ws_string (pp, "__has_nothrow_constructor");
break;
case CPTK_HAS_TRIVIAL_CONSTRUCTOR:
- pp_cxx_identifier (pp, "__has_trivial_constructor");
+ pp_cxx_ws_string (pp, "__has_trivial_constructor");
break;
case CPTK_HAS_NOTHROW_COPY:
- pp_cxx_identifier (pp, "__has_nothrow_copy");
+ pp_cxx_ws_string (pp, "__has_nothrow_copy");
break;
case CPTK_HAS_TRIVIAL_COPY:
- pp_cxx_identifier (pp, "__has_trivial_copy");
+ pp_cxx_ws_string (pp, "__has_trivial_copy");
break;
case CPTK_HAS_TRIVIAL_DESTRUCTOR:
- pp_cxx_identifier (pp, "__has_trivial_destructor");
+ pp_cxx_ws_string (pp, "__has_trivial_destructor");
break;
case CPTK_HAS_VIRTUAL_DESTRUCTOR:
- pp_cxx_identifier (pp, "__has_virtual_destructor");
+ pp_cxx_ws_string (pp, "__has_virtual_destructor");
break;
case CPTK_IS_ABSTRACT:
- pp_cxx_identifier (pp, "__is_abstract");
+ pp_cxx_ws_string (pp, "__is_abstract");
break;
case CPTK_IS_BASE_OF:
- pp_cxx_identifier (pp, "__is_base_of");
+ pp_cxx_ws_string (pp, "__is_base_of");
break;
case CPTK_IS_CLASS:
- pp_cxx_identifier (pp, "__is_class");
+ pp_cxx_ws_string (pp, "__is_class");
break;
case CPTK_IS_CONVERTIBLE_TO:
- pp_cxx_identifier (pp, "__is_convertible_to");
+ pp_cxx_ws_string (pp, "__is_convertible_to");
break;
case CPTK_IS_EMPTY:
- pp_cxx_identifier (pp, "__is_empty");
+ pp_cxx_ws_string (pp, "__is_empty");
break;
case CPTK_IS_ENUM:
- pp_cxx_identifier (pp, "__is_enum");
+ pp_cxx_ws_string (pp, "__is_enum");
break;
case CPTK_IS_POD:
- pp_cxx_identifier (pp, "__is_pod");
+ pp_cxx_ws_string (pp, "__is_pod");
break;
case CPTK_IS_POLYMORPHIC:
- pp_cxx_identifier (pp, "__is_polymorphic");
+ pp_cxx_ws_string (pp, "__is_polymorphic");
break;
case CPTK_IS_UNION:
- pp_cxx_identifier (pp, "__is_union");
+ pp_cxx_ws_string (pp, "__is_union");
break;
default:
/* 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>
This file is part of GCC.
#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_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_tree_identifier(PP, T) \
pp_c_tree_identifier (pp_c_base (PP), T)
#include "flags.h"
#include "diagnostic.h"
#include "langhooks-def.h"
+#include "intl.h"
#include "cxx-pretty-print.h"
#include "pointer-set.h"
{
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)))
- pp_cxx_identifier (cxx_pp, "...");
+ pp_cxx_ws_string (cxx_pp, "...");
if (DECL_NAME (p))
pp_cxx_tree_identifier (cxx_pp, DECL_NAME (p));
}
if (arg)
dump_template_argument (arg, TFF_PLAIN_IDENTIFIER);
else
- pp_identifier (cxx_pp, "<missing>");
+ pp_string (cxx_pp, _("<missing>"));
++arg_idx;
need_comma = 1;
{
case UNKNOWN_TYPE:
if (t == init_list_type_node)
- pp_identifier (cxx_pp, "<brace-enclosed initializer list>");
+ pp_string (cxx_pp, _("<brace-enclosed initializer list>"));
else
- pp_identifier (cxx_pp, "<unresolved overloaded function type>");
+ pp_string (cxx_pp, _("<unresolved overloaded function type>"));
break;
case TREE_LIST:
break;
}
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_CLASS_P (t) ? "class"
: "typename");
case UNBOUND_CLASS_TEMPLATE:
dump_type (TYPE_CONTEXT (t), flags);
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);
break;
case TYPEOF_TYPE:
- pp_cxx_identifier (cxx_pp, "__typeof__");
+ pp_cxx_ws_string (cxx_pp, "__typeof__");
pp_cxx_whitespace (cxx_pp);
pp_cxx_left_paren (cxx_pp);
dump_expr (TYPEOF_TYPE_EXPR (t), flags & ~TFF_EXPR_IN_PARENS);
case TYPE_PACK_EXPANSION:
dump_type (PACK_EXPANSION_PATTERN (t), flags);
- pp_cxx_identifier (cxx_pp, "...");
+ pp_cxx_ws_string (cxx_pp, "...");
break;
case TYPE_ARGUMENT_PACK:
break;
case DECLTYPE_TYPE:
- pp_cxx_identifier (cxx_pp, "decltype");
+ pp_cxx_ws_string (cxx_pp, "decltype");
pp_cxx_whitespace (cxx_pp);
pp_cxx_left_paren (cxx_pp);
dump_expr (DECLTYPE_TYPE_EXPR (t), flags & ~TFF_EXPR_IN_PARENS);
/* Fall through to error. */
case ERROR_MARK:
- pp_identifier (cxx_pp, "<type error>");
+ pp_string (cxx_pp, _("<type error>"));
break;
}
}
pp_cxx_cv_qualifier_seq (cxx_pp, t);
if (flags & TFF_CLASS_KEY_OR_ENUM)
- pp_cxx_identifier (cxx_pp, variety);
+ pp_cxx_ws_string (cxx_pp, variety);
name = TYPE_NAME (t);
if (name == 0 || ANON_AGGRNAME_P (name))
{
if (flags & TFF_CLASS_KEY_OR_ENUM)
- pp_identifier (cxx_pp, "<anonymous>");
+ pp_string (cxx_pp, _("<anonymous>"));
else
- pp_printf (pp_base (cxx_pp), "<anonymous %s>", variety);
+ pp_printf (pp_base (cxx_pp), _("<anonymous %s>"), variety);
}
else
pp_cxx_tree_identifier (cxx_pp, name);
pp_unsupported_tree (cxx_pp, t);
/* fall through. */
case ERROR_MARK:
- pp_identifier (cxx_pp, "<typeprefixerror>");
+ pp_string (cxx_pp, _("<typeprefixerror>"));
break;
}
}
const char *p = NULL;
if (DECL_GLOBAL_CTOR_P (t))
- p = "initializers";
+ p = _("(static initializers for %s)");
else if (DECL_GLOBAL_DTOR_P (t))
- p = "destructors";
+ p = _("(static destructors for %s)");
else
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
if ((flags & TFF_DECL_SPECIFIERS)
&& DECL_TEMPLATE_PARM_P (t)
&& TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (t)))
- pp_identifier (cxx_pp, "...");
+ pp_string (cxx_pp, "...");
if (DECL_NAME (t))
dump_decl (DECL_NAME (t), flags);
else
- pp_identifier (cxx_pp, "<anonymous>");
+ pp_string (cxx_pp, _("<anonymous>"));
if (flags & TFF_DECL_SPECIFIERS)
dump_type_suffix (type, flags);
}
&& TREE_CODE (TREE_TYPE (t)) == TEMPLATE_TYPE_PARM)
{
/* 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. */
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);
break;
}
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)
? DECL_ORIGINAL_TYPE (t) : TREE_TYPE (t),
flags);
case VAR_DECL:
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)));
dump_type (DECL_CONTEXT (t), flags);
break;
break;
case RESULT_DECL:
- pp_string (cxx_pp, "<return value> ");
+ pp_string (cxx_pp, _("<return value> "));
dump_simple_decl (t, TREE_TYPE (t), flags);
break;
dump_scope (CP_DECL_CONTEXT (t), flags);
flags &= ~TFF_UNQUALIFIED_NAME;
if (DECL_NAME (t) == NULL_TREE)
- pp_identifier (cxx_pp, "<unnamed>");
+ pp_string (cxx_pp, _("<unnamed>"));
else
pp_cxx_tree_identifier (cxx_pp, DECL_NAME (t));
}
case IDENTIFIER_NODE:
if (IDENTIFIER_TYPENAME_P (t))
{
- pp_cxx_identifier (cxx_pp, "operator");
+ pp_cxx_ws_string (cxx_pp, "operator");
/* Not exactly IDENTIFIER_TYPE_VALUE. */
dump_type (TREE_TYPE (t), flags);
break;
case FUNCTION_DECL:
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))
dump_global_iord (t);
else
else if (DECL_INITIAL (t))
dump_expr (DECL_INITIAL (t), flags | TFF_EXPR_IN_PARENS);
else
- pp_identifier (cxx_pp, "<enumerator>");
+ pp_string (cxx_pp, _("<enumerator>"));
break;
case USING_DECL:
- pp_cxx_identifier (cxx_pp, "using");
+ pp_cxx_ws_string (cxx_pp, "using");
dump_type (USING_DECL_SCOPE (t), flags);
pp_cxx_colon_colon (cxx_pp);
dump_decl (DECL_NAME (t), flags);
/* Fall through to error. */
case ERROR_MARK:
- pp_identifier (cxx_pp, "<declaration error>");
+ pp_string (cxx_pp, _("<declaration error>"));
break;
}
}
tree inner_parms = INNERMOST_TEMPLATE_PARMS (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);
/* If we've shown the template prefix, we'd better show the
if (DECL_TEMPLATE_TEMPLATE_PARM_P (t))
{
/* 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 (TEMPLATE_TYPE_PARAMETER_PACK (TREE_TYPE (t)))
- pp_cxx_identifier (cxx_pp, "...");
+ pp_cxx_ws_string (cxx_pp, "...");
}
}
if (!(flags & TFF_DECL_SPECIFIERS))
/* OK */;
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))
- pp_cxx_identifier (cxx_pp, "virtual");
+ pp_cxx_ws_string (cxx_pp, "virtual");
/* Print the return type? */
if (show_return)
{
pp_cxx_whitespace (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);
dump_template_bindings (template_parms, template_args, typenames);
pp_cxx_right_bracket (cxx_pp);
first = 0;
if (!parmtypes)
{
- pp_cxx_identifier (cxx_pp, "...");
+ pp_cxx_ws_string (cxx_pp, "...");
break;
}
{
if (t)
{
- pp_cxx_identifier (cxx_pp, "throw");
+ pp_cxx_ws_string (cxx_pp, "throw");
pp_cxx_whitespace (cxx_pp);
pp_cxx_left_paren (cxx_pp);
if (TREE_VALUE (t) != NULL_TREE)
declarations, both will have the same name, yet
the types will be different, hence the TREE_TYPE field
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);
}
else if (IDENTIFIER_OPNAME_P (name))
pp_separate_with_comma (cxx_pp);
if (!arg)
- pp_identifier (cxx_pp, "<template parameter error>");
+ pp_string (cxx_pp, _("<template parameter error>"));
else
dump_template_argument (arg, flags);
}
if (TREE_VEC_ELT (parms, ix) == error_mark_node)
{
- pp_identifier (cxx_pp, "<template parameter error>");
+ pp_string (cxx_pp, _("<template parameter error>"));
continue;
}
if (STATEMENT_CLASS_P (t))
{
- pp_cxx_identifier (cxx_pp, "<statement>");
+ pp_cxx_ws_string (cxx_pp, _("<statement>"));
return;
}
case THROW_EXPR:
/* While waiting for caret diagnostics, avoid printing
__cxa_allocate_exception, __cxa_throw, and the like. */
- pp_cxx_identifier (cxx_pp, "<throw-expression>");
+ pp_cxx_ws_string (cxx_pp, _("<throw-expression>"));
break;
case PTRMEM_CST:
case SAVE_EXPR:
if (TREE_HAS_CONSTRUCTOR (t))
{
- pp_cxx_identifier (cxx_pp, "new");
+ pp_cxx_ws_string (cxx_pp, "new");
pp_cxx_whitespace (cxx_pp);
dump_type (TREE_TYPE (TREE_TYPE (t)), flags);
}
case POSTINCREMENT_EXPR:
pp_cxx_left_paren (cxx_pp);
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);
break;
break;
case STATIC_CAST_EXPR:
- pp_cxx_identifier (cxx_pp, "static_cast");
+ pp_cxx_ws_string (cxx_pp, "static_cast");
goto cast;
case REINTERPRET_CAST_EXPR:
- pp_cxx_identifier (cxx_pp, "reinterpret_cast");
+ pp_cxx_ws_string (cxx_pp, "reinterpret_cast");
goto cast;
case CONST_CAST_EXPR:
- pp_cxx_identifier (cxx_pp, "const_cast");
+ pp_cxx_ws_string (cxx_pp, "const_cast");
goto cast;
case DYNAMIC_CAST_EXPR:
- pp_cxx_identifier (cxx_pp, "dynamic_cast");
+ pp_cxx_ws_string (cxx_pp, "dynamic_cast");
cast:
pp_cxx_begin_template_argument_list (cxx_pp);
dump_type (TREE_TYPE (t), flags);
case SIZEOF_EXPR:
case ALIGNOF_EXPR:
if (TREE_CODE (t) == SIZEOF_EXPR)
- pp_cxx_identifier (cxx_pp, "sizeof");
+ pp_cxx_ws_string (cxx_pp, "sizeof");
else
{
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_left_paren (cxx_pp);
case REALPART_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);
dump_expr (TREE_OPERAND (t, 0), flags);
break;
case DEFAULT_ARG:
- pp_identifier (cxx_pp, "<unparsed>");
+ pp_string (cxx_pp, _("<unparsed>"));
break;
case TRY_CATCH_EXPR:
pp_unsupported_tree (cxx_pp, t);
/* fall through to ERROR_MARK... */
case ERROR_MARK:
- pp_identifier (cxx_pp, "<expression error>");
+ pp_string (cxx_pp, _("<expression error>"));
break;
}
}
dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
pp_cxx_whitespace (cxx_pp);
if (opstring)
- pp_cxx_identifier (cxx_pp, opstring);
+ pp_cxx_ws_string (cxx_pp, opstring);
else
- pp_identifier (cxx_pp, "<unknown operator>");
+ pp_string (cxx_pp, _("<unknown operator>"));
pp_cxx_whitespace (cxx_pp);
dump_expr (TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
pp_cxx_right_paren (cxx_pp);
{
if (flags & TFF_EXPR_IN_PARENS)
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);
if (flags & TFF_EXPR_IN_PARENS)
pp_cxx_right_paren (cxx_pp);
op_to_string (enum tree_code p)
{
tree id = operator_name_info[(int) p].identifier;
- return id ? IDENTIFIER_POINTER (id) : "<unknown>";
+ return id ? IDENTIFIER_POINTER (id) : _("<unknown>");
}
static const char *
assop_to_string (enum tree_code p)
{
tree id = assignment_operator_name_info[(int) p].identifier;
- return id ? IDENTIFIER_POINTER (id) : "{unknown}";
+ return id ? IDENTIFIER_POINTER (id) : _("{unknown}");
}
static const char *
for (; p; p = TREE_CHAIN (p))
{
if (TREE_VALUE (p) == null_node)
- pp_cxx_identifier (cxx_pp, "NULL");
+ pp_cxx_ws_string (cxx_pp, "NULL");
else
dump_type (error_type (TREE_VALUE (p)), flags);
if (TREE_CHAIN (p))
pp_base_set_prefix (context->printer, new_prefix);
if (current_function_decl == NULL)
- pp_base_string (context->printer, "At global scope:");
+ pp_base_string (context->printer, _("At global scope:"));
else
{
tree fndecl, ao;
else
fndecl = current_function_decl;
- pp_printf (context->printer, "In %s %qs",
- function_category (fndecl),
+ pp_printf (context->printer, function_category (fndecl),
cxx_printable_name (fndecl, 2));
while (abstract_origin)
{
if (flag_show_column && s.column != 0)
pp_printf (context->printer,
- " inlined from %qs at %s:%d:%d",
+ _(" inlined from %qs at %s:%d:%d"),
cxx_printable_name (fndecl, 2),
s.file, s.line, s.column);
else
pp_printf (context->printer,
- " inlined from %qs at %s:%d",
+ _(" inlined from %qs at %s:%d"),
cxx_printable_name (fndecl, 2),
s.file, s.line);
}
else
- pp_printf (context->printer, " inlined from %qs",
+ pp_printf (context->printer, _(" inlined from %qs"),
cxx_printable_name (fndecl, 2));
}
}
}
}
-/* 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 *
function_category (tree fn)
{
if (DECL_FUNCTION_MEMBER_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))
- return "copy constructor";
+ return _("In copy constructor %qs");
else if (DECL_CONSTRUCTOR_P (fn))
- return "constructor";
+ return _("In constructor %qs");
else if (DECL_DESTRUCTOR_P (fn))
- return "destructor";
+ return _("In destructor %qs");
else
- return "member function";
+ return _("In member function %qs");
}
else
- return "function";
+ return _("In function %qs");
}
/* Report the full context of a current template instantiation,
/* Avoid redundancy with the "In function" line. */;
else
pp_verbatim (context->printer,
- "%s: In instantiation of %qs:\n",
+ _("%s: In instantiation of %qs:\n"),
LOCATION_FILE (location),
decl_as_string (p->decl,
TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE));
xloc = expand_location (loc);
if (t == NULL)
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,
decl_as_string (t->decl,
TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE));
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);
pp_base_newline (context->printer);
}