Hello Shelley Chen, build bot (Jenkins), Furquan Shaikh, Angel Pons,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/44044
to look at the new patch set (#3).
Change subject: assert.h: Try to evaluate assertions at compile time ......................................................................
assert.h: Try to evaluate assertions at compile time
Many places in coreboot seem to like to do things like
assert(CONFIG(SOME_KCONFIG));
This is somewhat suboptimal since assert() is a runtime check, so you don't see that this fails until someone actually tries to boot it even though the compiler is totally aware of it already. We already have the dead_code() macro to do this better:
if (CONFIG(SOME_KCONFIG)) dead_code();
Rather than fixing all these and trying to carefully educate people about which type of check is more appropriate in what situation, we can just employ the magic of __builtin_constant_p() to automatically make the former statement behave like the latter.
Signed-off-by: Julius Werner jwerner@chromium.org Change-Id: I06691b732598eb2a847a17167a1cb92149710916 --- M src/include/assert.h 1 file changed, 9 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/44/44044/3