|
Message-ID: <CAKb-6jvgsojU1c1P2oSP5uJN1Fwdy-4b3joDDXNYXdbcTN5CyQ@mail.gmail.com>
Date: Tue, 09 Jan 2018 16:48:02 +0000
From: Patrick Cheng <patrickyccheng@...il.com>
To: musl@...ts.openwall.com
Subject: [Patch] reduced warnings reported by clang
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, &)
Content of type "text/html" skipped
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.