summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score/assert.h
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2014-04-14 16:05:04 -0500
committerJoel Sherrill <joel.sherrill@oarcorp.com>2014-05-30 15:07:39 -0500
commit8e7db68c38a87971967c7dde06e84067b3e56c17 (patch)
treece9f0970c901ccb44115656be9d1814465be4574 /cpukit/score/include/rtems/score/assert.h
parentbsps/gdbarmsim: Add the missing bspstarthooks.c. (diff)
downloadrtems-8e7db68c38a87971967c7dde06e84067b3e56c17.tar.bz2
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.
Diffstat (limited to 'cpukit/score/include/rtems/score/assert.h')
-rw-r--r--cpukit/score/include/rtems/score/assert.h26
1 files changed, 22 insertions, 4 deletions
diff --git a/cpukit/score/include/rtems/score/assert.h b/cpukit/score/include/rtems/score/assert.h
index 41ef1aeaa1..b8d9463e03 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
}