some more -Wformat-diag cleanup

Message ID e2b20b82-9d0f-d189-8d60-a29ad176a72a@gmail.com
State New
Headers show
Series
  • some more -Wformat-diag cleanup
Related show

Commit Message

Martin Sebor June 24, 2019, midnight
The attached patch cleans up a number of outstanding -Wformat-diag
instances.  I plan to commit it tomorrow.

With it applied, an x86_64-linux bootstrap shows just 79 unique
instances of the warning originating in 17 files.  49 of those are
in the Go front-end that Ian is already dealing with.  I will work
on the rest.

Martin

Comments

Jeff Law June 24, 2019, 3:23 p.m. | #1
On 6/23/19 6:00 PM, Martin Sebor wrote:
> The attached patch cleans up a number of outstanding -Wformat-diag

> instances.  I plan to commit it tomorrow.

> 

> With it applied, an x86_64-linux bootstrap shows just 79 unique

> instances of the warning originating in 17 files.  49 of those are

> in the Go front-end that Ian is already dealing with.  I will work

> on the rest.

> 

> Martin

> 

> gcc-wformat-diag-cleanup.diff

> 

> gcc/ada/ChangeLog:

> 

> 	* gcc-interface/utils.c (handle_nonnull_attribute): Quote attribute

> 	name.

> 

> gcc/c/ChangeLog:

> 

> 	* c-typeck.c (build_binary_op): Hyphenate floating-point.

> 

> gcc/testsuite/ChangeLog:

> 

> 	* gcc.dg/Wfloat-equal-1.c: Adjust text of expected diagnostic.

> 	* gcc.dg/misc-column.c: Ditto.

> 

> gcc/ChangeLog:

> 

> 	* tree-pretty-print.h: Remove unnecessary punctuation characters

> 	from a diagnostic.

> 	* tree-ssa.c (release_defs_bitset): Correct preprocessor conditional.

OK
jeff

Patch

gcc/ada/ChangeLog:

	* gcc-interface/utils.c (handle_nonnull_attribute): Quote attribute
	name.

gcc/c/ChangeLog:

	* c-typeck.c (build_binary_op): Hyphenate floating-point.

gcc/testsuite/ChangeLog:

	* gcc.dg/Wfloat-equal-1.c: Adjust text of expected diagnostic.
	* gcc.dg/misc-column.c: Ditto.

gcc/ChangeLog:

	* tree-pretty-print.h: Remove unnecessary punctuation characters
	from a diagnostic.
	* tree-ssa.c (release_defs_bitset): Correct preprocessor conditional.


Index: gcc/ada/gcc-interface/utils.c
===================================================================
--- gcc/ada/gcc-interface/utils.c	(revision 272575)
+++ gcc/ada/gcc-interface/utils.c	(working copy)
@@ -6234,7 +6234,8 @@  handle_nonnull_attribute (tree *node, tree ARG_UNU
 	  && (!TYPE_ATTRIBUTES (type)
 	      || !lookup_attribute ("type generic", TYPE_ATTRIBUTES (type))))
 	{
-	  error ("nonnull attribute without arguments on a non-prototype");
+	  error ("%qs attribute without arguments on a non-prototype",
+		 "nonnull");
 	  *no_add_attrs = true;
 	}
       return NULL_TREE;
