diff mbox

Ignore warning in string/tester.c.

Message ID 20150106164532.GA25118@domone
State Committed
Headers show

Commit Message

Ondrej Bilka Jan. 6, 2015, 4:45 p.m. UTC
On Mon, Dec 15, 2014 at 08:15:47PM +0100, Torvald Riegel wrote:
> This fixes a warning in a build using a fairly recent GCC.  AFAIK the
> warning/option is new and hasn't been offered by 4.9, hence the
> conditional.  OK?

I also got warning in debian gcc-4.9 so I commited following as obvious.

Comments

Joseph Myers Jan. 6, 2015, 5:20 p.m. UTC | #1
On Tue, 6 Jan 2015, Ondřej Bílka wrote:

> On Mon, Dec 15, 2014 at 08:15:47PM +0100, Torvald Riegel wrote:
> > This fixes a warning in a build using a fairly recent GCC.  AFAIK the
> > warning/option is new and hasn't been offered by 4.9, hence the
> > conditional.  OK?
> 
> I also got warning in debian gcc-4.9 so I commited following as obvious.

No, it's not obvious; as far as I can tell, the option is not in GCC 4.9 
branch, so resulting in

tester.c: In function 'test_memset':
tester.c:1311:3: error: unknown option after '#pragma GCC diagnostic' kind [-Werror=pragmas]
   DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmemset-transposed-args")
   ^
cc1: all warnings being treated as errors

and breaking the build.  Please revert the patch.  If distributions have 
backported this warning, a configure test will be needed to determine 
whether it can be suppressed.

> -  DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Wmemset-transposed-args")
> +  DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmemset-transposed-args")

That part of the change is also dubious - the version is the *most recent* 
version for which the diagnostic was observed, not the oldest, as it gives 
information about when the suppression should be reviewed.  (As explained 
in the comment on DIAG_IGNORE_NEEDS_COMMENT, it should however say 5 not 
5.0.)
Ondrej Bilka Jan. 6, 2015, 5:55 p.m. UTC | #2
On Tue, Jan 06, 2015 at 05:20:47PM +0000, Joseph Myers wrote:
> On Tue, 6 Jan 2015, Ondřej Bílka wrote:
> 
> > On Mon, Dec 15, 2014 at 08:15:47PM +0100, Torvald Riegel wrote:
> > > This fixes a warning in a build using a fairly recent GCC.  AFAIK the
> > > warning/option is new and hasn't been offered by 4.9, hence the
> > > conditional.  OK?
> > 
> > I also got warning in debian gcc-4.9 so I commited following as obvious.
> 
> No, it's not obvious; as far as I can tell, the option is not in GCC 4.9 
> branch, so resulting in
> 
> tester.c: In function 'test_memset':
> tester.c:1311:3: error: unknown option after '#pragma GCC diagnostic' kind [-Werror=pragmas]
>    DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmemset-transposed-args")
>    ^
> cc1: all warnings being treated as errors
> 
> and breaking the build.  Please revert the patch.  If distributions have 
> backported this warning, a configure test will be needed to determine 
> whether it can be suppressed.
> 
ok, however that is bad policy as you would need to add exception every
time some distribution decides to backport warning. I would rather
disable -Werror=pragmas.
diff mbox

Patch

diff --git a/ChangeLog b/ChangeLog
index 2edda5e..8f569ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@ 
 
 	* sysdeps/unix/sysv/linux/check_pf.c (make_request):
 	Clean up check_pf allocation pattern. addresses
+	* string/tester.c (test_memset): Suppress warning for gcc 4.9 
 
 2015-01-06  Adhemerval Zanella  <azanella@linux.vnet.ibm.com>
 
diff --git a/string/tester.c b/string/tester.c
index f957ed2..64dc056 100644
--- a/string/tester.c
+++ b/string/tester.c
@@ -1305,10 +1305,10 @@  test_memset (void)
   equal(one, "axxxefgh", 2);		/* Basic test. */
 
   DIAG_PUSH_NEEDS_COMMENT;
-#if __GNUC_PREREQ (5, 0)
-  /* GCC 5.0 warns about a zero-length memset because the arguments to memset
+#if __GNUC_PREREQ (4, 9)
+  /* GCC 4.9 warns about a zero-length memset because the arguments to memset
      may be in the wrong order.  But we really want to test this.  */
-  DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Wmemset-transposed-args")
+  DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmemset-transposed-args")
 #endif
   (void) memset(one+2, 'y', 0);
   equal(one, "axxxefgh", 3);		/* Zero-length set. */