[committed] Move -Wformat-signedness out of -Wformat=2 (PR c/65040)

Marek Polacek polacek@redhat.com
Fri Feb 27 14:27:00 GMT 2015


Many folks complained that -Wformat-signedness is overly pedantic, and especially
with -Werror it can cause a lot of needless pain.  This patch moves it ouf of
-Wformat=2.

Bootstrapped/regtested on x86_64-linux, applying to trunk.

2015-02-27  Marek Polacek  <polacek@redhat.com>

	PR c/65040
	* doc/invoke.texi: Update to reflect that -Wformat=2 doesn't enable
	-Wformat-signedness anymore.

	* c.opt (Wformat-signedness): Don't enable by -Wformat=2.

	* gcc.dg/pr65066.c: Use -Wformat -Wformat-signedness and not
	-Wformat=2.

diff --git gcc/c-family/c.opt gcc/c-family/c.opt
index fd00407..b3c8cee 100644
--- gcc/c-family/c.opt
+++ gcc/c-family/c.opt
@@ -456,7 +456,7 @@ C ObjC C++ ObjC++ Var(warn_format_security) Warning LangEnabledBy(C ObjC C++ Obj
 Warn about possible security problems with format functions
 
 Wformat-signedness
-C ObjC C++ ObjC++ Var(warn_format_signedness) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0)
+C ObjC C++ ObjC++ Var(warn_format_signedness) Warning
 Warn about sign differences with format functions
 
 Wformat-y2k
diff --git gcc/doc/invoke.texi gcc/doc/invoke.texi
index ef4cc75..b07eed0 100644
--- gcc/doc/invoke.texi
+++ gcc/doc/invoke.texi
@@ -3631,7 +3631,7 @@ The C standard specifies that zero-length formats are allowed.
 @opindex Wformat=2
 Enable @option{-Wformat} plus additional format checks.  Currently
 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
--Wformat-signedness -Wformat-y2k}.
+-Wformat-y2k}.
 
 @item -Wformat-nonliteral
 @opindex Wformat-nonliteral
diff --git gcc/testsuite/gcc.dg/pr65066.c gcc/testsuite/gcc.dg/pr65066.c
index 883a87d..291e97a 100644
--- gcc/testsuite/gcc.dg/pr65066.c
+++ gcc/testsuite/gcc.dg/pr65066.c
@@ -1,6 +1,6 @@
 /* PR c/65066 */
 /* { dg-do compile } */
-/* { dg-options "-Wformat=2" } */
+/* { dg-options "-Wformat -Wformat-signedness" } */
 
 extern int sscanf (const char *restrict, const char *restrict, ...);
 int *a;

	Marek



More information about the Gcc-patches mailing list