assert.h: add assertions with descriptive failures
BUG=None TEST=tested in following patches on Trembyle board Change-Id: Ib30ccd41759e5a2a61d3182cc08ed5eb762eca98 Signed-off-by: Eric Peers <epeers@google.com> Reviewed-on: https://chromium-review.googlesource.com/1971443 Tested-by: Martin Roth <martinroth@chromium.org> Reviewed-by: Martin Roth <martinroth@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/39620 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Raul Rangel <rrangel@chromium.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
This commit is contained in:
parent
505fe3d73c
commit
9d49598cd6
|
@ -33,6 +33,17 @@
|
||||||
hlt(); \
|
hlt(); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define ASSERT_MSG(x, msg) { \
|
||||||
|
if (!(x)) { \
|
||||||
|
printk(BIOS_EMERG, "ASSERTION ERROR: file '%s'" \
|
||||||
|
", line %d\n", __FILE__, __LINE__); \
|
||||||
|
printk(BIOS_EMERG, "%s", msg); \
|
||||||
|
if (CONFIG(FATAL_ASSERTS)) \
|
||||||
|
hlt(); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
#define BUG() { \
|
#define BUG() { \
|
||||||
printk(BIOS_EMERG, "ERROR: BUG ENCOUNTERED at file '%s'"\
|
printk(BIOS_EMERG, "ERROR: BUG ENCOUNTERED at file '%s'"\
|
||||||
", line %d\n", __FILE__, __LINE__); \
|
", line %d\n", __FILE__, __LINE__); \
|
||||||
|
|
Loading…
Reference in New Issue