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)
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32833 )
Change subject: src/include/assert.h: add noreturn attribute to dead_code() ......................................................................
Patch Set 1:
(1 comment)
https://review.coreboot.org/#/c/32833/1/src/include/assert.h File src/include/assert.h:
https://review.coreboot.org/#/c/32833/1/src/include/assert.h@59 PS1, Line 59: extern void dead_code_assertion_failed_at_line_##line(void) \ function definition argument 'void' should also have an identifier name
Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32833 )
Change subject: src/include/assert.h: add noreturn attribute to dead_code() ......................................................................
Patch Set 5: Code-Review+2
Patrick Georgi has submitted this change and it was merged. ( 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 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 --- M src/include/assert.h 1 file changed, 2 insertions(+), 1 deletion(-)
Approvals: build bot (Jenkins): Verified Julius Werner: Looks good to me, approved
diff --git a/src/include/assert.h b/src/include/assert.h index 4575a29..e0db0bc 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)