re PR c++/38761 (%s substituted with regular word can't be properly translated)

2011-10-19  Paolo Carlini  <paolo.carlini@oracle.com>

	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.

From-SVN: r180185
This commit is contained in:
Paolo Carlini 2011-10-19 12:46:42 +00:00 committed by Paolo Carlini
parent 7f9a3dcd7d
commit 9b6ab3c059
4 changed files with 40 additions and 24 deletions

View File

@ -1,3 +1,13 @@
2011-10-19 Paolo Carlini <paolo.carlini@oracle.com>
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 <jason@redhat.com>
PR c++/50531

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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 %<auto%> variable from containing function"
: "use of parameter from containing function");
? G_("use of %<auto%> variable from containing function")
: G_("use of parameter from containing function"));
error (" %q+#D declared here", decl);
return error_mark_node;
}