Skip to contentSkip to conversation

linux-next: build warning after merge of the akpm-current tree

DISCUSSION Stephen Rothwell 2 participants 5 messages Apr 29, 2016 – Apr 30, 2016 Linux-next tree

lore
Share & tools
lore
#0 lore raw

Hi Andrew,

After merging the akpm-current tree, today's linux-next build (x86_64 allmodconfig) produced this warning:

drivers/scsi/ipr.c: In function 'ipr_show_device_id':
drivers/scsi/ipr.c:4462:34: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 4 has type 'long unsigned int' [-Wformat=]

   len = snprintf(buf, PAGE_SIZE, "0x%llx\n", be64_to_cpu(res->dev_id));
                                  ^

Lots and lots like this :-(

Probably introduced by commit

eef17fb79096 ("byteswap: try to avoid __builtin_constant_p gcc bug")

I guess __builtin_bswap64() has type "unsigned long int" :-(

Signature · 2 lines
Cheers,
Stephen Rothwell
#1 lore raw

Hi All,

Quoted 9 lines · On Fri, 29 Apr 2016 16:45:43 +1000 Stephen Rothwell <[email protected]>…

After merging the akpm-current tree, today's linux-next build (x86_64 allmodconfig) produced this warning:

drivers/scsi/ipr.c: In function 'ipr_show_device_id':
drivers/scsi/ipr.c:4462:34: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 4 has type 'long unsigned int' [-Wformat=]

   len = snprintf(buf, PAGE_SIZE, "0x%llx\n", be64_to_cpu(res->dev_id));
                                  ^
Quoted 7 lines

Lots and lots like this :-(

Introduced by commit

eef17fb79096 ("byteswap: try to avoid __builtin_constant_p gcc bug")

I guess __builtin_bswap64() has type "unsigned long int" :-(

So, I have reverted that commit for today ... it produces too many warnings :-(

Signature · 2 lines
Cheers,
Stephen Rothwell
#2 lore raw
In reply to Stephen Rothwell
Quoted 10 lines · Stephen Rothwell

Hi Andrew,

After merging the akpm-current tree, today's linux-next build (x86_64 allmodconfig) produced this warning:

drivers/scsi/ipr.c: In function 'ipr_show_device_id':
drivers/scsi/ipr.c:4462:34: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 4 has type 'long unsigned int' [-Wformat=]

   len = snprintf(buf, PAGE_SIZE, "0x%llx\n", be64_to_cpu(res->dev_id));
                                  ^
Quoted 7 lines

Lots and lots like this :-(

Probably introduced by commit

eef17fb79096 ("byteswap: try to avoid __builtin_constant_p gcc bug")

I guess __builtin_bswap64() has type "unsigned long int" :-(

Hm, I suppose this is cross-compiled on a powerpc host?

We probably need to add a (__u64) cast to the return value of __builtin_bswap64(), like:

include/uapi/linux/swab.h +1 -1
index de56fd5..d737804 100644
@@ -123,7 +123,7 @@ static inline __attribute_const__ __u32 __fswahb32(__u32 val)
  * @x: value to byteswap
  */
 #ifdef __HAVE_BUILTIN_BSWAP64__
-#define __swab64(x) __builtin_bswap64((__u64)(x))
+#define __swab64(x) (__u64)__builtin_bswap64((__u64)(x))
 #else
 #define __swab64(x)				\
 	(__builtin_constant_p((__u64)(x)) ?	\
Signature · 1 line
Josh
#3 lore raw
Quoted 29 lines · Josh Poimboeuf
Quoted 10 lines · Stephen Rothwell

Hi Andrew,

After merging the akpm-current tree, today's linux-next build (x86_64 allmodconfig) produced this warning:

drivers/scsi/ipr.c: In function 'ipr_show_device_id':
drivers/scsi/ipr.c:4462:34: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 4 has type 'long unsigned int' [-Wformat=]

   len = snprintf(buf, PAGE_SIZE, "0x%llx\n", be64_to_cpu(res->dev_id));
                                  ^
Quoted 7 lines

Lots and lots like this :-(

Probably introduced by commit

eef17fb79096 ("byteswap: try to avoid __builtin_constant_p gcc bug")

I guess __builtin_bswap64() has type "unsigned long int" :-(

Hm, I suppose this is cross-compiled on a powerpc host?

We probably need to add a (__u64) cast to the return value of __builtin_bswap64(), like:

include/uapi/linux/swab.h +0 -0
index de56fd5..d737804 100644

include/uapi/linux/swab.h static inline __attribute_const__ __u32 __fswahb32(__u32 val) · line 129

Quoted 8 lines
include/uapi/linux/swab.h +1 -1
@@ -123,7 +123,7 @@ static inline __attribute_const__ __u32 __fswahb32(__u32 val)
  * @x: value to byteswap
  */
 #ifdef __HAVE_BUILTIN_BSWAP64__
-#define __swab64(x) __builtin_bswap64((__u64)(x))
+#define __swab64(x) (__u64)__builtin_bswap64((__u64)(x))
 #else
 #define __swab64(x)				\
 	(__builtin_constant_p((__u64)(x)) ?	\

Never mind about cross-compiling on powerpc, this has nothing to do with that. But the above patch does seem to fix it.

Signature · 1 line
Josh
#4 lore raw

Hi Josh,

Quoted 35 lines · On Fri, 29 Apr 2016 09:03:42 -0500 Josh Poimboeuf <[email protected]> wrote:
Quoted 33 lines · Josh Poimboeuf
Quoted 10 lines · Stephen Rothwell

Hi Andrew,

After merging the akpm-current tree, today's linux-next build (x86_64 allmodconfig) produced this warning:

drivers/scsi/ipr.c: In function 'ipr_show_device_id':
drivers/scsi/ipr.c:4462:34: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 4 has type 'long unsigned int' [-Wformat=]

   len = snprintf(buf, PAGE_SIZE, "0x%llx\n", be64_to_cpu(res->dev_id));
                                  ^
Quoted 7 lines

Lots and lots like this :-(

Probably introduced by commit

eef17fb79096 ("byteswap: try to avoid __builtin_constant_p gcc bug")

I guess __builtin_bswap64() has type "unsigned long int" :-(

Hm, I suppose this is cross-compiled on a powerpc host?

We probably need to add a (__u64) cast to the return value of __builtin_bswap64(), like:

include/uapi/linux/swab.h +0 -1
index de56fd5..d737804 100644
@@ -123,7 +123,7 @@ static inline __attribute_const__ __u32 __fswahb32(__u32 val)
  * @x: value to byteswap
  */
 #ifdef __HAVE_BUILTIN_BSWAP64__
-#define __swab64(x) __builtin_bswap64((__u64)(x))
Quoted 8 lines

include/uapi/linux/swab.h static inline __attribute_const__ __u32 __fswahb32(__u32 val) · line 129

Quoted 4 lines
include/uapi/linux/swab.h +1 -0
+#define __swab64(x) (__u64)__builtin_bswap64((__u64)(x))
 #else
 #define __swab64(x)				\
 	(__builtin_constant_p((__u64)(x)) ?	\  

Never mind about cross-compiling on powerpc, this has nothing to do with that. But the above patch does seem to fix it.

Thanks. I have added Andrew's tidied up version to linux-next to replace the revert.

Signature · 2 lines
Cheers,
Stephen Rothwell