summaryrefslogtreecommitdiff
path: root/src/include
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/include
parent261d626669ea244a55ec310a11a23ca56b609b51 (diff)
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/include')
-rw-r--r--src/include/compiler.h1
-rw-r--r--src/include/console/console.h3
-rw-r--r--src/include/halt.h3
-rw-r--r--src/include/reset.h8
4 files changed, 10 insertions, 5 deletions
diff --git a/src/include/compiler.h b/src/include/compiler.h
index e088eb1a51..4df1cab7e6 100644
--- a/src/include/compiler.h
+++ b/src/include/compiler.h
@@ -26,5 +26,6 @@
#define __always_unused __attribute__((unused))
#define __must_check __attribute__((warn_unused_result))
#define __weak __attribute__((weak))
+#define __noreturn __attribute__((noreturn))
#endif
diff --git a/src/include/console/console.h b/src/include/console/console.h
index 535401f7db..ff20782398 100644
--- a/src/include/console/console.h
+++ b/src/include/console/console.h
@@ -19,6 +19,7 @@
#include <stdint.h>
#include <rules.h>
#include <arch/cpu.h>
+#include <compiler.h>
#include <console/post_codes.h>
#include <commonlib/loglevel.h>
@@ -40,7 +41,7 @@ void post_log_clear(void);
#endif
/* this function is weak and can be overridden by a mainboard function. */
void mainboard_post(u8 value);
-void __attribute__((noreturn)) die(const char *msg);
+void __noreturn die(const char *msg);
/*
* This function is weak and can be overridden to provide additional
diff --git a/src/include/halt.h b/src/include/halt.h
index 7ecd41a6cd..e8f1b51976 100644
--- a/src/include/halt.h
+++ b/src/include/halt.h
@@ -20,10 +20,11 @@
#ifdef __ROMCC__
#include <lib/halt.c>
#else
+#include <compiler.h>
/**
* halt the system reliably
*/
-void __attribute__((noreturn)) halt(void);
+void __noreturn halt(void);
#endif /* __ROMCC__ */
/* Power off the system. */
diff --git a/src/include/reset.h b/src/include/reset.h
index 934ed9b1fc..48999164bb 100644
--- a/src/include/reset.h
+++ b/src/include/reset.h
@@ -1,14 +1,16 @@
#ifndef RESET_H
#define RESET_H
+#include <compiler.h>
+
/* Generic reset functions. Call from code that wants to trigger a reset. */
/* Super-hard reset specific to some Intel SoCs. */
-__attribute__((noreturn)) void global_reset(void);
+__noreturn void global_reset(void);
/* Full board reset. Resets SoC and most/all board components (e.g. DRAM). */
-__attribute__((noreturn)) void hard_reset(void);
+__noreturn void hard_reset(void);
/* Board reset. Resets SoC some board components (e.g. TPM but not DRAM). */
-__attribute__((noreturn)) void soft_reset(void);
+__noreturn void soft_reset(void);
/* Reset implementations. Implement these in SoC or mainboard code. Implement
at least hard_reset() if possible, others fall back to it if necessary. */