[rtems commit] rtems: Avoid -Wundef warnings in API header

Sebastian Huber sebh at rtems.org
Sat Mar 23 09:57:02 UTC 2024


Module:    rtems
Branch:    master
Commit:    1ef5fa07aa87adc9925c75060a7888f110104fa7
Changeset: http://git.rtems.org/rtems/commit/?id=1ef5fa07aa87adc9925c75060a7888f110104fa7

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Mar 22 10:31:57 2024 +0100

rtems: Avoid -Wundef warnings in API header

---

 cpukit/include/rtems/score/basedefs.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/cpukit/include/rtems/score/basedefs.h b/cpukit/include/rtems/score/basedefs.h
index 4f28e6a525..010728d795 100644
--- a/cpukit/include/rtems/score/basedefs.h
+++ b/cpukit/include/rtems/score/basedefs.h
@@ -168,9 +168,9 @@ extern "C" {
  *
  * @return Returns the alignment requirement of the type.
  */
-#if __cplusplus >= 201103L
+#if defined( __cplusplus ) && __cplusplus >= 201103L
   #define RTEMS_ALIGNOF( _type_name ) alignof( _type_name )
-#elif __STDC_VERSION__ >= 201112L
+#elif defined( __STDC_VERSION__ ) && __STDC_VERSION__ >= 201112L
   #define RTEMS_ALIGNOF( _type_name ) _Alignof( _type_name )
 #else
   #define RTEMS_ALIGNOF( _type_name ) sizeof( _type_name )
@@ -376,9 +376,9 @@ extern "C" {
  * @brief Tells the compiler in a function declaration that this function does
  *   not return.
  */
-#if __cplusplus >= 201103L
+#if defined( __cplusplus ) && __cplusplus >= 201103L
   #define RTEMS_NO_RETURN [[noreturn]]
-#elif __STDC_VERSION__ >= 201112L
+#elif defined( __STDC_VERSION__ ) && __STDC_VERSION__ >= 201112L
   #define RTEMS_NO_RETURN _Noreturn
 #elif defined(__GNUC__)
   #define RTEMS_NO_RETURN __attribute__(( __noreturn__ ))
@@ -833,9 +833,9 @@ extern "C" {
  *
  * @param _msg is the error message in case the static assertion fails.
  */
-#if __cplusplus >= 201103L
+#if defined( __cplusplus ) && __cplusplus >= 201103L
   #define RTEMS_STATIC_ASSERT( _cond, _msg ) static_assert( _cond, # _msg )
-#elif __STDC_VERSION__ >= 201112L
+#elif defined( __STDC_VERSION__ ) && __STDC_VERSION__ >= 201112L
   #define RTEMS_STATIC_ASSERT( _cond, _msg ) _Static_assert( _cond, # _msg )
 #else
   #define RTEMS_STATIC_ASSERT( _cond, _msg ) \



More information about the vc mailing list