aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/cxx-pretty-print.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2009-05-10 11:28:34 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2009-05-10 11:28:34 +0100
commitf41c4af3d6936f7153b65c23ba80c81f7f8c518e (patch)
treea02bdc44763aa1057cf075a959ca0e50e4188797 /gcc/cp/cxx-pretty-print.c
parent082b1749a179b056f33db0e6971ad1edeca17cdc (diff)
downloadgcc-f41c4af3d6936f7153b65c23ba80c81f7f8c518e.zip
gcc-f41c4af3d6936f7153b65c23ba80c81f7f8c518e.tar.gz
gcc-f41c4af3d6936f7153b65c23ba80c81f7f8c518e.tar.bz2
pretty-print.h (struct pretty_print_info): Add translate_identifiers.
* pretty-print.h (struct pretty_print_info): Add translate_identifiers. (pp_translate_identifiers): New. (pp_identifier): Only conditionally translate identifier to locale character set. * pretty-print.c (pp_construct): Set pp_translate_identifiers. (pp_base_tree_identifier): Only conditionally translate identifier to locale character set. * c-pretty-print.c (M_): Define. (pp_c_type_specifier, pp_c_primary_expression): Mark English fragments for conditional translation with M_. * tree-pretty-print.c (maybe_init_pretty_print): Disable identifier translation. cp: * call.c (name_as_c_string): Call type_as_string_translate. Translate identifiers to locale character set. * cp-tree.h (lang_decl_name): Update prototype. (type_as_string_translate, decl_as_string_translate, cxx_printable_name_translate): Declare. * cxx-pretty-print.c (M_): Define. (pp_cxx_unqualified_id, pp_cxx_canonical_template_parameter): Mark English fragments for conditional translation with M_. * decl.c (grokdeclarator): Translate identifiers to locale character set for diagnostics. * error.c (M_): Define. (dump_template_bindings, dump_type, dump_aggr_type, dump_type_prefix, dump_global_iord, dump_simple_decl, dump_decl, dump_function_decl, dump_template_parms, dump_expr, dump_binary_op, op_to_string, assop_to_string): Mark English fragments for conditional translation with M_. (type_as_string): Disable translation of identifiers. (type_as_string_translate): New. (expr_as_string): Disable translation of identifiers. (decl_as_string): Disable translation of identifiers. (decl_as_string_translate): New. (lang_decl_name): Add parameter translate. (args_to_string): Call type_as_string_translate. (cp_print_error_function): Call cxx_printable_name_translate. (print_instantiation_full_context, print_instantiation_partial_context): Call decl_as_string_translate. * parser.c (cp_lexer_get_preprocessor_token): Use %qE for identifier in diagnostic. * tree.c (cxx_printable_name): Change to cxx_printable_name_internal. Add parameter translate. (cxx_printable_name, cxx_printable_name_translate): New wrappers round cxx_printable_name_internal. objc: * objc-act.c: Include intl.h. (objc_lookup_protocol): Use complete sentences for diagnostics with %qE for identifiers and translating results of gen_type_name_0 to locale character set. (objc_check_decl, check_protocol_recursively, lookup_and_install_protocols, objc_build_string_object, objc_get_class_reference, objc_declare_alias, objc_declare_class, objc_get_class_ivars, error_with_ivar, check_duplicates, objc_finish_message_expr, objc_build_protocol_expr, objc_build_selector_expr, build_ivar_reference, objc_add_method, add_category, add_instance_variable, objc_is_public, check_methods, check_methods_accessible, check_protocol, start_class, finish_class, start_protocol, really_start_method, get_super_receiver, objc_lookup_ivar): Use %E and %qE for identifiers in diagnostics. Translate generated text to locale character set as needed. (check_protocol, check_protocols): Change name parameter to type tree. (lang_report_error_function): Remove. From-SVN: r147333
Diffstat (limited to 'gcc/cp/cxx-pretty-print.c')
-rw-r--r--gcc/cp/cxx-pretty-print.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c
index 2edffd3..b8732896 100644
--- a/gcc/cp/cxx-pretty-print.c
+++ b/gcc/cp/cxx-pretty-print.c
@@ -29,6 +29,10 @@ along with GCC; see the file COPYING3. If not see
#include "cp-tree.h"
#include "toplev.h"
+/* Translate if being used for diagnostics, but not for dump files or
+ __PRETTY_FUNCTION. */
+#define M_(msgid) (pp_translate_identifiers (pp) ? _(msgid) : (msgid))
+
static void pp_cxx_unqualified_id (cxx_pretty_printer *, tree);
static void pp_cxx_nested_name_specifier (cxx_pretty_printer *, tree);
static void pp_cxx_qualified_id (cxx_pretty_printer *, tree);
@@ -147,7 +151,7 @@ pp_cxx_unqualified_id (cxx_pretty_printer *pp, tree t)
switch (code)
{
case RESULT_DECL:
- pp_cxx_ws_string (pp, _("<return-value>"));
+ pp_cxx_ws_string (pp, M_("<return-value>"));
break;
case OVERLOAD:
@@ -166,7 +170,7 @@ pp_cxx_unqualified_id (cxx_pretty_printer *pp, tree t)
case IDENTIFIER_NODE:
if (t == NULL)
- pp_cxx_ws_string (pp, _("<unnamed>"));
+ pp_cxx_ws_string (pp, M_("<unnamed>"));
else if (IDENTIFIER_TYPENAME_P (t))
pp_cxx_conversion_function_id (pp, t);
else
@@ -2048,7 +2052,7 @@ pp_cxx_canonical_template_parameter (cxx_pretty_printer *pp, tree parm)
parm = TEMPLATE_TYPE_PARM_INDEX (parm);
pp_cxx_begin_template_argument_list (pp);
- pp_cxx_ws_string (pp, _("template-parameter-"));
+ pp_cxx_ws_string (pp, M_("template-parameter-"));
pp_wide_integer (pp, TEMPLATE_PARM_LEVEL (parm));
pp_minus (pp);
pp_wide_integer (pp, TEMPLATE_PARM_IDX (parm) + 1);