From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12337 Path: news.gmane.org!.POSTED!not-for-mail From: Patrick Cheng Newsgroups: gmane.linux.lib.musl.general Subject: [Patch] reduced warnings reported by clang Date: Tue, 09 Jan 2018 16:48:02 +0000 Message-ID: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a11472d26434ad105625aae69" X-Trace: blaine.gmane.org 1515516467 22792 195.159.176.226 (9 Jan 2018 16:47:47 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 9 Jan 2018 16:47:47 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-12353-gllmg-musl=m.gmane.org@lists.openwall.com Tue Jan 09 17:47:43 2018 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1eYx3p-0005Gd-JP for gllmg-musl@m.gmane.org; Tue, 09 Jan 2018 17:47:37 +0100 Original-Received: (qmail 7463 invoked by uid 550); 9 Jan 2018 16:48:26 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 7378 invoked from network); 9 Jan 2018 16:48:25 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=ay1u4hpQI8GALlVMxvrxOIpW4GBJcOv5f0DTd4FTN0U=; b=XDfSXJ1cRmBeOhSTaIxs/7c5Pzu5lyPaPBKGE88y+m57cpahV93tMoZRqZ3RFwuht1 QhOp8KALk7x2LvVm9Gg5p/p6XV9LK1Vsh5/qTv1tF4kEAA8WyINOU3J739TCB6gsUIKb PVuk7KROIPl6IlTT5g4iLyGBpt90CpBu/ZZ041KiOMJ6wXG+91gAg7fJd9dKSg3MBVSE 20NuykIRXd+ileT/7AHYTRLS7pRuVN+5qqzPERVBFwXJ1N2jA+Z0C8eyFgNUP5WcqBII GQ9+dF1Ur+k4WACME0hXXOfrd6vjGTBUrCJ/+ExOWl9kt4YEee5YYSl3cM/7NHZseyvs nrMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=ay1u4hpQI8GALlVMxvrxOIpW4GBJcOv5f0DTd4FTN0U=; b=Zri5lc33CWlUEw/eJmX26rjjNfLvIsAbcjN7oF4vEYVHebFHcNAzBGyNHGAjBCGu5s 9YVIlNrqLT/2/bITmryeTt6oH1A6OHQU20MjvvMRjqTFDMmbUOJ/wv4TMM8P/n6UK7Nm AC3wM3O67REo2kFUxXWaV/IYqA1N7wLUeurEgjtj+DB8n+4x7RtcusiV74Hx9cNZ+5fe ldwOz1rjTj03M3vgB+j8LHoa9pj7nhlN+VLbpdLp7Vs9tUuCR3UQgFJGq+EAAntsHE3r OvGWJaFB2qXIoBFwsbluk4IYaOEFG34Ns93kk7i7ZRxEP6B+Lp6tpqy7JOQrDZC5w9wa rV2w== X-Gm-Message-State: AKwxytfGOjGve9LOIuojuBCwK9u8yzly85uXcvKyRiO6WLvJVdSYa1ny zdM4LUsEDifYucvbeyIFG7Id5kO720Lf4yzf57o= X-Google-Smtp-Source: ACJfBoslLGrb3rnOlIGi9dBb3cIAZ1KZENYQzm0qrzrx9LKSnidHc1+8hMHiOEuwvQ/0IUGCbHuhtJe/z1SRlbRkaOk= X-Received: by 10.25.206.77 with SMTP id e74mr7060944lfg.142.1515516493775; Tue, 09 Jan 2018 08:48:13 -0800 (PST) Xref: news.gmane.org gmane.linux.lib.musl.general:12337 Archived-At: --001a11472d26434ad105625aae69 Content-Type: text/plain; charset="UTF-8" Hello, Not sure if it's the version of clang that I was using, or the warning level/toggle on the project that I was compiling, but Musl headers were causing a number of warnings. Added extra parenthesis, so it's more explicit the precedence of | vs & Added 'const' to the typecasting. Clang didn't like const casting. diff --git a/include/endian.h b/include/endian.h index 1bd4445..a7a9b6a 100644 --- a/include/endian.h +++ b/include/endian.h @@ -24,17 +24,17 @@ static __inline uint16_t __bswap16(uint16_t __x) { - return __x<<8 | __x>>8; + return (__x<<8) | (__x>>8); } static __inline uint32_t __bswap32(uint32_t __x) { - return __x>>24 | __x>>8&0xff00 | __x<<8&0xff0000 | __x<<24; + return __x>>24 | (__x>>8&0xff00) | (__x<<8&0xff0000) | __x<<24; } static __inline uint64_t __bswap64(uint64_t __x) { - return __bswap32(__x)+0ULL<<32 | __bswap32(__x>>32); + return (__bswap32(__x)+0ULL)<<32 | __bswap32(__x>>32); } #if __BYTE_ORDER == __LITTLE_ENDIAN diff --git a/include/sched.h b/include/sched.h index 05d40b1..4d1a599 100644 --- a/include/sched.h +++ b/include/sched.h @@ -95,8 +95,8 @@ static __inline void __CPU_##func##_S(size_t __size, cpu_set_t *__dest, \ { \ size_t __i; \ for (__i=0; __i<__size/sizeof(long); __i++) \ - ((unsigned long *)__dest)[__i] = ((unsigned long *)__src1)[__i] \ - op ((unsigned long *)__src2)[__i] ; \ + ((unsigned long *)__dest)[__i] = ((const unsigned long *)__src1)[__i] \ + op ((const unsigned long *)__src2)[__i] ; \ } __CPU_op_func_S(AND, &) --001a11472d26434ad105625aae69 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,

