Fix glibc testing with GCC 4.9 compiler
Commit Message
I was testing glibc on a machine with GCC 4.9.2 and the tests died due
to a warning in string/tester.c. This routine has a DIAG_IGNORE for
-Wmemset-transposed-args at GCC 5.0 and above but this warning is also
given by my GCC 4.9.2 compiler. This patch fixed the problem for me,
is it OK to check it in?
Steve Ellcey
sellcey@imgtec.com
2016-02-25 Steve Ellcey <sellcey@imgtec.com>
* string/tester.c (test_memset): Use -Wmemset-transposed-args for
GCC 4.9.
Comments
* Steve Ellcey:
> I was testing glibc on a machine with GCC 4.9.2 and the tests died due
> to a warning in string/tester.c. This routine has a DIAG_IGNORE for
> -Wmemset-transposed-args at GCC 5.0 and above but this warning is also
> given by my GCC 4.9.2 compiler. This patch fixed the problem for me,
> is it OK to check it in?
I think this breaks the build for everyone with a 4.9 compiler which
does not support -Wmemset-transposed-args. Wasn't this a
Debian-specific backport?
On Thu, 2016-02-25 at 17:49 +0100, Florian Weimer wrote:
> * Steve Ellcey:
>
> > I was testing glibc on a machine with GCC 4.9.2 and the tests died due
> > to a warning in string/tester.c. This routine has a DIAG_IGNORE for
> > -Wmemset-transposed-args at GCC 5.0 and above but this warning is also
> > given by my GCC 4.9.2 compiler. This patch fixed the problem for me,
> > is it OK to check it in?
>
> I think this breaks the build for everyone with a 4.9 compiler which
> does not support -Wmemset-transposed-args. Wasn't this a
> Debian-specific backport?
That is possible, I wasn't aware this was a backport. The compiler I
was using is on debian:
% gcc --version
gcc (Debian 4.9.2-10) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Steve Ellcey
sellcey@imgtec.com
* Steve Ellcey:
> On Thu, 2016-02-25 at 17:49 +0100, Florian Weimer wrote:
>> * Steve Ellcey:
>>
>> > I was testing glibc on a machine with GCC 4.9.2 and the tests died due
>> > to a warning in string/tester.c. This routine has a DIAG_IGNORE for
>> > -Wmemset-transposed-args at GCC 5.0 and above but this warning is also
>> > given by my GCC 4.9.2 compiler. This patch fixed the problem for me,
>> > is it OK to check it in?
>>
>> I think this breaks the build for everyone with a 4.9 compiler which
>> does not support -Wmemset-transposed-args. Wasn't this a
>> Debian-specific backport?
>
> That is possible, I wasn't aware this was a backport.
I looked agained, and yes, it's a backport.
I think this would need a configure check for detection because you
can't infer it from the reported compiler version.
On Thu, 25 Feb 2016, Steve Ellcey wrote:
> - DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Wmemset-transposed-args")
> + DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmemset-transposed-args")
Apart from the point that you can't change the __GNUC_PREREQ conditional,
reducing the version in DIAG_IGNORE_NEEDS_COMMENT is always incorrect.
The version there is the *most recent* version for which we know the
pragma was needed - that is, old versions there indicate that the pragma
should be revisited (in cases working around compiler warning bugs) when
that version is no longer supported for building glibc.
@@ -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. */