From 1764d22f919b62bcb7948b8e07eaa40746b5f458 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 18 May 2016 17:18:18 +0100 Subject: zunitc: use platform-independent macros for integer formatting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes warnings and potential issues on 32-bit platforms, tested only on ARM but I’d expect the same issue on i686. Signed-off-by: Emmanuel Gil Peyrot Reviewed-by: Bryce Harrington --- tools/zunitc/src/zuc_base_logger.c | 15 +++++++++------ tools/zunitc/src/zuc_junit_reporter.c | 34 ++++++++++++++++++---------------- 2 files changed, 27 insertions(+), 22 deletions(-) (limited to 'tools') diff --git a/tools/zunitc/src/zuc_base_logger.c b/tools/zunitc/src/zuc_base_logger.c index cdbd9ea5..ffa127f0 100644 --- a/tools/zunitc/src/zuc_base_logger.c +++ b/tools/zunitc/src/zuc_base_logger.c @@ -27,6 +27,7 @@ #include "zuc_base_logger.h" +#include #include #include #include @@ -363,9 +364,9 @@ check_triggered(void *data, char const *file, int line, } else { printf("%s:%d: error: Value of: %s\n", file, line, expr2); - printf(" Actual: %ld\n", val2); + printf(" Actual: %"PRIdPTR"\n", val2); printf("Expected: %s\n", expr1); - printf("Which is: %ld\n", val1); + printf("Which is: %"PRIdPTR"\n", val1); } break; case ZUC_OP_NE: @@ -376,8 +377,9 @@ check_triggered(void *data, char const *file, int line, (char *)val1, (char *)val2); } else { printf("%s:%d: error: ", file, line); - printf("Expected: (%s) %s (%s), actual: %ld vs %ld\n", - expr1, zuc_get_opstr(op), expr2, val1, val2); + printf("Expected: (%s) %s (%s), actual: %"PRIdPTR" vs " + "%"PRIdPTR"\n", expr1, zuc_get_opstr(op), expr2, + val1, val2); } break; case ZUC_OP_TERMINATE: { @@ -392,7 +394,8 @@ check_triggered(void *data, char const *file, int line, break; default: printf("%s:%d: error: ", file, line); - printf("Expected: (%s) %s (%s), actual: %ld vs %ld\n", - expr1, zuc_get_opstr(op), expr2, val1, val2); + printf("Expected: (%s) %s (%s), actual: %"PRIdPTR" vs " + "%"PRIdPTR"\n", expr1, zuc_get_opstr(op), expr2, val1, + val2); } } diff --git a/tools/zunitc/src/zuc_junit_reporter.c b/tools/zunitc/src/zuc_junit_reporter.c index a33b33f5..369f0354 100644 --- a/tools/zunitc/src/zuc_junit_reporter.c +++ b/tools/zunitc/src/zuc_junit_reporter.c @@ -30,6 +30,7 @@ #if ENABLE_JUNIT_XML #include +#include #include #include #include @@ -128,12 +129,12 @@ emit_event(xmlNodePtr parent, struct zuc_event *event) } } else { if (asprintf(&msg, "%s:%d: error: Value of: %s\n" - " Actual: %ld\n" - "Expected: %s\n" - "Which is: %ld\n", - event->file, event->line, event->expr2, - event->val2, event->expr1, - event->val1) < 0) { + " Actual: %"PRIdPTR"\n" + "Expected: %s\n" + "Which is: %"PRIdPTR"\n", + event->file, event->line, event->expr2, + event->val2, event->expr1, + event->val1) < 0) { msg = NULL; } } @@ -151,12 +152,12 @@ emit_event(xmlNodePtr parent, struct zuc_event *event) } } else { if (asprintf(&msg, "%s:%d: error: " - "Expected: (%s) %s (%s)," - " actual: %ld vs %ld\n", - event->file, event->line, - event->expr1, zuc_get_opstr(event->op), - event->expr2, event->val1, - event->val2) < 0) { + "Expected: (%s) %s (%s)," + " actual: %"PRIdPTR" vs %"PRIdPTR"\n", + event->file, event->line, + event->expr1, zuc_get_opstr(event->op), + event->expr2, event->val1, + event->val2) < 0) { msg = NULL; } } @@ -181,10 +182,11 @@ emit_event(xmlNodePtr parent, struct zuc_event *event) break; default: if (asprintf(&msg, "%s:%d: error: " - "Expected: (%s) %s (%s), actual: %ld vs %ld\n", - event->file, event->line, - event->expr1, zuc_get_opstr(event->op), - event->expr2, event->val1, event->val2) < 0) { + "Expected: (%s) %s (%s), actual: %"PRIdPTR" vs " + "%"PRIdPTR"\n", + event->file, event->line, + event->expr1, zuc_get_opstr(event->op), + event->expr2, event->val1, event->val2) < 0) { msg = NULL; } } -- cgit v1.2.3