[PATCHv2] S390: Fix build failure in test string/tst-endian.c with gcc 6.
Stefan Liebler
stli@linux.vnet.ibm.com
Thu Jan 21 16:39:00 GMT 2016
On 01/21/2016 03:05 PM, Joseph Myers wrote:
> On Thu, 21 Jan 2016, Stefan Liebler wrote:
>
>> This patch makes these if-statements conditional on __BYTE_ORDER ==
>> __LITTLE_ENDIAN.
>
> I don't think that's the right fix.
>
> This test is verifying assertions that should be true for both
> endiannesses. It just so happens that some of those assertions can be
> verified at compile time in some cases, but they are still appropriate
> assertions for it to verify.
Agreed
> This is one of the cases where the nature of what is being tested requires
> doing something that GCC warns about. In such a case, rather than
> disabling the testing of those assertions, you should disable the warning
> (with DIAG_* macros if possible - if glibc supports building with GCC
> versions without the relevant -W option, they'll need to be appropriately
> conditional), with appropriate comments explaining the issue.
ok
This patch suppresses these warnings with DIAG_* macros.
The conditional #if __GNUC_PREREQ (6, 0) is needed, because an older gcc
would warn about:
tst-endian.c: In function ‘do_test’:
tst-endian.c:18:4: warning: unknown option after ‘#pragma GCC
diagnosticÂ’ kind [-Wpragmas]
DIAG_IGNORE_NEEDS_COMMENT (6, "-Wtautological-compare");
^
I've extended the patch in order to suppress those warnings on little
endian systems for "if (htoleXX (leXXtoh (i)) != i)", too.
Those macros are defined to (x) in string/endian.h for little endian
systems and produce the same warning.
Ok to commit?
Bye Stefan
ChangeLog:
* string/tst-endian.c: Include <libc-internal.h>
(do_test): Ignore tautological-compare warnings around
"htobeXX (beXXtoh (i)) != i" and
"htoleXX (leXXtoh (i)) != i" if-statements.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20160121_tst-endian_gcc6_v2.patch
Type: text/x-patch
Size: 2856 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20160121/ad9a269f/attachment.bin>
More information about the Libc-alpha
mailing list