Hello Eric Peers,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/39620
to review the following change.
Change subject: assert.h: add assertions with descriptive failuresx ......................................................................
assert.h: add assertions with descriptive failuresx
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 --- M src/include/assert.h 1 file changed, 11 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/20/39620/1
diff --git a/src/include/assert.h b/src/include/assert.h index 8f5af1f..990cee1 100644 --- a/src/include/assert.h +++ b/src/include/assert.h @@ -33,6 +33,17 @@ 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() { \ printk(BIOS_EMERG, "ERROR: BUG ENCOUNTERED at file '%s'"\ ", line %d\n", __FILE__, __LINE__); \