From patchwork Thu Jan 21 12:30:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 10501 Received: (qmail 40953 invoked by alias); 21 Jan 2016 12:31:05 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 40932 invoked by uid 89); 21 Jan 2016 12:31:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=1314, 7512, 4512, 45, 12 X-HELO: plane.gmane.org To: libc-alpha@sourceware.org From: Stefan Liebler Subject: S390: Fix build failure in test string/tst-endian.c with gcc 6. Date: Thu, 21 Jan 2016 13:30:48 +0100 Lines: 108 Message-ID: Mime-Version: 1.0 X-Mozilla-News-Host: news://news.gmane.org:119 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 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. 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 if (htole16 (le16toh (i)) != i) { printf ("htole16 (le16toh (%" PRIx64 ")) == %" PRIx16 "\n", @@ -45,12 +47,14 @@ do_test (void) if (i < UINT64_C (4294967296)) { +#if __BYTE_ORDER == __LITTLE_ENDIAN if (htobe32 (be32toh (i)) != i) { printf ("htobe32 (be32toh (%" PRIx64 ")) == %" PRIx32 "\n", i, (uint32_t) htobe32 (be32toh (i))); result = 1; } +#endif if (htole32 (le32toh (i)) != i) { printf ("htole32 (le32toh (%" PRIx64 ")) == %" PRIx32 "\n", @@ -75,12 +79,14 @@ do_test (void) } } +#if __BYTE_ORDER == __LITTLE_ENDIAN if (htobe64 (be64toh (i)) != i) { printf ("htobe64 (be64toh (%" PRIx64 ")) == %" PRIx64 "\n", i, htobe64 (be64toh (i))); result = 1; } +#endif if (htole64 (le64toh (i)) != i) { printf ("htole64 (le64toh (%" PRIx64 ")) == %" PRIx64 "\n",