Skip to contentSkip to conversation

pc-bios/s390-ccw: Fix compiler warning when compiling with DEBUG enabled

PATCH In review Thomas Huth 2 participants 3 messages Mar 6

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pc-bios/s390-ccw: Fix compiler warning when compiling with DEBUG enabled

From: Thomas Huth <[email protected]>

When compiling with DEBUG=1, there is currently a compiler warning:

pc-bios/s390-ccw: Compiling main.o
In file included from /home/thuth/devel/qemu/pc-bios/s390-ccw/main.c:14:
In file included from /home/thuth/devel/qemu/pc-bios/s390-ccw/helper.h:16:
/home/thuth/devel/qemu/pc-bios/s390-ccw/s390-ccw.h:122:31: warning: format specifies type
'unsigned int' but the argument has type 'u64' (aka 'unsigned long long') [-Wformat]

   122 |     printf("%s 0x%X\n", desc, addr);
       |                  ~~           ^~~~
       |                  %llX

1 warning generated.

Fix it by using the right format string here.

---
 pc-bios/s390-ccw/s390-ccw.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
pc-bios/s390-ccw/s390-ccw.h +1 -1
index b1dc35cdedf..6a0b987e303 100644
@@ -119,7 +119,7 @@ static inline void fill_hex_val(char *out, void *ptr, unsigned size)
 static inline void debug_print_int(const char *desc, u64 addr)
 {
 #ifdef DEBUG
-    printf("%s 0x%X\n", desc, addr);
+    printf("%s 0x%llx\n", desc, addr);
 #endif
 }
 
Signature · 1 line
2.53.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 26 lines · Thomas Huth

From: Thomas Huth <[email protected]>

When compiling with DEBUG=1, there is currently a compiler warning:

pc-bios/s390-ccw: Compiling main.o
In file included from /home/thuth/devel/qemu/pc-bios/s390-ccw/main.c:14:
In file included from /home/thuth/devel/qemu/pc-bios/s390-ccw/helper.h:16:
/home/thuth/devel/qemu/pc-bios/s390-ccw/s390-ccw.h:122:31: warning: format specifies type
'unsigned int' but the argument has type 'u64' (aka 'unsigned long long') [-Wformat]
122 | printf("%s 0x%X\n", desc, addr);
| ~~ ^~~~
| %llX
1 warning generated.

Fix it by using the right format string here.

---
  pc-bios/s390-ccw/s390-ccw.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
pc-bios/s390-ccw/s390-ccw.h +0 -0
index b1dc35cdedf..6a0b987e303 100644

pc-bios/s390-ccw/s390-ccw.h static inline void fill_hex_val(char *out, void *ptr, unsigned size) · line 125

Quoted 8 lines
pc-bios/s390-ccw/s390-ccw.h +1 -1
@@ -119,7 +119,7 @@ static inline void fill_hex_val(char *out, void *ptr, unsigned size)
  static inline void debug_print_int(const char *desc, u64 addr)
  {
  #ifdef DEBUG
-    printf("%s 0x%X\n", desc, addr);
+    printf("%s 0x%llx\n", desc, addr);
  #endif
  }
 

I am curious, this change has been there for at least 2 years...any reason the compiler tripped now? Or we never built with DEBUG=1 before?

#2 lore raw
Quoted 23 lines · Farhan Ali
Quoted 21 lines · Thomas Huth

From: Thomas Huth <[email protected]>

When compiling with DEBUG=1, there is currently a compiler warning:

  pc-bios/s390-ccw: Compiling main.o
  In file included from /home/thuth/devel/qemu/pc-bios/s390-ccw/main.c:14:
  In file included from /home/thuth/devel/qemu/pc-bios/s390-ccw/helper.h:16:
  /home/thuth/devel/qemu/pc-bios/s390-ccw/s390-ccw.h:122:31: warning: format specifies type 'unsigned int' but the argument has type 'u64' (aka 'unsigned long long') [-Wformat] 122 |     printf("%s 0x%X\n", desc, addr);
        |                  ~~           ^~~~
        |                  %llX
  1 warning generated.

Fix it by using the right format string here.

---
  pc-bios/s390-ccw/s390-ccw.h | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines

pc-bios/s390-ccw/s390-ccw.h static inline void fill_hex_val(char *out, void *ptr, · line 125

Quoted 13 lines
pc-bios/s390-ccw/s390-ccw.h +1 -1
index b1dc35cdedf..6a0b987e303 100644
@@ -119,7 +119,7 @@ static inline void fill_hex_val(char *out, void *ptr, 
 unsigned size)
   static inline void debug_print_int(const char *desc, u64 addr)
   {
   #ifdef DEBUG
-    printf("%s 0x%X\n", desc, addr);
+    printf("%s 0x%llx\n", desc, addr);
   #endif
   }

I am curious, this change has been there for at least 2 years...any reason the compiler tripped now? Or we never built with DEBUG=1 before?

The pc-bios is rather low traffic - I guess nobody really tried compiling with DEBUG=1 within the last two years.

Quoted 1 line

Thanks!

Thomas