[rtems commit] Minor conditionals to enable building Scheduler Simulator on GNU/Linux

Joel Sherrill joel at rtems.org
Fri May 30 19:59:28 UTC 2014


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

Author:    Joel Sherrill <joel.sherrill at oarcorp.com>
Date:      Mon Apr 14 16:05:04 2014 -0500

Minor conditionals to enable building Scheduler Simulator on GNU/Linux

- rtems/score/assert.h: Scheduler Simulator uses glibc assert.h on GNU/Linux.
  This will likely need to be adjusted more for other host compilers and
  C libraries. Also disable _Assert_Not_reached() because some of these
  paths do actually return to the called on the Scheduler Simulator.

- basedefs.h: Do not use noreturn attribute when on Scheduler Simulator.
  Paths which context switch can return to the command interpreter on
  the Scheduler Simulator.

---

 cpukit/score/include/rtems/score/assert.h   |   26 ++++++++++++++++++++++----
 cpukit/score/include/rtems/score/basedefs.h |    4 +++-
 2 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/cpukit/score/include/rtems/score/assert.h b/cpukit/score/include/rtems/score/assert.h
index 41ef1ae..b8d9463 100644
--- a/cpukit/score/include/rtems/score/assert.h
+++ b/cpukit/score/include/rtems/score/assert.h
@@ -30,10 +30,24 @@ extern "C" {
  * NDEBUG.
  */
 #if defined( RTEMS_DEBUG )
-  #define _Assert( _e ) \
-    ( ( _e ) ? \
-      ( void ) 0 : \
-        __assert_func( __FILE__, __LINE__, __ASSERT_FUNC, #_e ) )
+  #if !defined( RTEMS_SCHEDSIM )
+    /* __ASSERT_FUNC is newlib. */
+    #define _Assert( _e ) \
+      ( ( _e ) ? \
+        ( void ) 0 : \
+          __assert_func( __FILE__, __LINE__, __ASSERT_FUNC, #_e ) )
+  #else
+    /* __ASSERT_FUNCTION is glibc. */
+    #if defined(__ASSERT_FUNCTION)
+      #define _Assert( _e ) \
+	( ( _e ) ? \
+	  ( void ) 0 : \
+	    __assert_fail( #_e, __FILE__, __LINE__, __ASSERT_FUNCTION ) )
+    #else
+       #error "What does assert.h use?"
+    #endif
+  #endif
+
 #else
   #define _Assert( _e ) ( ( void ) 0 )
 #endif
@@ -70,7 +84,11 @@ extern "C" {
 /**
  * @brief Asserts that this point is not reached during run-time.
  */
+#if RTEMS_SCHEDSIM
+#define _Assert_Not_reached()
+#else
 #define _Assert_Not_reached() _Assert( 0 )
+#endif
 
 #ifdef __cplusplus
 }
diff --git a/cpukit/score/include/rtems/score/basedefs.h b/cpukit/score/include/rtems/score/basedefs.h
index a0bebdd..382a97a 100644
--- a/cpukit/score/include/rtems/score/basedefs.h
+++ b/cpukit/score/include/rtems/score/basedefs.h
@@ -153,7 +153,9 @@
  *  can impact the code generated following calls to
  *  rtems_fatal_error_occurred and _Terminate.
  */
-#ifdef __GNUC__
+#if defined(RTEMS_SCHEDSIM)
+  #define RTEMS_COMPILER_NO_RETURN_ATTRIBUTE
+#elif defined(__GNUC__)
   #define RTEMS_COMPILER_NO_RETURN_ATTRIBUTE \
       __attribute__ ((noreturn))
 #else




More information about the vc mailing list