[coreboot] New patch to review for coreboot: 259a3ea libpayload: Fix the format string of the assert macro.
Stefan Reinauer (stefan.reinauer@coreboot.org)
gerrit at coreboot.org
Wed Nov 7 00:22:01 CET 2012
Stefan Reinauer (stefan.reinauer at coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1730
-gerrit
commit 259a3eadf5b8c758b7f30e7b6182c1d50b3d6f87
Author: Gabe Black <gabeblack at google.com>
Date: Tue Oct 2 00:28:33 2012 -0700
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 at google.com>
---
payloads/libpayload/include/assert.h | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/payloads/libpayload/include/assert.h b/payloads/libpayload/include/assert.h
index 9968504..8502881 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
More information about the coreboot
mailing list