diff options
author | Joseph Myers <joseph@codesourcery.com> | 2009-05-10 11:28:34 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2009-05-10 11:28:34 +0100 |
commit | f41c4af3d6936f7153b65c23ba80c81f7f8c518e (patch) | |
tree | a02bdc44763aa1057cf075a959ca0e50e4188797 /gcc/cp/tree.c | |
parent | 082b1749a179b056f33db0e6971ad1edeca17cdc (diff) | |
download | gcc-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/tree.c')
-rw-r--r-- | gcc/cp/tree.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index c95c11c..9cc767d 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1238,11 +1238,12 @@ build_overload (tree decl, tree chain) #define PRINT_RING_SIZE 4 -const char * -cxx_printable_name (tree decl, int v) +static const char * +cxx_printable_name_internal (tree decl, int v, bool translate) { static unsigned int uid_ring[PRINT_RING_SIZE]; static char *print_ring[PRINT_RING_SIZE]; + static bool trans_ring[PRINT_RING_SIZE]; static int ring_counter; int i; @@ -1250,11 +1251,11 @@ cxx_printable_name (tree decl, int v) if (v < 2 || TREE_CODE (decl) != FUNCTION_DECL || DECL_LANG_SPECIFIC (decl) == 0) - return lang_decl_name (decl, v); + return lang_decl_name (decl, v, translate); /* See if this print name is lying around. */ for (i = 0; i < PRINT_RING_SIZE; i++) - if (uid_ring[i] == DECL_UID (decl)) + if (uid_ring[i] == DECL_UID (decl) && translate == trans_ring[i]) /* yes, so return it. */ return print_ring[i]; @@ -1273,10 +1274,23 @@ cxx_printable_name (tree decl, int v) if (print_ring[ring_counter]) free (print_ring[ring_counter]); - print_ring[ring_counter] = xstrdup (lang_decl_name (decl, v)); + print_ring[ring_counter] = xstrdup (lang_decl_name (decl, v, translate)); uid_ring[ring_counter] = DECL_UID (decl); + trans_ring[ring_counter] = translate; return print_ring[ring_counter]; } + +const char * +cxx_printable_name (tree decl, int v) +{ + return cxx_printable_name_internal (decl, v, false); +} + +const char * +cxx_printable_name_translate (tree decl, int v) +{ + return cxx_printable_name_internal (decl, v, true); +} /* Build the FUNCTION_TYPE or METHOD_TYPE which may throw exceptions listed in RAISES. */ |