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

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


On 01/21/2016 02:11 PM, Andreas Schwab wrote:
> Stefan Liebler <stli@linux.vnet.ibm.com> writes:
>
>> diff --git a/string/tst-endian.c b/string/tst-endian.c
>> index 8684bb2..d093587 100644
>> --- a/string/tst-endian.c
>> +++ b/string/tst-endian.c
>> @@ -13,12 +13,14 @@ do_test (void)
>>       {
>>         if (i < UINT64_C (65536))
>>   	{
>> +#if __BYTE_ORDER == __LITTLE_ENDIAN
>>   	  if (htobe16 (be16toh (i)) != i)
>>   	    {
>>   	      printf ("htobe16 (be16toh (%" PRIx64 ")) == %" PRIx16 "\n",
>>   		      i, (uint16_t) htobe16 (be16toh (i)));
>>   	      result = 1;
>>   	    }
>> +#endif
>
> Does that also work when using if (__BYTE_ORDER == __LITTLE_ENDIAN)?
>
> Andreas.
>
No it does not work:
tst-endian.c: In function ‘do_test’:
tst-endian.c:17:65: error: self-comparison always evaluates to false 
[-Werror=tautological-compare]
     if (__BYTE_ORDER == __LITTLE_ENDIAN && htobe16 (be16toh (i)) != i)
                                                                  ^~

cc1: all warnings being treated as errors



More information about the Libc-alpha mailing list