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
Reviewed-on: https://review.coreboot.org/c/coreboot/+/32833
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Alan Green 2019-05-16 08:52:12 +10:00 committed by Patrick Georgi
parent 6aca7e6bec
commit 997207d9a6
1 changed files with 2 additions and 1 deletions

View File

@ -56,7 +56,8 @@
* bootmode.c:42: undefined reference to `dead_code_assertion_failed_at_line_42' * bootmode.c:42: undefined reference to `dead_code_assertion_failed_at_line_42'
*/ */
#define __dead_code(line) do { \ #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(); \ dead_code_assertion_failed_at_line_##line(); \
} while (0) } while (0)
#define _dead_code(line) __dead_code(line) #define _dead_code(line) __dead_code(line)