diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 402f5b56c34..375c808dc38 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,13 @@ +2011-10-19 Paolo Carlini + + PR c++/38761 + PR c++/40872 + * decl.c (duplicate_decls, make_typename_type, grokdeclarator): Use + G_() in error message strings to facilitate translation. + * semantics.c (finish_id_expression): Likewise. + * parser.c (cp_parser_nested_name_specifier_opt, + cp_parser_parameter_declaration): Likewise. + 2011-10-18 Jason Merrill PR c++/50531 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 4b5b6c81226..a21cf461aab 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -1542,8 +1542,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) error_at (DECL_SOURCE_LOCATION (newdecl), errmsg, newdecl); if (DECL_NAME (olddecl) != NULL_TREE) error ((DECL_INITIAL (olddecl) && namespace_bindings_p ()) - ? "%q+#D previously defined here" - : "%q+#D previously declared here", olddecl); + ? G_("%q+#D previously defined here") + : G_("%q+#D previously declared here"), olddecl); return error_mark_node; } else if (TREE_CODE (olddecl) == FUNCTION_DECL @@ -3236,8 +3236,8 @@ make_typename_type (tree context, tree name, enum tag_types tag_type, if (!t) { if (complain & tf_error) - error (want_template ? "no class template named %q#T in %q#T" - : "no type named %q#T in %q#T", name, context); + error (want_template ? G_("no class template named %q#T in %q#T") + : G_("no type named %q#T in %q#T"), name, context); return error_mark_node; } @@ -9143,13 +9143,13 @@ grokdeclarator (const cp_declarator *declarator, virtual. A constructor may not be static. */ if (staticp == 2) error ((flags == DTOR_FLAG) - ? "destructor cannot be static member function" - : "constructor cannot be static member function"); + ? G_("destructor cannot be static member function") + : G_("constructor cannot be static member function")); if (memfn_quals) { error ((flags == DTOR_FLAG) - ? "destructors may not be cv-qualified" - : "constructors may not be cv-qualified"); + ? G_("destructors may not be cv-qualified") + : G_("constructors may not be cv-qualified")); memfn_quals = TYPE_UNQUALIFIED; } @@ -9502,8 +9502,10 @@ grokdeclarator (const cp_declarator *declarator, && (!friendp || funcdef_flag)) { error (funcdef_flag - ? "cannot define member function %<%T::%s%> within %<%T%>" - : "cannot declare member function %<%T::%s%> within %<%T%>", + ? G_("cannot define member function %<%T::%s%> " + "within %<%T%>") + : G_("cannot declare member function %<%T::%s%> " + "within %<%T%>"), ctype, name, current_class_type); return error_mark_node; } @@ -10223,8 +10225,8 @@ grokdeclarator (const cp_declarator *declarator, || sfk == sfk_destructor) { error (funcdef_flag - ? "%qs defined in a non-class scope" - : "%qs declared in a non-class scope", name); + ? G_("%qs defined in a non-class scope") + : G_("%qs declared in a non-class scope"), name); sfk = sfk_none; } } diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index a237b870edb..8d138fb7b53 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -4752,8 +4752,8 @@ cp_parser_nested_name_specifier_opt (cp_parser *parser, && (TREE_CODE (TYPENAME_TYPE_FULLNAME (new_scope)) == TEMPLATE_ID_EXPR))) permerror (input_location, TYPE_P (new_scope) - ? "%qT is not a template" - : "%qD is not a template", + ? G_("%qT is not a template") + : G_("%qD is not a template"), new_scope); /* If it is a class scope, try to complete it; we are about to be looking up names inside the class. */ @@ -16810,17 +16810,20 @@ cp_parser_parameter_declaration (cp_parser *parser, if (id_declarator && id_declarator->kind == cdk_id) error_at (declarator_token_start->location, - template_parm_p - ? "template parameter pack %qD" - " cannot have a default argument" - : "parameter pack %qD cannot have a default argument", + template_parm_p + ? G_("template parameter pack %qD " + "cannot have a default argument") + : G_("parameter pack %qD cannot have " + "a default argument"), id_declarator->u.id.unqualified_name); else error_at (declarator_token_start->location, - template_parm_p - ? "template parameter pack cannot have a default argument" - : "parameter pack cannot have a default argument"); - + template_parm_p + ? G_("template parameter pack cannot have " + "a default argument") + : G_("parameter pack cannot have a " + "default argument")); + default_argument = NULL_TREE; } } diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 3e847fa5ce5..32024135a6d 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -34,6 +34,7 @@ along with GCC; see the file COPYING3. If not see #include "c-family/c-objc.h" #include "tree-inline.h" #include "tree-mudflap.h" +#include "intl.h" #include "toplev.h" #include "flags.h" #include "output.h" @@ -2985,8 +2986,8 @@ finish_id_expression (tree id_expression, else { error (TREE_CODE (decl) == VAR_DECL - ? "use of % variable from containing function" - : "use of parameter from containing function"); + ? G_("use of % variable from containing function") + : G_("use of parameter from containing function")); error (" %q+#D declared here", decl); return error_mark_node; }