[PATCH] rtems: Improve RTEMS_NO_RETURN attribute
Sebastian Huber
sebastian.huber at embedded-brains.de
Tue Oct 6 06:06:26 UTC 2020
Provide RTEMS_NO_RETURN also in case RTEMS_DEBUG is defined to prevent errors
like this:
error: no return statement in function returning non-void [-Werror=return-type]
Use C11 and C++11 standard means to declare a no-return function.
Close #4122.
---
cpukit/include/rtems/score/basedefs.h | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/cpukit/include/rtems/score/basedefs.h b/cpukit/include/rtems/score/basedefs.h
index c31b4ebef7..0244af1471 100644
--- a/cpukit/include/rtems/score/basedefs.h
+++ b/cpukit/include/rtems/score/basedefs.h
@@ -94,9 +94,11 @@
* can impact the code generated following calls to
* rtems_fatal_error_occurred and _Terminate.
*/
-#if defined(RTEMS_SCHEDSIM)
- #define RTEMS_NO_RETURN
-#elif defined(__GNUC__) && !defined(RTEMS_DEBUG)
+#if __cplusplus >= 201103L
+ #define RTEMS_NO_RETURN [[noreturn]]
+#elif __STDC_VERSION__ >= 201112L
+ #define RTEMS_NO_RETURN _Noreturn
+#elif defined(__GNUC__)
#define RTEMS_NO_RETURN __attribute__((__noreturn__))
#else
#define RTEMS_NO_RETURN
--
2.26.2
More information about the devel
mailing list