Alan Green has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/32833
Change subject: src/include/assert.h: add noreturn attribute to dead_code() ......................................................................
src/include/assert.h: add noreturn attribute to dead_code()
Clang does not recognize dead_code() as termination of execution. It gives this message:
error: control reaches end of non-void function [-Werror,-Wreturn-type]
This change adds an __attribute__((noreturn)) to ensure that clang recognises that this function will terminate execution.
This change is more general solution to the problem that was addressed in the specific at https://review.coreboot.org/c/coreboot/+/32798
Signed-off-by: Alan Green avg@google.com Change-Id: I5ba7189559aa01545d5bbe893bced400a3aaabbb --- M src/include/assert.h 1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/33/32833/1
diff --git a/src/include/assert.h b/src/include/assert.h index 4575a29..0ad7858 100644 --- a/src/include/assert.h +++ b/src/include/assert.h @@ -56,7 +56,8 @@ * bootmode.c:42: undefined reference to `dead_code_assertion_failed_at_line_42' */ #define __dead_code(line) do { \ - extern void dead_code_assertion_failed_at_line_##line(void); \ + extern void dead_code_assertion_failed_at_line_##line(void) \ + __attribute__((__noreturn__)); \ dead_code_assertion_failed_at_line_##line(); \ } while (0) #define _dead_code(line) __dead_code(line)