diff mbox series

[2/2] Hexagon (tests/.../hex_test.h): use portable printf formats

Message ID a4a98ae4b091b02946e5a95801cb19aceb36f20c.1685454251.git.quic_mathbern@quicinc.com (mailing list archive)
State New, archived
Headers show
Series Hexagon tests: fix test_load_tmp2 and non-portable format | expand

Commit Message

Matheus Tavares Bernardino May 30, 2023, 1:45 p.m. UTC
This fixes compiler messages like "warning: format specifies type
'unsigned int' but the argument has type 'uint32_t' (aka 'unsigned
long') [-Wformat]".

Signed-off-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
---
 tests/tcg/hexagon/hex_test.h | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/tests/tcg/hexagon/hex_test.h b/tests/tcg/hexagon/hex_test.h
index cfed06a58b..fe253b56e5 100644
--- a/tests/tcg/hexagon/hex_test.h
+++ b/tests/tcg/hexagon/hex_test.h
@@ -19,10 +19,13 @@ 
 #ifndef HEX_TEST_H
 #define HEX_TEST_H
 
+#include <inttypes.h>
+
 static inline void __check32(int line, uint32_t val, uint32_t expect)
 {
     if (val != expect) {
-        printf("ERROR at line %d: 0x%08x != 0x%08x\n", line, val, expect);
+        printf("ERROR at line %d: 0x%08"PRIx32" != 0x%08"PRIx32"\n",
+               line, val, expect);
         err++;
     }
 }
@@ -32,7 +35,8 @@  static inline void __check32(int line, uint32_t val, uint32_t expect)
 static inline void __check64(int line, uint64_t val, uint64_t expect)
 {
     if (val != expect) {
-        printf("ERROR at line %d: 0x%016llx != 0x%016llx\n", line, val, expect);
+        printf("ERROR at line %d: 0x%016"PRIx64" != 0x%016"PRIx64"\n",
+               line, val, expect);
         err++;
     }
 }
@@ -62,7 +66,8 @@  static inline void __checkp(int line, void *p, void *expect)
 static inline void __check32_ne(int line, uint32_t val, uint32_t expect)
 {
     if (val == expect) {
-        printf("ERROR at line %d: 0x%08x == 0x%08x\n", line, val, expect);
+        printf("ERROR at line %d: 0x%08"PRIx32" == 0x%08"PRIx32"\n",
+               line, val, expect);
         err++;
     }
 }
@@ -72,7 +77,8 @@  static inline void __check32_ne(int line, uint32_t val, uint32_t expect)
 static inline void __check64_ne(int line, uint64_t val, uint64_t expect)
 {
     if (val == expect) {
-        printf("ERROR at line %d: 0x%016llx == 0x%016llx\n", line, val, expect);
+        printf("ERROR at line %d: 0x%016"PRIx64" == 0x%016"PRIx64"\n",
+               line, val, expect);
         err++;
     }
 }