From db2c8dfecb5086ceb78c59f2108d51ca3129d9c1 Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Mon, 6 Apr 2020 23:02:12 +0200 Subject: assert.h: Simplify dead_code() It turns out the linker's error message already includes the line number of the dead_code() invocation. If we don't include the line number in the identifier for our undefined reference, we don't need individual identifiers at all and can work with a single, global declaration. Change-Id: Ib63868ce3114c3f839867a3bfb1b03bdb6facf16 Signed-off-by: Nico Huber Reviewed-on: https://review.coreboot.org/c/coreboot/+/40240 Tested-by: build bot (Jenkins) Reviewed-by: Julius Werner Reviewed-by: Felix Held Reviewed-by: Angel Pons --- src/include/assert.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/include') diff --git a/src/include/assert.h b/src/include/assert.h index 492629dd30..7252ab61e2 100644 --- a/src/include/assert.h +++ b/src/include/assert.h @@ -52,15 +52,10 @@ * The error message when this hits will look like this: * * ramstage/lib/bootmode.o: In function `display_init_required': - * bootmode.c:42: undefined reference to `dead_code_assertion_failed_at_line_42' + * bootmode.c:42: undefined reference to `_dead_code_assertion_failed' */ -#define __dead_code(tag, line) do { \ - extern void dead_code_assertion_failed##tag##_at_line_##line(void) \ - __attribute__((noreturn)); \ - dead_code_assertion_failed##tag##_at_line_##line(); \ -} while (0) -#define _dead_code(tag, line) __dead_code(tag, line) -#define dead_code(tag) _dead_code(tag, __LINE__) +extern void _dead_code_assertion_failed(void) __attribute__((noreturn)); +#define dead_code() _dead_code_assertion_failed() /* This can be used in the context of an expression of type 'type'. */ #define dead_code_t(type) ({ \ -- cgit v1.2.3