From 5c27e82073ec6bb96a672b18c2c66773ae887ebf Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Tue, 2 Oct 2012 00:28:33 -0700 Subject: libpayload: Fix the format string of the assert macro. The assert macro in libpayload was using a format string which printed the line number with %s. The line number came from the __LINE__ predefined macro which resolves to an integer constant. Change-Id: I0e00d42a1569802137cf440af3061d7f397fdd27 Signed-off-by: Gabe Black Reviewed-on: http://review.coreboot.org/1730 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- payloads/libpayload/include/assert.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'payloads/libpayload') diff --git a/payloads/libpayload/include/assert.h b/payloads/libpayload/include/assert.h index 9968504a44..8502881e32 100644 --- a/payloads/libpayload/include/assert.h +++ b/payloads/libpayload/include/assert.h @@ -36,5 +36,11 @@ // Heisenbugs appear if statement has side-effects. This could be worked around but does the standard allow for that? #define assert(statement) #else -#define assert(statement) if ((statement) == 0) { fprintf(stderr, "assertion failed in file %s, function %s(), line %s\n", __FILE__, __FUNCTION__, __LINE__); abort(); } +#define assert(statement) \ + if ((statement) == 0) { \ + fprintf(stderr, "assertion failed in file %s, " \ + "function %s(), line %d\n", \ + __FILE__, __FUNCTION__, __LINE__); \ + abort(); \ + } #endif -- cgit v1.2.3