source: rtems/cpukit/score/include/rtems/score/assert.h @ e91ab8c

4.115
Last change on this file since e91ab8c was 8e7db68c, checked in by Joel Sherrill <joel.sherrill@…>, on 04/14/14 at 21:05:04

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.
  • Property mode set to 100644
File size: 2.1 KB
Line 
1/*
2 * Copyright (c) 2013-2014 embedded brains GmbH.  All rights reserved.
3 *
4 *  embedded brains GmbH
5 *  Dornierstr. 4
6 *  82178 Puchheim
7 *  Germany
8 *  <rtems@embedded-brains.de>
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.org/license/LICENSE.
13 */
14
15#ifndef _RTEMS_SCORE_ASSERT_H
16#define _RTEMS_SCORE_ASSERT_H
17
18#include <rtems/score/basedefs.h>
19
20#if defined( RTEMS_DEBUG )
21  #include <assert.h>
22#endif
23
24#ifdef __cplusplus
25extern "C" {
26#endif /* __cplusplus */
27
28/**
29 * @brief Assertion similar to assert() controlled via RTEMS_DEBUG instead of
30 * NDEBUG.
31 */
32#if defined( RTEMS_DEBUG )
33  #if !defined( RTEMS_SCHEDSIM )
34    /* __ASSERT_FUNC is newlib. */
35    #define _Assert( _e ) \
36      ( ( _e ) ? \
37        ( void ) 0 : \
38          __assert_func( __FILE__, __LINE__, __ASSERT_FUNC, #_e ) )
39  #else
40    /* __ASSERT_FUNCTION is glibc. */
41    #if defined(__ASSERT_FUNCTION)
42      #define _Assert( _e ) \
43        ( ( _e ) ? \
44          ( void ) 0 : \
45            __assert_fail( #_e, __FILE__, __LINE__, __ASSERT_FUNCTION ) )
46    #else
47       #error "What does assert.h use?"
48    #endif
49  #endif
50
51#else
52  #define _Assert( _e ) ( ( void ) 0 )
53#endif
54
55/**
56 * @brief Returns true if thread dispatching is allowed.
57 *
58 * Thread dispatching can be repressed via _Thread_Disable_dispatch() or
59 * _ISR_Disable().
60 */
61#if defined( RTEMS_DEBUG )
62  bool _Debug_Is_thread_dispatching_allowed( void );
63#endif
64
65/**
66 * @brief Returns true if the current thread of execution owns the giant lock.
67 */
68#if defined( RTEMS_DEBUG )
69  #if defined( RTEMS_SMP )
70    bool _Debug_Is_owner_of_giant( void );
71  #else
72    #define _Debug_Is_owner_of_giant() (true)
73  #endif
74#endif
75
76/**
77 * @brief Returns true if the current thread of execution owns the allocator
78 * mutex.
79 */
80#if defined( RTEMS_DEBUG )
81  bool _Debug_Is_owner_of_allocator( void );
82#endif
83
84/**
85 * @brief Asserts that this point is not reached during run-time.
86 */
87#if RTEMS_SCHEDSIM
88#define _Assert_Not_reached()
89#else
90#define _Assert_Not_reached() _Assert( 0 )
91#endif
92
93#ifdef __cplusplus
94}
95#endif /* __cplusplus */
96
97#endif /* _RTEMS_SCORE_ASSERT_H */
Note: See TracBrowser for help on using the repository browser.