Not sure if it's the version of clang that I = was using, or the warning level/toggle on the project that I was compiling,= but Musl headers were causing a number of warnings.

<= /div>
Added extra parenthesis, so i= t's more explicit the precedence of | vs &

Added 'const' to the typecasting. Clang didn't like= const casting.



diff --git a/include/endian.h b= /include/endian.h
inde= x 1bd4445..a7a9b6a 100644
--- a/include/endian.h
+++ b/include/endian.h
@@ -24,17 +24,17 @@
=C2=A0
=C2=A0st= atic __inline uint16_t __bswap16(uint16_t __x)
=C2=A0{
- return __x<<8 | = __x>>8;
+ return (__x<<8) | (__x>>8);
=C2=A0}
=C2=A0
=C2=A0static __inline uint32_t __bswap32(uint32_t __x= )
=C2=A0{
=
- = return __x>>24 | __x>>8&0xff00 | __x<<8&0x= ff0000 | __x<<24;
+ return __x>>24 | (__x>&= gt;8&0xff00) | (__x<<8&0xff0000) | __x<<24;
=C2=A0}
=C2=A0
=C2=A0static __inline uint64_t __bswap64(uint64_t __x)<= /div>
=C2=A0{
- re= turn __bswap32(__x)+0ULL<<32 | __bswap32(__x>>32);
=
+ = return (__bswap32(__x)+0ULL)<<32 | __bswap32(__x>>32);
=C2=A0}
=C2=A0
=C2=A0#if __BYTE_ORDER =3D=3D __LITTLE_ENDIAN=
diff --git a/include/sched.h= b/include/sched.h
ind= ex 05d40b1..4d1a599 100644
--- a/include/sched.h
+++ b/include/sched.h
@@ -95,8 +95,8 @@ static __inline void __CPU_##func##_S(size_t __siz= e, cpu_set_t *__dest, \
=C2=A0{ \
=C2=A0 size_t __i; \
=C2=A0 f= or (__i=3D0; __i<__size/sizeof(long); __i++) \
- ((uns= igned long *)__dest)[__i] =3D ((unsigned long *)__src1)[__i] \
=
- = op ((unsigned long *)__src2)[__i] ; \
+ ((unsig= ned long *)__dest)[__i] =3D ((const unsigned long *)__src1)[__i] \
+ op ((const unsigned long *)__src2)[__i] ; \
<= font face=3D"monospace" size=3D"3">=C2=A0}
=C2=A0
=C2=A0__CPU_op_func_S(AND, &)

<= /div> --001a11472d26434ad105625aae69--