58#ifndef _RTEMS_SCORE_BASEDEFS_H
59#define _RTEMS_SCORE_BASEDEFS_H
61#include <rtems/score/cpuopts.h>
103 #define RTEMS_ALIAS( _target ) __attribute__(( __alias__( #_target ) ))
105 #define RTEMS_ALIAS( _target )
123#define RTEMS_ALIGN_DOWN( _value, _alignment ) \
124 ( ( _value ) & ~( ( _alignment ) - 1 ) )
141#define RTEMS_ALIGN_UP( _value, _alignment ) \
142 ( ( ( _value ) + ( _alignment ) - 1 ) & ~( ( _alignment ) - 1 ) )
155 #define RTEMS_ALIGNED( _alignment ) __attribute__(( __aligned__( _alignment ) ))
157 #define RTEMS_ALIGNED( _alignment )
171#if __cplusplus >= 201103L
172 #define RTEMS_ALIGNOF( _type_name ) alignof( _type_name )
173#elif __STDC_VERSION__ >= 201112L
174 #define RTEMS_ALIGNOF( _type_name ) _Alignof( _type_name )
176 #define RTEMS_ALIGNOF( _type_name ) sizeof( _type_name )
191 #define RTEMS_ALLOC_ALIGN( _index ) __attribute__(( __alloc_align__( _index ) ))
193 #define RTEMS_ALLOC_ALIGN( _index )
207 #define RTEMS_ALLOC_SIZE( _index ) __attribute__(( __alloc_size__( _index ) ))
209 #define RTEMS_ALLOC_SIZE( _index )
227 #define RTEMS_ALLOC_SIZE_2( _count_index, _size_index ) \
228 __attribute__(( __alloc_size__( _count_index, _size_index ) ))
230 #define RTEMS_ALLOC_SIZE_2( _count_index, _size_index )
244#define RTEMS_ARRAY_SIZE( _array ) \
245 ( sizeof( _array ) / sizeof( ( _array )[ 0 ] ) )
256 #define RTEMS_COMPILER_MEMORY_BARRIER() __asm__ volatile( "" ::: "memory" )
258 #define RTEMS_COMPILER_MEMORY_BARRIER() do { } while ( 0 )
274#define RTEMS_CONCAT( _x, _y ) _x##_y
286 #define RTEMS_CONST __attribute__(( __const__ ))
306#define RTEMS_CONTAINER_OF( _m, _type, _member_name ) \
307 ( (_type *) ( (uintptr_t) ( _m ) - offsetof( _type, _member_name ) ) )
321#define RTEMS_DECLARE_GLOBAL_SYMBOL( _name ) extern char _name[]
332 #define RTEMS_DEPRECATED __attribute__(( __deprecated__ ))
334 #define RTEMS_DEPRECATED
344#define RTEMS_COMPILER_DEPRECATED_ATTRIBUTE RTEMS_DEPRECATED
355#define RTEMS_EXPAND( _token ) _token
365#if defined(__cplusplus) && defined(__GNUC__)
366 #define RTEMS_FUNCTION_NAME __PRETTY_FUNCTION__
368 #define RTEMS_FUNCTION_NAME __func__
379#if __cplusplus >= 201103L
380 #define RTEMS_NO_RETURN [[noreturn]]
381#elif __STDC_VERSION__ >= 201112L
382 #define RTEMS_NO_RETURN _Noreturn
383#elif defined(__GNUC__)
384 #define RTEMS_NO_RETURN __attribute__(( __noreturn__ ))
386 #define RTEMS_NO_RETURN
396#define RTEMS_COMPILER_NO_RETURN_ATTRIBUTE RTEMS_NO_RETURN
409 #define RTEMS_SECTION( _section ) __attribute__(( __section__( _section ) ))
411 #define RTEMS_SECTION( _section )
426#define RTEMS_STRING( ... ) #__VA_ARGS__
445 #define RTEMS_TYPEOF_REFX( _level, _target ) \
446 __typeof__( _level( union { int _z; __typeof__( _target ) _x; } ){ 0 }._x )
448 #define RTEMS_TYPEOF_REFX( _level, _target )
466#define RTEMS_XCONCAT( _x, _y ) RTEMS_CONCAT( _x, _y )
468#if !defined(ASM) && defined(RTEMS_DEBUG)
498 #if defined(__GNUC__)
499 __attribute__((__error__(
"RTEMS_DEQUALIFY() types differ not only by volatile and const"))) void *
520#if defined(__cplusplus)
521 #define RTEMS_DEQUALIFY_DEPTHX( _ptr_level, _type, _var ) \
522 ( const_cast<_type>( _var ) )
523#elif defined(__GNUC__)
524 #define RTEMS_DEQUALIFY_DEPTHX( _ptr_level, _type, _var ) \
525 __builtin_choose_expr( \
526 __builtin_types_compatible_p( \
527 RTEMS_TYPEOF_REFX( _ptr_level, _var ), \
528 RTEMS_TYPEOF_REFX( _ptr_level, _type ) \
530 __builtin_types_compatible_p( \
535 RTEMS_DEQUALIFY_types_not_compatible() \
538 #define RTEMS_DEQUALIFY_DEPTHX( _ptr_level, _type, _var ) \
539 ( (_type) (uintptr_t) (const volatile void *)( _var ) )
554#define RTEMS_DECONST( _type, _var ) RTEMS_DEQUALIFY_DEPTHX( *, _type, _var )
568#define RTEMS_DEQUALIFY( _type, _var ) RTEMS_DEQUALIFY_DEPTHX( *, _type, _var )
582#define RTEMS_DEVOLATILE( _type, _var ) RTEMS_DEQUALIFY_DEPTHX( *, _type, _var )
614 #define RTEMS_HAVE_MEMBER_SAME_TYPE( _t_lhs, _m_lhs, _t_rhs, _m_rhs ) \
615 __builtin_types_compatible_p( \
616 __typeof__( ( (_t_lhs *) 0 )->_m_lhs ), \
617 __typeof__( ( (_t_rhs *) 0 )->_m_rhs ) \
620 #define RTEMS_HAVE_MEMBER_SAME_TYPE( _t_lhs, _m_lhs, _t_rhs, _m_rhs ) true
632 #define RTEMS_INLINE_ROUTINE static __inline__
634 #define RTEMS_INLINE_ROUTINE static inline
646 #define RTEMS_MALLOCLIKE __attribute__(( __malloc__ ))
648 #define RTEMS_MALLOCLIKE
660 #define RTEMS_NO_INLINE __attribute__(( __noinline__ ))
662 #define RTEMS_NO_INLINE
673#define RTEMS_NOINIT RTEMS_SECTION( ".noinit" )
688 #define RTEMS_OBFUSCATE_VARIABLE( _var ) __asm__( "" : "+r" ( _var ) )
690 #define RTEMS_OBFUSCATE_VARIABLE( _var ) (void) ( _var )
702 #define RTEMS_PACKED __attribute__(( __packed__ ))
714#define RTEMS_COMPILER_PACKED_ATTRIBUTE RTEMS_PACKED
730 #define RTEMS_PREDICT_FALSE( _exp ) __builtin_expect( ( _exp ), 0 )
732 #define RTEMS_PREDICT_FALSE( _exp ) ( _exp )
749 #define RTEMS_PREDICT_TRUE( _exp ) __builtin_expect( ( _exp ), 1 )
751 #define RTEMS_PREDICT_TRUE( _exp ) ( _exp )
769 #define RTEMS_PRINTFLIKE( _format_pos, _ap_pos ) \
770 __attribute__(( __format__( __printf__, _format_pos, _ap_pos ) ))
772 #define RTEMS_PRINTFLIKE( _format_pos, _ap_pos )
785 #define RTEMS_PURE __attribute__(( __pure__ ))
797#define RTEMS_COMPILER_PURE_ATTRIBUTE RTEMS_PURE
809 #define RTEMS_RETURN_ADDRESS() __builtin_return_address( 0 )
811 #define RTEMS_RETURN_ADDRESS() NULL
821#if defined(__COVERITY__)
822 #define RTEMS_STATIC_ANALYSIS
836#if __cplusplus >= 201103L
837 #define RTEMS_STATIC_ASSERT( _cond, _msg ) static_assert( _cond, # _msg )
838#elif __STDC_VERSION__ >= 201112L
839 #define RTEMS_STATIC_ASSERT( _cond, _msg ) _Static_assert( _cond, # _msg )
841 #define RTEMS_STATIC_ASSERT( _cond, _msg ) \
842 struct rtems_static_assert_ ## _msg \
843 { int rtems_static_assert_ ## _msg : ( _cond ) ? 1 : -1; }
858#if defined(__USER_LABEL_PREFIX__)
859 #define RTEMS_SYMBOL_NAME( _name ) RTEMS_XCONCAT( __USER_LABEL_PREFIX__, _name )
861 #define RTEMS_SYMBOL_NAME( _name ) RTEMS_EXPAND( _name )
882#if defined(RTEMS_DEBUG)
883 #define RTEMS_UNREACHABLE() \
884 _Debug_Unreachable( __FILE__, __LINE__, RTEMS_FUNCTION_NAME )
885#elif defined(__GNUC__)
886 #define RTEMS_UNREACHABLE() __builtin_unreachable()
888 #define RTEMS_UNREACHABLE() do { } while ( 0 )
900 #define RTEMS_UNUSED __attribute__(( __unused__ ))
912#define RTEMS_COMPILER_UNUSED_ATTRIBUTE RTEMS_UNUSED
922 #define RTEMS_USED __attribute__(( __used__ ))
936 #define RTEMS_WARN_UNUSED_RESULT __attribute__(( __warn_unused_result__ ))
938 #define RTEMS_WARN_UNUSED_RESULT
953 #define RTEMS_WEAK __attribute__(( __weak__ ))
969 #define RTEMS_WEAK_ALIAS( _target ) \
970 __attribute__(( __weak__, __alias__( #_target ) ))
972 #define RTEMS_WEAK_ALIAS( _target )
987#define RTEMS_XSTRING( ... ) RTEMS_STRING( __VA_ARGS__ )
1007#if defined(__GNUC__)
1008 #define RTEMS_DEFINE_GLOBAL_SYMBOL( _name, _value ) \
1010 "\t.globl " RTEMS_XSTRING( RTEMS_SYMBOL_NAME( _name ) ) \
1011 "\n\t.set " RTEMS_XSTRING( RTEMS_SYMBOL_NAME( _name ) ) \
1012 ", " RTEMS_STRING( _value ) "\n" \
1015 #define RTEMS_DEFINE_GLOBAL_SYMBOL( _name, _value )
1029#if __STDC_VERSION__ >= 199409L
1030 #define RTEMS_ZERO_LENGTH_ARRAY
1032 #define RTEMS_ZERO_LENGTH_ARRAY 0
#define RTEMS_NO_RETURN
Tells the compiler in a function declaration that this function does not return.
Definition: basedefs.h:386
void * RTEMS_DEQUALIFY_types_not_compatible(void)
A not implemented function to trigger compile time errors with an error message.
Definition: xnandpsu_onfi.h:181
Definition: mongoose.c:448