20 #ifndef _RTEMS_BASEDEFS_H 21 #define _RTEMS_BASEDEFS_H 30 #include <rtems/score/cpuopts.h> 53 #error "TRUE equals FALSE" 63 #define RTEMS_INLINE_ROUTINE static __inline__ 65 #define RTEMS_INLINE_ROUTINE static inline 74 #define RTEMS_COMPILER_MEMORY_BARRIER() __asm__ volatile("" ::: "memory") 76 #define RTEMS_COMPILER_MEMORY_BARRIER() 84 #define RTEMS_NO_INLINE __attribute__((__noinline__)) 86 #define RTEMS_NO_INLINE 96 #if defined(RTEMS_SCHEDSIM) 97 #define RTEMS_NO_RETURN 98 #elif defined(__GNUC__) && !defined(RTEMS_DEBUG) 99 #define RTEMS_NO_RETURN __attribute__((__noreturn__)) 101 #define RTEMS_NO_RETURN 105 #define RTEMS_COMPILER_NO_RETURN_ATTRIBUTE RTEMS_NO_RETURN 114 #define RTEMS_PURE __attribute__((__pure__)) 120 #define RTEMS_COMPILER_PURE_ATTRIBUTE RTEMS_PURE 127 #define RTEMS_DEPRECATED __attribute__((__deprecated__)) 129 #define RTEMS_DEPRECATED 133 #define RTEMS_COMPILER_DEPRECATED_ATTRIBUTE RTEMS_DEPRECATED 139 #if defined(__GNUC__) 140 #define RTEMS_SECTION( _section ) __attribute__((__section__(_section))) 142 #define RTEMS_SECTION( _section ) 148 #if defined(__GNUC__) 149 #define RTEMS_USED __attribute__((__used__)) 159 #if defined(__GNUC__) 160 #define RTEMS_UNUSED __attribute__((__unused__)) 166 #define RTEMS_COMPILER_UNUSED_ATTRIBUTE RTEMS_UNUSED 172 #if defined(__GNUC__) 173 #define RTEMS_PACKED __attribute__((__packed__)) 182 #if defined(__GNUC__) 183 #define RTEMS_ALIAS( _target ) __attribute__((__alias__(#_target))) 185 #define RTEMS_ALIAS( _target ) 192 #if defined(__GNUC__) 193 #define RTEMS_WEAK_ALIAS( _target ) __attribute__((__weak__, __alias__(#_target))) 195 #define RTEMS_WEAK_ALIAS( _target ) 201 #if defined(__GNUC__) 202 #define RTEMS_ALIGNED( _alignment ) __attribute__((__aligned__(_alignment))) 204 #define RTEMS_ALIGNED( _alignment ) 208 #define RTEMS_COMPILER_PACKED_ATTRIBUTE RTEMS_PACKED 210 #if defined(RTEMS_DEBUG) && !defined(RTEMS_SCHEDSIM) 211 #define _Assert_Unreachable() _Assert( 0 ) 213 #define _Assert_Unreachable() do { } while ( 0 ) 219 #if defined(__GNUC__) && !defined(RTEMS_SCHEDSIM) 220 #define RTEMS_UNREACHABLE() \ 222 __builtin_unreachable(); \ 223 _Assert_Unreachable(); \ 226 #define RTEMS_UNREACHABLE() _Assert_Unreachable() 233 #if defined(__GNUC__) 234 #define RTEMS_PRINTFLIKE( _format_pos, _ap_pos ) \ 235 __attribute__((__format__(__printf__, _format_pos, _ap_pos))) 237 #define RTEMS_PRINTFLIKE( _format_pos, _ap_pos ) 244 #if defined(__GNUC__) 245 #define RTEMS_MALLOCLIKE __attribute__((__malloc__)) 247 #define RTEMS_MALLOCLIKE 254 #if defined(__GNUC__) 255 #define RTEMS_ALLOC_SIZE( _index ) __attribute__((__alloc_size__(_index))) 257 #define RTEMS_ALLOC_SIZE( _index ) 264 #if defined(__GNUC__) 265 #define RTEMS_ALLOC_SIZE_2( _count_index, _size_index ) \ 266 __attribute__((__alloc_size__(_count_index, _size_index))) 268 #define RTEMS_ALLOC_SIZE_2( _count_index, _size_index ) 275 #if defined(__GNUC__) 276 #define RTEMS_ALLOC_ALIGN( _index ) __attribute__((__alloc_align__(_index))) 278 #define RTEMS_ALLOC_ALIGN( _index ) 284 #if defined(__GNUC__) 285 #define RTEMS_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) 287 #define RTEMS_WARN_UNUSED_RESULT 296 #if defined(__GNUC__) 297 #define RTEMS_OBFUSCATE_VARIABLE( _var ) __asm__("" : "+r" (_var)) 299 #define RTEMS_OBFUSCATE_VARIABLE( _var ) (void) (_var) 309 #define RTEMS_DECLARE_GLOBAL_SYMBOL( _name ) \ 323 #if defined(__GNUC__) 324 #define RTEMS_DEFINE_GLOBAL_SYMBOL( _name, _value ) \ 326 "\t.globl " RTEMS_XSTRING( __USER_LABEL_PREFIX__ ) #_name \ 327 "\n\t.set " RTEMS_XSTRING( __USER_LABEL_PREFIX__ ) #_name \ 328 ", " RTEMS_STRING( _value ) "\n" \ 331 #define RTEMS_DEFINE_GLOBAL_SYMBOL( _name, _value ) 342 #if defined(__GNUC__) 343 #define RTEMS_PREDICT_TRUE( _exp ) __builtin_expect( ( _exp ), 1 ) 345 #define RTEMS_PREDICT_TRUE( _exp ) ( _exp ) 356 #if defined(__GNUC__) 357 #define RTEMS_PREDICT_FALSE( _exp ) __builtin_expect( ( _exp ), 0 ) 359 #define RTEMS_PREDICT_FALSE( _exp ) ( _exp ) 362 #if __cplusplus >= 201103L 363 #define RTEMS_STATIC_ASSERT(cond, msg) \ 364 static_assert(cond, # msg) 365 #elif __STDC_VERSION__ >= 201112L 366 #define RTEMS_STATIC_ASSERT(cond, msg) \ 367 _Static_assert(cond, # msg) 369 #define RTEMS_STATIC_ASSERT(cond, msg) \ 370 struct rtems_static_assert_ ## msg \ 371 { int rtems_static_assert_ ## msg : (cond) ? 1 : -1; } 374 #define RTEMS_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) 381 #define RTEMS_ZERO_LENGTH_ARRAY 0 390 #define RTEMS_CONTAINER_OF( _m, _type, _member_name ) \ 391 ( (_type *) ( (uintptr_t) ( _m ) - offsetof( _type, _member_name ) ) ) 394 #define RTEMS_DEQUALIFY_DEPTHX( _ptr_level, _type, _var ) \ 395 (const_cast<_type>( _var )) 399 #define RTEMS_TYPEOF_REFX(_ptr_level, _ptr_type) \ 400 __typeof__(_ptr_level(union { int z; __typeof__(_ptr_type) x; }){0}.x) 402 #if defined(__GNUC__) && !defined(ASM) 403 #if ((__GNUC__ * 1000 + __GNUC_MINOR__) >= 4004) 404 extern void* RTEMS_DEQUALIFY_types_not_compatible(
void)
405 __attribute__((error (
"RTEMS_DEQUALIFY types differ not only by volatile and const")));
407 extern void RTEMS_DEQUALIFY_types_not_compatible(
void);
409 #define RTEMS_DEQUALIFY_DEPTHX( _ptr_level, _type, _var ) ( \ 410 __builtin_choose_expr( __builtin_types_compatible_p ( \ 411 RTEMS_TYPEOF_REFX( _ptr_level, _var ), \ 412 RTEMS_TYPEOF_REFX( _ptr_level, _type ) \ 413 ) || __builtin_types_compatible_p ( _type, void * ), \ 415 RTEMS_DEQUALIFY_types_not_compatible() \ 421 #ifndef RTEMS_DECONST 422 #ifdef RTEMS_DEQUALIFY_DEPTHX 423 #define RTEMS_DECONST( _type, _var ) \ 424 RTEMS_DEQUALIFY_DEPTHX( *, _type, _var ) 432 #define RTEMS_DECONST( _type, _var ) \ 433 ((_type)(uintptr_t)(const void *) ( _var )) 438 #ifndef RTEMS_DEVOLATILE 439 #ifdef RTEMS_DEQUALIFY_DEPTHX 440 #define RTEMS_DEVOLATILE( _type, _var ) \ 441 RTEMS_DEQUALIFY_DEPTHX( *, _type, _var ) 449 #define RTEMS_DEVOLATILE( _type, _var ) \ 450 ((_type)(uintptr_t)(volatile void *) ( _var )) 455 #ifndef RTEMS_DEQUALIFY 456 #ifdef RTEMS_DEQUALIFY_DEPTHX 457 #define RTEMS_DEQUALIFY( _type, _var ) \ 458 RTEMS_DEQUALIFY_DEPTHX( *, _type, _var ) 466 #define RTEMS_DEQUALIFY( _type, _var ) \ 467 ((_type)(uintptr_t)(const volatile void *) ( _var )) 481 #define RTEMS_HAVE_MEMBER_SAME_TYPE( _t_lhs, _m_lhs, _t_rhs, _m_rhs ) \ 482 __builtin_types_compatible_p( \ 483 __typeof__( ( (_t_lhs *) 0 )->_m_lhs ), \ 484 __typeof__( ( (_t_rhs *) 0 )->_m_rhs ) \ 487 #define RTEMS_HAVE_MEMBER_SAME_TYPE( _t_lhs, _m_lhs, _t_rhs, _m_rhs ) \ 494 #define RTEMS_CONCAT( _x, _y ) _x##_y 499 #define RTEMS_XCONCAT( _x, _y ) RTEMS_CONCAT( _x, _y ) 504 #define RTEMS_STRING( _x ) #_x 509 #define RTEMS_XSTRING( _x ) RTEMS_STRING( _x ) 512 #ifdef RTEMS_DEPRECATED_TYPES typedef __attribute__
Disable IRQ Interrupts.
Definition: cmsis_gcc.h:69
#define RTEMS_DEPRECATED
Public name for task floating point context area.
Definition: basedefs.h:129