From 24ea727a641c58ddf03111c1bdcc2565330870c9 Mon Sep 17 00:00:00 2001 From: Shujing Zhao Date: Fri, 18 Dec 2009 08:50:24 +0000 Subject: re PR c++/31665 (%s substituted with "built-in"/"library" can't be properly translated) cp/ 2009-12-16 Shujing Zhao 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 * g++.old-deja/g++.brendan/misc6.C: Make expected dg-error strings explicit. From-SVN: r155340 --- gcc/cp/ChangeLog | 7 +++++++ gcc/cp/decl.c | 19 +++++++++++-------- gcc/cp/typeck.c | 7 ++++--- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.old-deja/g++.brendan/misc6.C | 4 ++-- 5 files changed, 29 insertions(+), 13 deletions(-) (limited to 'gcc') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 43e7106..1b7411b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2009-12-18 Shujing Zhao + + 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 * call.c (build_over_call, build_java_interface_fn_ref): Update diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index a83d39f..3c9649d 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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) diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 2a036e3..e001a07 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -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; } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ace164a..7e55a57 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-12-18 Shujing Zhao + + * g++.old-deja/g++.brendan/misc6.C: Make expected dg-error strings + explicit. + 2009-12-17 Jakub Jelinek * gcc.dg/debug/dwarf2/const-1.c: Don't expect DW_AT_const_value, diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/misc6.C b/gcc/testsuite/g++.old-deja/g++.brendan/misc6.C index 1738f65..93b241b 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/misc6.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/misc6.C @@ -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 -- cgit v1.1