S390: Fix build failure in test string/tst-endian.c with gcc 6.

Stefan Liebler stli@linux.vnet.ibm.com
Thu Jan 21 12:31:00 GMT 2016


Hi,

Building string/tst-endian.c with gcc 6 produces an build warning/error 
on s390:
gcc tst-endian.c -c -std=gnu11 -fgnu89-inline  -O2 or -O3 ...
tst-endian.c: In function ‘do_test’:
tst-endian.c:16:30: error: self-comparison always evaluates to false 
[-Werror=tautological-compare]
     if (htobe16 (be16toh (i)) != i)
                               ^~

tst-endian.c:48:30: error: self-comparison always evaluates to false 
[-Werror=tautological-compare]
     if (htobe32 (be32toh (i)) != i)
                               ^~

tst-endian.c:78:33: error: self-comparison always evaluates to false 
[-Werror=tautological-compare]
        if (htobe64 (be64toh (i)) != i)
                                  ^~

See definitions of htobexx, bexxtoh in string/endian.h:
# if __BYTE_ORDER == __LITTLE_ENDIAN
...
# else
#  define htobe16(x) (x)
#  define be16toh(x) (x)
#  define htobe32(x) (x)
#  define be32toh(x) (x)
#  define htobe64(x) (x)
#  define be64toh(x) (x)
# endif

This patch makes these if-statements conditional on __BYTE_ORDER == 
__LITTLE_ENDIAN.

Ok to commit?

Bye Stefan

ChangeLog:

	* string/tst-endian.c (do_test): Make htobexx( bexxtoh (i)) != i
	if-statements conditional on __BYTE_ORDER == __LITTLE_ENDIAN.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20160121_tst-endian_gcc6.patch
Type: text/x-patch
Size: 1343 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20160121/d2b96436/attachment.bin>


More information about the Libc-alpha mailing list