This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH c++/31665] Move the fragments of conditional expressions to full sentences


Hi,
This patch is to move the English fragments to full sentences for easy translation. The %<...%> quotes are used where "%qs" has used before.
A related test case is adjust to add explicit dg-error strings.


Tested on i686-pc-linux-gnu.
Ok for trunk?

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

	PR c++/31665
	* decl.c (duplicate_decls, check_tag_decl, grokdeclarator): Put the
	diagnostics in full sentences for easy translation and wrapped into
	G_().
	* parser.c (cp_parser_check_class_key): Likewise.
	* 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.

Index: decl.c
===================================================================
--- decl.c	(revision 155282)
+++ decl.c	(working copy)
@@ -1180,9 +1180,10 @@ duplicate_decls (tree newdecl, tree oldd
 	     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 oldd
 			   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.  */
@@ -3934,9 +3936,9 @@ check_tag_decl (cp_decl_specifier_seq *d
     {
       if (declspecs->specs[(int)ds_inline]
 	  || declspecs->specs[(int)ds_virtual])
-	error ("%qs can only be specified for functions",
-	       declspecs->specs[(int)ds_inline]
-	       ? "inline" : "virtual");
+	error (declspecs->specs[(int)ds_inline]
+	       ? G_("%<inline%> can only be specified for functions")
+               : G_("%<virtual%> can only be specified for functions"));
       else if (saw_friend
 	       && (!current_class_type
 		   || current_scope () != current_class_type))
@@ -8619,8 +8621,9 @@ grokdeclarator (const cp_declarator *dec
 
 	  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)
Index: parser.c
===================================================================
--- parser.c	(revision 155282)
+++ parser.c	(working copy)
@@ -27,6 +27,7 @@ along with GCC; see the file COPYING3.  
 #include "varray.h"
 #include "cpplib.h"
 #include "tree.h"
+#include "intl.h"
 #include "cp-tree.h"
 #include "c-pragma.h"
 #include "decl.h"
@@ -19808,10 +19809,13 @@ static void
 cp_parser_check_class_key (enum tag_types class_key, tree type)
 {
   if ((TREE_CODE (type) == UNION_TYPE) != (class_key == union_type))
-    permerror (input_location, "%qs tag used in naming %q#T",
-	    class_key == union_type ? "union"
-	     : class_key == record_type ? "struct" : "class",
-	     type);
+    permerror (input_location, 
+               class_key == union_type
+               ? G_("%<union%> tag used in naming %q#T")
+               : class_key == record_type
+                 ? G_("%<struct%> tag used in naming %q#T")
+                 : G_("%<class%> tag used in naming %q#T"),
+	       type);
 }
 
 /* Issue an error message if DECL is redeclared with different
Index: typeck.c
===================================================================
--- typeck.c	(revision 155282)
+++ typeck.c	(working copy)
@@ -4337,9 +4337,10 @@ build_x_unary_op (enum tree_code code, t
 	  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;
 	    }
 	}
Index: g++.old-deja/g++.brendan/misc6.C
===================================================================
--- g++.old-deja/g++.brendan/misc6.C	(revision 155283)
+++ g++.old-deja/g++.brendan/misc6.C	(working copy)
@@ -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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]