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>
This commit is contained in:
committed by
Stefan Reinauer
parent
3b84086e3d
commit
5c27e82073
@ -36,5 +36,11 @@
|
|||||||
// Heisenbugs appear if statement has side-effects. This could be worked around but does the standard allow for that?
|
// Heisenbugs appear if statement has side-effects. This could be worked around but does the standard allow for that?
|
||||||
#define assert(statement)
|
#define assert(statement)
|
||||||
#else
|
#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
|
#endif
|
||||||
|
Reference in New Issue
Block a user