diff options
author | Eric Peers <epeers@google.com> | 2019-12-17 10:02:15 -0700 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2020-03-18 22:14:46 +0000 |
commit | 9d49598cd6f323d0119d905f9917f526e0c2920f (patch) | |
tree | 3e234a31dd71c171c8e463d06db93441c4496e40 | |
parent | 505fe3d73c37e21e378b58cee0c53b835cd5f88d (diff) | |
download | coreboot-9d49598cd6f323d0119d905f9917f526e0c2920f.tar.xz |
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>
-rw-r--r-- | src/include/assert.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/include/assert.h b/src/include/assert.h index 8f5af1f255..990cee11b5 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__); \ |