@@ -6248,8 +6249,8 @@  handle_nonnull_attribute (tree *node, tree ARG_UNU
 
       if (!get_nonnull_operand (TREE_VALUE (args), &arg_num))
 	{
-	  error ("nonnull argument has invalid operand number (argument %lu)",
-		 (unsigned long) attr_arg_num);
+	  error ("%qs argument has invalid operand number (argument %lu)",
+		 "nonnull", (unsigned long) attr_arg_num);
 	  *no_add_attrs = true;
 	  return NULL_TREE;
 	}
@@ -6270,8 +6271,8 @@  handle_nonnull_attribute (tree *node, tree ARG_UNU
 	  if (!argument
 	      || TREE_CODE (argument) == VOID_TYPE)
 	    {
-	      error ("nonnull argument with out-of-range operand number "
-		     "(argument %lu, operand %lu)",
+	      error ("%qs argument with out-of-range operand number "
+		     "(argument %lu, operand %lu)", "nonnull",
 		     (unsigned long) attr_arg_num, (unsigned long) arg_num);
 	      *no_add_attrs = true;
 	      return NULL_TREE;
@@ -6279,8 +6280,8 @@  handle_nonnull_attribute (tree *node, tree ARG_UNU
 
 	  if (TREE_CODE (argument) != POINTER_TYPE)
 	    {
-	      error ("nonnull argument references non-pointer operand "
-		     "(argument %lu, operand %lu)",
+	      error ("%qs argument references non-pointer operand "
+		     "(argument %lu, operand %lu)", "nonnull",
 		   (unsigned long) attr_arg_num, (unsigned long) arg_num);
 	      *no_add_attrs = true;
 	      return NULL_TREE;
Index: gcc/c/c-typeck.c
===================================================================
--- gcc/c/c-typeck.c	(revision 272575)
+++ gcc/c/c-typeck.c	(working copy)
@@ -11939,7 +11939,7 @@  build_binary_op (location_t location, enum tree_co
       if (FLOAT_TYPE_P (type0) || FLOAT_TYPE_P (type1))
 	warning_at (location,
 		    OPT_Wfloat_equal,
-		    "comparing floating point with %<==%> or %<!=%> is unsafe");
+		    "comparing floating-point with %<==%> or %<!=%> is unsafe");
       /* Result of comparison is always int,
 	 but don't convert the args to int!  */
       build_type = integer_type_node;
Index: gcc/testsuite/gcc.dg/Wfloat-equal-1.c
===================================================================
--- gcc/testsuite/gcc.dg/Wfloat-equal-1.c	(revision 272575)
+++ gcc/testsuite/gcc.dg/Wfloat-equal-1.c	(working copy)
@@ -4,7 +4,7 @@ 
 
 double a, b;
 _Complex double c, d;
-int f(void) { return a == b; } /* { dg-warning "comparing floating point" } */
-int g(void) { return c == d; } /* { dg-warning "comparing floating point" } */
-int h(void) { return a != b; } /* { dg-warning "comparing floating point" } */
-int i(void) { return c != d; } /* { dg-warning "comparing floating point" } */
+int f(void) { return a == b; } /* { dg-warning "comparing floating-point" } */
+int g(void) { return c == d; } /* { dg-warning "comparing floating-point" } */
+int h(void) { return a != b; } /* { dg-warning "comparing floating-point" } */
+int i(void) { return c != d; } /* { dg-warning "comparing floating-point" } */
Index: gcc/testsuite/gcc.dg/misc-column.c
===================================================================
--- gcc/testsuite/gcc.dg/misc-column.c	(revision 272575)
+++ gcc/testsuite/gcc.dg/misc-column.c	(working copy)
@@ -13,7 +13,7 @@  extern void bar();
 
 void foo (void)
 {
-  if (a == b) /* { dg-warning "9:comparing floating point with" } */
+  if (a == b) /* { dg-warning "9:comparing floating-point with" } */
     bar ();
 
   if (p < q) /* { dg-warning "9:comparison of distinct pointer types" } */
Index: gcc/tree-pretty-print.h
===================================================================
--- gcc/tree-pretty-print.h	(revision 272575)
+++ gcc/tree-pretty-print.h	(working copy)
@@ -25,7 +25,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "pretty-print.h"
 
 #define pp_unsupported_tree(PP, T)                         \
-  pp_verbatim (PP, "#%qs not supported by %s#", \
+  pp_verbatim (PP, "%qs not supported by %s", \
 	       get_tree_code_name (TREE_CODE (T)), __FUNCTION__)
 
 #define pp_ti_abstract_origin(TI) ((tree *) (TI)->x_data)
Index: gcc/tree-ssa.c
===================================================================
--- gcc/tree-ssa.c	(revision 272575)
+++ gcc/tree-ssa.c	(working copy)
@@ -631,7 +631,7 @@  release_defs_bitset (bitmap toremove)
    the verification errors.  Their format strings don't follow GCC
    diagnostic conventions and the calls are ultimately followed by
    one to internal_error.  */
-#if __GNUC__ > 10
+#if __GNUC__ >= 10
 #  pragma GCC diagnostic push
 #  pragma GCC diagnostic ignored "-Wformat-diag"
 #endif