From e34fca3e01d75552ad8d712879c3ccd6a6168584 Mon Sep 17 00:00:00 2001 From: Evan Green Date: Mon, 23 Sep 2019 11:02:41 -0700 Subject: builtin: Introduce and use inttypes.h In order to pass the right printf format specifiers for certain types that are compiled both in 32-bit EC and 64-bit host environments, standard macros PRIx64 and PRId64 must be introduced. These specify the correct printf format specifier in the given compilation environment for printing a 64-bit value. On the host, inttypes.h already exists. Add an inttypes.h for the EC codebase so that these macros can be used where they're needed. BUG=chromium:984041 TEST=make -j buildall BRANCH=none Change-Id: I76e3bdc88aef7da6e5234d5b86b595f7138ea9a1 Signed-off-by: Evan Green Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1819642 Reviewed-by: caveh jalali Reviewed-by: Jack Rosenthal --- include/host_command.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include/host_command.h') diff --git a/include/host_command.h b/include/host_command.h index 2be94cdb83..10d7fc37ea 100644 --- a/include/host_command.h +++ b/include/host_command.h @@ -125,8 +125,10 @@ struct host_command { #ifdef CONFIG_HOST_EVENT64 typedef uint64_t host_event_t; -#define HOST_EVENT_CPRINTS(str, e) CPRINTS("%s 0x%016lx", str, e) -#define HOST_EVENT_CCPRINTF(str, e) ccprintf("%s 0x%016lx\n", str, e) +#define HOST_EVENT_CPRINTS(str, e) CPRINTS("%s 0x%016" PRIx64, str, e) +#define HOST_EVENT_CCPRINTF(str, e) \ + ccprintf("%s 0x%016" PRIx64 "\n", str, e) + #else typedef uint32_t host_event_t; #define HOST_EVENT_CPRINTS(str, e) CPRINTS("%s 0x%08x", str, e) -- cgit v1.2.1