[PATCH] opal: reserve_mem: fix 32 bit build issues

Colin King colin.king at canonical.com
Mon May 22 14:52:02 UTC 2017


From: Colin Ian King <colin.king at canonical.com>

using %lx for uint64_t on 32 bit builds causes build issues. Use
PRIx64 instead:

Fixes the errors:

gcc -DHAVE_CONFIG_H -I. -I..  -I../src/lib/include -I../src/acpica/source/include -I../src/acpica/source/compiler -I../efi_runtime `pkg-config --silence-errors --cflags json` `pkg-config --silence-errors --cflags json-c` -pthread `pkg-config --cflags glib-2.0 gio-2.0` -Wall -Werror -Wextra -DACPI_DEBUG_OUTPUT   -g -O2 -MT opal/fwts-reserv_mem.o -MD -MP -MF opal/.deps/fwts-reserv_mem.Tpo -c -o opal/fwts-reserv_mem.o `test -f 'opal/reserv_mem.c' || echo './'`opal/reserv_mem.c
In file included from ../src/lib/include/fwts_framework.h:31:0,
                 from ../src/lib/include/fwts_binpaths.h:27,
                 from ../src/lib/include/fwts.h:54,
                 from opal/reserv_mem.c:25:
opal/reserv_mem.c: In function 'reserv_mem_limits_test':
opal/reserv_mem.c:187:21: error: format '%lx' expects argument of type 'long unsigned int', but argument 9 has type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
   fwts_log_info(fw, "Region name %80s"
                     ^
../src/lib/include/fwts_log.h:171:60: note: in definition of macro 'fwts_log_info'
  fwts_log_printf(fw, LOG_INFO, LOG_LEVEL_NONE, "", "", "", fmt, ## args)
                                                            ^
opal/reserv_mem.c:187:21: error: format '%lx' expects argument of type 'long unsigned int', but argument 10 has type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
   fwts_log_info(fw, "Region name %80s"
                     ^
../src/lib/include/fwts_log.h:171:60: note: in definition of macro 'fwts_log_info'
  fwts_log_printf(fw, LOG_INFO, LOG_LEVEL_NONE, "", "", "", fmt, ## args)
                                                            ^
In file included from ../src/lib/include/fwts_binpaths.h:27:0,
                 from ../src/lib/include/fwts.h:54,
                 from opal/reserv_mem.c:25:
opal/reserv_mem.c:250:6: error: format '%lx' expects argument of type 'long unsigned int', but argument 7 has type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
      "Mismatch in homer-image size, "
      ^
../src/lib/include/fwts_framework.h:235:76: note: in definition of macro 'fwts_failed'
  fwts_framework_log(fw, LOG_FAILED, label, level, &fw->minor_tests.failed, fmt, ## args)
                                                                            ^
opal/reserv_mem.c:250:6: error: format '%lx' expects argument of type 'long unsigned int', but argument 8 has type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
      "Mismatch in homer-image size, "
      ^
../src/lib/include/fwts_framework.h:235:76: note: in definition of macro 'fwts_failed'
  fwts_framework_log(fw, LOG_FAILED, label, level, &fw->minor_tests.failed, fmt, ## args)
                                                                            ^
opal/reserv_mem.c:263:6: error: format '%lx' expects argument of type 'long unsigned int', but argument 7 has type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
      "Mismatch in slw-image size, "
      ^
../src/lib/include/fwts_framework.h:235:76: note: in definition of macro 'fwts_failed'
  fwts_framework_log(fw, LOG_FAILED, label, level, &fw->minor_tests.failed, fmt, ## args)
                                                                            ^
opal/reserv_mem.c:263:6: error: format '%lx' expects argument of type 'long unsigned int', but argument 8 has type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
      "Mismatch in slw-image size, "
      ^
../src/lib/include/fwts_framework.h:235:76: note: in definition of macro 'fwts_failed'
  fwts_framework_log(fw, LOG_FAILED, label, level, &fw->minor_tests.failed, fmt, ## args)
                                                                            ^
opal/reserv_mem.c:276:6: error: format '%lx' expects argument of type 'long unsigned int', but argument 7 has type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
      "Mismatch in occ-common-area size, "
      ^
../src/lib/include/fwts_framework.h:235:76: note: in definition of macro 'fwts_failed'
  fwts_framework_log(fw, LOG_FAILED, label, level, &fw->minor_tests.failed, fmt, ## args)
                                                                            ^
opal/reserv_mem.c:276:6: error: format '%lx' expects argument of type 'long unsigned int', but argument 8 has type 'uint64_t {aka long long unsigned int}' [-Werror=format=]
      "Mismatch in occ-common-area size, "
      ^
../src/lib/include/fwts_framework.h:235:76: note: in definition of macro 'fwts_failed'
  fwts_framework_log(fw, LOG_FAILED, label, level, &fw->minor_tests.failed, fmt, ## args)
                                                                            ^
cc1: all warnings being treated as errors

Fixes: 80eda6b3aad3fc ("fwts/opal: Reserved memory DT validation tests.")
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/opal/reserv_mem.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/opal/reserv_mem.c b/src/opal/reserv_mem.c
index eeec2947..49e14c45 100644
--- a/src/opal/reserv_mem.c
+++ b/src/opal/reserv_mem.c
@@ -185,7 +185,7 @@ static int reserv_mem_limits_test(fwts_framework *fw)
 		regions[j].start = (uint64_t)be64toh(ranges[2 * j]);
 		regions[j].len = (uint64_t)be64toh(ranges[2 * j + 1]);
 		fwts_log_info(fw, "Region name %80s"
-			" start: 0x%08lx, len: 0x%08lx\n",
+			" start: 0x%08" PRIx64 ", len: 0x%08" PRIx64 "\n",
 			regions[j].name, regions[j].start, regions[j].len);
 	}
 
@@ -248,7 +248,7 @@ static int reserv_mem_limits_test(fwts_framework *fw)
 				fwts_failed(fw, LOG_LEVEL_MEDIUM,
 					"ImageSizeMismatch",
 					"Mismatch in homer-image size, "
-					"expected: 0x%lx, actual: 0x%lx",
+					"expected: 0x%" PRIx64 ", actual: 0x%" PRIx64,
 					configstruct.homer, regions[j].len);
 				ok = false;
 			} else
@@ -261,7 +261,7 @@ static int reserv_mem_limits_test(fwts_framework *fw)
 				fwts_failed(fw, LOG_LEVEL_MEDIUM,
 					"ImageSizeMismatch",
 					"Mismatch in slw-image size, "
-					"expected: 0x%lx, actual: 0x%lx",
+					"expected: 0x%" PRIx64 ", actual: 0x%" PRIx64,
 					configstruct.slw, regions[j].len);
 				ok = false;
 			} else
@@ -274,7 +274,7 @@ static int reserv_mem_limits_test(fwts_framework *fw)
 				fwts_failed(fw, LOG_LEVEL_MEDIUM,
 					"ImageSizeMismatch",
 					"Mismatch in occ-common-area size, "
-					"expected: 0x%lx, actual: 0x%lx",
+					"expected: 0x%" PRIx64 ", actual: 0x%" PRIx64,
 					configstruct.occ_common,
 					regions[j].len);
 				ok = false;
-- 
2.11.0




More information about the fwts-devel mailing list