re PR c++/31665 (%s substituted with "built-in"/"library" can't be properly translated)

cp/
2009-12-16  Shujing Zhao  <pearly.zhao@oracle.com>

        PR c++/31665
        * decl.c (duplicate_decls, grokdeclarator): Put the
        diagnostics in full sentences for easy translation and wrapped into
        G_().
        * typeck.c (build_x_unary_op): Likewise.

testsuite/
2009-12-16  Shujing Zhao  <pearly.zhao@oracle.com>

        * g++.old-deja/g++.brendan/misc6.C: Make expected dg-error strings
        explicit.

From-SVN: r155340
This commit is contained in:
Shujing Zhao 2009-12-18 08:50:24 +00:00 committed by Shujing Zhao
parent deb109b24d
commit 24ea727a64
5 changed files with 29 additions and 13 deletions

View File

@ -1,3 +1,10 @@
2009-12-18 Shujing Zhao <pearly.zhao@oracle.com>
PR c++/31665
* decl.c (duplicate_decls, grokdeclarator): Put the diagnostics in
full sentences for easy translation and wrapped into G_().
* typeck.c (build_x_unary_op): Likewise.
2009-12-17 Shujing Zhao <pearly.zhao@oracle.com>
* call.c (build_over_call, build_java_interface_fn_ref): Update

View File

@ -1180,9 +1180,10 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
bad choice of name. */
if (! TREE_PUBLIC (newdecl))
{
warning (OPT_Wshadow, "shadowing %s function %q#D",
DECL_BUILT_IN (olddecl) ? "built-in" : "library",
olddecl);
warning (OPT_Wshadow,
DECL_BUILT_IN (olddecl)
? G_("shadowing built-in function %q#D")
: G_("shadowing library function %q#D"), olddecl);
/* Discard the old built-in function. */
return NULL_TREE;
}
@ -1253,9 +1254,10 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
olddecl);
}
else
warning (OPT_Wshadow, "shadowing %s function %q#D",
DECL_BUILT_IN (olddecl) ? "built-in" : "library",
olddecl);
warning (OPT_Wshadow,
DECL_BUILT_IN (olddecl)
? G_("shadowing built-in function %q#D")
: G_("shadowing library function %q#D"), olddecl);
}
else
/* Discard the old built-in function. */
@ -8616,8 +8618,9 @@ grokdeclarator (const cp_declarator *declarator,
if (TREE_CODE (type) == FUNCTION_TYPE
&& cp_type_quals (type) != TYPE_UNQUALIFIED)
error ("cannot declare %s to qualified function type %qT",
declarator->kind == cdk_reference ? "reference" : "pointer",
error (declarator->kind == cdk_reference
? G_("cannot declare reference to qualified function type %qT")
: G_("cannot declare pointer to qualified function type %qT"),
type);
if (declarator->kind == cdk_reference)

View File

@ -4361,9 +4361,10 @@ build_x_unary_op (enum tree_code code, tree xarg, tsubst_flags_t complain)
tree fn = get_first_fn (xarg);
if (DECL_CONSTRUCTOR_P (fn) || DECL_DESTRUCTOR_P (fn))
{
const char *type =
(DECL_CONSTRUCTOR_P (fn) ? "constructor" : "destructor");
error ("taking address of %s %qE", type, xarg);
error (DECL_CONSTRUCTOR_P (fn)
? G_("taking address of constructor %qE")
: G_("taking address of destructor %qE"),
xarg);
return error_mark_node;
}
}

View File

@ -1,3 +1,8 @@
2009-12-18 Shujing Zhao <pearly.zhao@oracle.com>
* g++.old-deja/g++.brendan/misc6.C: Make expected dg-error strings
explicit.
2009-12-17 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/debug/dwarf2/const-1.c: Don't expect DW_AT_const_value,

View File

@ -4,6 +4,6 @@
inline int i;// { dg-error "" } .*
struct c { inline int i; };// { dg-error "" } .*
int foo (inline int i);// { dg-error "" } .*
inline class c; // { dg-error "" } inline
inline class c; // { dg-error "'inline' can only be specified for functions" } inline
inline typedef int t; // { dg-error "" } inline
class d { inline friend class c; }; // { dg-error "" } inline
class d { inline friend class c; }; // { dg-error "'inline' can only be specified for functions" } inline