summaryrefslogtreecommitdiff
path: root/payloads/libpayload/include/assert.h
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2012-10-02 00:28:33 -0700
committerStefan Reinauer <stefan.reinauer@coreboot.org>2012-11-07 18:36:05 +0100
commit5c27e82073ec6bb96a672b18c2c66773ae887ebf (patch)
treeafd050a0d039da96085787f7fe4d1e6cc1979242 /payloads/libpayload/include/assert.h
parent3b84086e3dc5ff9e50a1ea847fd7dac2e687d471 (diff)
downloadcoreboot-5c27e82073ec6bb96a672b18c2c66773ae887ebf.tar.xz
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 <gabeblack@google.com> Reviewed-on: http://review.coreboot.org/1730 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
Diffstat (limited to 'payloads/libpayload/include/assert.h')
-rw-r--r--payloads/libpayload/include/assert.h8
1 files changed, 7 insertions, 1 deletions
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