summaryrefslogtreecommitdiff
path: root/README
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2017-07-14 14:14:11 -0700
committerMartin Roth <martinroth@google.com>2017-07-16 23:56:34 +0000
commitb8534f767c4b81fb11376e9d7ffb48ace6889539 (patch)
treee21427bf38ed693236cc4200c2aac41bd8297254 /README
parent5998198f0c2dc055b2573ad95f03774e755ca3db (diff)
assert: Add new dead_code() macro to assert dead code paths
This patch adds a new kind of compile-time assertion based on Linux' compiletime_assert(). The difference to the existing use of _Static_assert() in coreboot (which should continue to be used where appropriate) is that this new assertion only hits if the call to it is not optimized out at compile time. It is therefore ideal to assert that certain code paths are not included in the image if a certain Kconfig option is (not) set. For example, assert(!IS_ENABLED(CONFIG_THAT_MAKES_THIS_INAPPROPRIATE)); can be rewritten as if (!IS_ENABLED(CONFIG_THAT_MAKES_THIS_INAPPROPRIATE)) dead_code("This code shouldn't be built for config X"); to turn it into a compile-time check. Change-Id: Ida2911e2e4b3191a00d09231b493bf755e6f0fcb Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/20585 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Diffstat (limited to 'README')
0 files changed, 0 insertions, 0 deletions