On 5/20/19 2:00 PM, Joseph Myers wrote:
Another couple of issues in the change as committed:

+       GCC_BAD ("%<malformed #pragma weak%>, ignored");

The word "malformed" should be outside the %<%>.

+Warn about GCC format strings with strings unsuitable for diagnostics..

This help text should end with one '.', not two.


Thanks.  The attached patch fixes that.  I'll commit it as obvious
unless your someone else has concerns/suggestions for changes.

Martin
gcc/c-family/ChangeLog:

	* c-pragma.c (handle_pragma_weak): Adjust quoting in a diagnostic.
	* c.opt (-Wformat-diag): Remove a spurious period.

gcc/testsuite/ChangeLog:

	* gcc.dg/weak/weak-19.c: New test.

Index: gcc/c-family/c-pragma.c
===================================================================
--- gcc/c-family/c-pragma.c	(revision 271441)
+++ gcc/c-family/c-pragma.c	(working copy)
@@ -361,7 +361,7 @@ handle_pragma_weak (cpp_reader * ARG_UNUSED (dummy
   if (t == CPP_EQ)
     {
       if (pragma_lex (&value) != CPP_NAME)
-	GCC_BAD ("%<malformed #pragma weak%>, ignored");
+	GCC_BAD ("malformed %<#pragma weak%>, ignored");
       t = pragma_lex (&x);
     }
   if (t != CPP_EOF)
Index: gcc/c-family/c.opt
===================================================================
--- gcc/c-family/c.opt	(revision 271441)
+++ gcc/c-family/c.opt	(working copy)
@@ -564,7 +564,7 @@ Warn about format strings that contain NUL bytes.
 
 Wformat-diag
 C ObjC C++ ObjC++ Var(warn_format_diag) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 1, 0)
-Warn about GCC format strings with strings unsuitable for diagnostics..
+Warn about GCC format strings with strings unsuitable for diagnostics.
 
 Wformat-extra-args
 C ObjC C++ ObjC++ Var(warn_format_extra_args) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 1, 0)
Index: gcc/testsuite/gcc.dg/weak/weak-19.c
===================================================================
--- gcc/testsuite/gcc.dg/weak/weak-19.c	(nonexistent)
+++ gcc/testsuite/gcc.dg/weak/weak-19.c	(working copy)
@@ -0,0 +1,8 @@
+/* { dg-do compile }
+   { dg-require-weak "" } */
+
+/* Verify that the following invalid pragmas are diagnosed.  */
+
+#pragma weak foo = 1   /* { dg-warning "malformed '#pragma weak'" } */
+#pragma weak foo = +   /* { dg-warning "malformed '#pragma weak'" } */
+#pragma weak foo = ?   /* { dg-warning "malformed '#pragma weak'" } */

Reply via email to