summaryrefslogtreecommitdiff
path: root/src/drivers/lenovo
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2020-07-29 16:55:18 -0700
committerPatrick Georgi <pgeorgi@google.com>2020-08-03 05:15:59 +0000
commit2aedc9776a3c2ef99c8ca4f1ed836c3f7f6821d6 (patch)
treeca055ae82bfb0509961598d7f41b22ee2e9f0caa /src/drivers/lenovo
parent3e034b6e9aaddcca1996773b25d2ee88940d1144 (diff)
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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/44044 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/drivers/lenovo')
0 files changed, 0 insertions, 0 deletions