summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2018-09-05 09:37:11 -0600
committerPatrick Georgi <pgeorgi@google.com>2018-09-10 15:02:51 +0000
commit0370bcf40ce3a07e6e2d33b8bcebf28a0ac98807 (patch)
tree8dbdeded229ced4fc7bf7579954798ddfb7d7439 /src/lib
parent261d626669ea244a55ec310a11a23ca56b609b51 (diff)
downloadcoreboot-0370bcf40ce3a07e6e2d33b8bcebf28a0ac98807.tar.xz
complier.h: add __noreturn and use it in code base
Add a __noreturn macro that wraps __attribute__((noreturn)) and replace current users with the macro. Change-Id: Iddd0728cf79678c3d1c1f7e7946c27375a644a7d Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/28505 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Furquan Shaikh <furquan@google.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/reset.c2
-rw-r--r--src/lib/ubsan.c13
2 files changed, 6 insertions, 9 deletions
diff --git a/src/lib/reset.c b/src/lib/reset.c
index 2c9529277e..d5676e5cd4 100644
--- a/src/lib/reset.c
+++ b/src/lib/reset.c
@@ -19,7 +19,7 @@
#include <halt.h>
#include <reset.h>
-__attribute__((noreturn)) static void __hard_reset(void) {
+__noreturn static void __hard_reset(void) {
if (IS_ENABLED(CONFIG_HAVE_HARD_RESET))
do_hard_reset();
else
diff --git a/src/lib/ubsan.c b/src/lib/ubsan.c
index ead0e18026..128340092f 100644
--- a/src/lib/ubsan.c
+++ b/src/lib/ubsan.c
@@ -43,8 +43,7 @@ typedef uintptr_t ubsan_value_handle_t;
*/
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
-__attribute__((noreturn))
-static void ubsan_abort(const struct ubsan_source_location *location,
+static void __noreturn ubsan_abort(const struct ubsan_source_location *location,
const char *violation) {
static const struct ubsan_source_location unknown_location = {
"<unknown file>",
@@ -61,8 +60,8 @@ static void ubsan_abort(const struct ubsan_source_location *location,
}
#define ABORT_VARIANT(name, params, call) \
- __attribute__((noreturn)) void __ubsan_handle_##name##_abort params; \
- __attribute__((noreturn)) void __ubsan_handle_##name##_abort params { \
+ __noreturn void __ubsan_handle_##name##_abort params; \
+ __noreturn void __ubsan_handle_##name##_abort params { \
__ubsan_handle_##name call; \
__builtin_unreachable(); \
}
@@ -212,16 +211,14 @@ struct ubsan_unreachable_data {
struct ubsan_source_location location;
};
-__attribute__((noreturn))
-void __ubsan_handle_builtin_unreachable(void *data_raw)
+void __noreturn __ubsan_handle_builtin_unreachable(void *data_raw)
{
struct ubsan_unreachable_data *data =
(struct ubsan_unreachable_data *)data_raw;
ubsan_abort(&data->location, "reached unreachable");
}
-__attribute__((noreturn))
-void __ubsan_handle_missing_return(void *data_raw)
+void __noreturn __ubsan_handle_missing_return(void *data_raw)
{
const struct ubsan_unreachable_data *data =
(struct ubsan_unreachable_data *)data_raw;