RTEMS 6.1-rc1
|
This group contains basic macros and defines to give access to compiler-specific features. More...
Macros | |
#define | RTEMS_ALIAS(_target) |
Instructs the compiler to generate an alias to the target function. More... | |
#define | RTEMS_ALIGN_DOWN(_value, _alignment) ( ( _value ) & ~( ( _alignment ) - 1 ) ) |
Aligns down the value to the alignment. More... | |
#define | RTEMS_ALIGN_UP(_value, _alignment) ( ( ( _value ) + ( _alignment ) - 1 ) & ~( ( _alignment ) - 1 ) ) |
Aligns up the value to the alignment. More... | |
#define | RTEMS_ALIGNED(_alignment) |
Instructs the compiler in a declaration or definition to enforce the alignment. More... | |
#define | RTEMS_ALIGNOF(_type_name) sizeof( _type_name ) |
Gets the alignment requirement of the type. More... | |
#define | RTEMS_ALLOC_ALIGN(_index) |
Tells the compiler in a declaration that the memory allocation alignment parameter of this function is similar to aligned_alloc(). More... | |
#define | RTEMS_ALLOC_SIZE(_index) |
Tells the compiler in a declaration that the memory allocation size parameter of this function is similar to malloc(). More... | |
#define | RTEMS_ALLOC_SIZE_2(_count_index, _size_index) |
Tells the compiler in a declaration that the memory allocation item count and item size parameter of this function is similar to calloc(). More... | |
#define | RTEMS_ARRAY_SIZE(_array) ( sizeof( _array ) / sizeof( ( _array )[ 0 ] ) ) |
Gets the element count of the array. More... | |
#define | RTEMS_COMPILER_MEMORY_BARRIER() do { } while ( 0 ) |
This macro forbids the compiler to reorder read and write commands around it. | |
#define | RTEMS_CONCAT(_x, _y) _x##_y |
Concatenates _x and _y without expanding. More... | |
#define | RTEMS_CONST |
Tells the compiler in a function declaration that this function has no effect except the return value and that the return value depends only on the value of parameters. | |
#define | RTEMS_CONTAINER_OF(_m, _type, _member_name) ( (_type *) ( (uintptr_t) ( _m ) - offsetof( _type, _member_name ) ) ) |
Gets the container of a member. More... | |
#define | RTEMS_DECLARE_GLOBAL_SYMBOL(_name) extern char _name[] |
Declares a global symbol with the name. More... | |
#define | RTEMS_DEPRECATED |
Instructs the compiler in a declaration to issue a warning whenever a variable, function, or type using this declaration will be used. | |
#define | RTEMS_COMPILER_DEPRECATED_ATTRIBUTE RTEMS_DEPRECATED |
Provided for backward compatibility. | |
#define | RTEMS_EXPAND(_token) _token |
Helper macro to perform a macro expansion on the token. More... | |
#define | RTEMS_FUNCTION_NAME __func__ |
Expands to the name of the function containing the use of this define. | |
#define | RTEMS_NO_RETURN |
Tells the compiler in a function declaration that this function does not return. | |
#define | RTEMS_COMPILER_NO_RETURN_ATTRIBUTE RTEMS_NO_RETURN |
Provided for backward compatibility. | |
#define | RTEMS_SECTION(_section) |
Instructs the compiler to place the variable or function in the section. More... | |
#define | RTEMS_STRING(...) #__VA_ARGS__ |
Stringifies the arguments without expanding them. More... | |
#define | RTEMS_TYPEOF_REFX(_level, _target) |
Gets the pointer reference type. More... | |
#define | RTEMS_XCONCAT(_x, _y) RTEMS_CONCAT( _x, _y ) |
Concatenates expansion of _x and expansion of _y. More... | |
#define | RTEMS_DEQUALIFY_DEPTHX(_ptr_level, _type, _var) ( (_type) (uintptr_t) (const volatile void *)( _var ) ) |
Performs a type cast which removes qualifiers without warnings to the type for the variable. More... | |
#define | RTEMS_DECONST(_type, _var) RTEMS_DEQUALIFY_DEPTHX( *, _type, _var ) |
Performs a type cast which removes const qualifiers without warnings to the type for the pointer variable. More... | |
#define | RTEMS_DEQUALIFY(_type, _var) RTEMS_DEQUALIFY_DEPTHX( *, _type, _var ) |
Performs a type cast which removes all qualifiers without warnings to the type for the pointer variable. More... | |
#define | RTEMS_DEVOLATILE(_type, _var) RTEMS_DEQUALIFY_DEPTHX( *, _type, _var ) |
Performs a type cast which removes volatile qualifiers without warnings to the type for the pointer variable. More... | |
#define | FALSE 0 |
If FALSE is undefined, then FALSE is defined to 0. | |
#define | RTEMS_HAVE_MEMBER_SAME_TYPE(_t_lhs, _m_lhs, _t_rhs, _m_rhs) true |
Checks if members of two types have compatible types. More... | |
#define | RTEMS_INLINE_ROUTINE static inline |
Gives a hint to the compiler in a function declaration to inline this function. | |
#define | RTEMS_MALLOCLIKE |
Tells the compiler in a declaration that this function is a memory allocation function similar to malloc(). | |
#define | RTEMS_NO_INLINE |
Instructs the compiler in a function declaration to not inline this function. | |
#define | RTEMS_NOINIT RTEMS_SECTION( ".noinit" ) |
Instructs the compiler to place the variable in a section which is not initialized. | |
#define | RTEMS_OBFUSCATE_VARIABLE(_var) (void) ( _var ) |
Obfuscates the variable so that the compiler cannot perform optimizations based on the variable value. More... | |
#define | RTEMS_PACKED |
Instructs the compiler in a type definition to place members of a structure or union so that the memory required is minimized. | |
#define | RTEMS_COMPILER_PACKED_ATTRIBUTE RTEMS_PACKED |
Provided for backward compatibility. | |
#define | RTEMS_PREDICT_FALSE(_exp) ( _exp ) |
Evaluates the integral expression and tells the compiler that the predicted value is false (0). More... | |
#define | RTEMS_PREDICT_TRUE(_exp) ( _exp ) |
Evaluates the integral expression and tells the compiler that the predicted value is true (1). More... | |
#define | RTEMS_PRINTFLIKE(_format_pos, _ap_pos) |
Tells the compiler in a declaration that this function expects printf()-like arguments. More... | |
#define | RTEMS_PURE |
Tells the compiler in a function declaration that this function has no effect except the return value and that the return value depends only on the value of parameters and/or global variables. | |
#define | RTEMS_COMPILER_PURE_ATTRIBUTE RTEMS_PURE |
Provided for backward compatibility. | |
#define | RTEMS_RETURN_ADDRESS() NULL |
Gets the return address of the current function. More... | |
#define | RTEMS_STATIC_ASSERT(_cond, _msg) |
It is defined if a static analysis run is performed. More... | |
#define | RTEMS_SYMBOL_NAME(_name) RTEMS_EXPAND( _name ) |
Maps the name to the associated symbol name. More... | |
#define | TRUE 1 |
If TRUE is undefined, then TRUE is defined to 1. | |
#define | RTEMS_UNREACHABLE() do { } while ( 0 ) |
Tells the compiler that this program point is unreachable. | |
#define | RTEMS_UNUSED |
Tells the compiler that the variable or function is deliberately unused. | |
#define | RTEMS_COMPILER_UNUSED_ATTRIBUTE RTEMS_UNUSED |
Provided for backward compatibility. | |
#define | RTEMS_USED |
Tells the compiler that the variable or function is used. | |
#define | RTEMS_WARN_UNUSED_RESULT |
Tells the compiler in a declaration that the result of this function should be used. | |
#define | RTEMS_WEAK |
Tells the compiler in a function definition that this function should be weak. More... | |
#define | RTEMS_WEAK_ALIAS(_target) |
Instructs the compiler to generate a weak alias to the target function. More... | |
#define | RTEMS_XSTRING(...) RTEMS_STRING( __VA_ARGS__ ) |
Stringifies the expansion of the arguments. More... | |
#define | RTEMS_DEFINE_GLOBAL_SYMBOL(_name, _value) |
Defines a global symbol with the name and value. More... | |
#define | RTEMS_ZERO_LENGTH_ARRAY 0 |
This constant represents the element count of a zero-length array. More... | |
This group contains basic macros and defines to give access to compiler-specific features.
#define RTEMS_ALIAS | ( | _target | ) |
Instructs the compiler to generate an alias to the target function.
_target | is the target function name. |
#define RTEMS_ALIGN_DOWN | ( | _value, | |
_alignment | |||
) | ( ( _value ) & ~( ( _alignment ) - 1 ) ) |
Aligns down the value to the alignment.
_value | is the value to align down. |
_alignment | is the desired alignment in bytes. The alignment shall be a power of two, otherwise the returned value is undefined. The alignment parameter is evaluated twice. |
#define RTEMS_ALIGN_UP | ( | _value, | |
_alignment | |||
) | ( ( ( _value ) + ( _alignment ) - 1 ) & ~( ( _alignment ) - 1 ) ) |
Aligns up the value to the alignment.
_value | is the value to align up. |
_alignment | is the desired alignment in bytes. The alignment shall be a power of two, otherwise the returned value is undefined. The alignment parameter is evaluated twice. |
#define RTEMS_ALIGNED | ( | _alignment | ) |
Instructs the compiler in a declaration or definition to enforce the alignment.
_alignment | is the desired alignment in bytes. |
#define RTEMS_ALIGNOF | ( | _type_name | ) | sizeof( _type_name ) |
Gets the alignment requirement of the type.
_type_name | is the type name to get the alignment requirement for. |
#define RTEMS_ALLOC_ALIGN | ( | _index | ) |
Tells the compiler in a declaration that the memory allocation alignment parameter of this function is similar to aligned_alloc().
_index | is the allocation alignment parameter index (starting with one). |
#define RTEMS_ALLOC_SIZE | ( | _index | ) |
Tells the compiler in a declaration that the memory allocation size parameter of this function is similar to malloc().
_index | is the allocation size parameter index (starting with one). |
#define RTEMS_ALLOC_SIZE_2 | ( | _count_index, | |
_size_index | |||
) |
Tells the compiler in a declaration that the memory allocation item count and item size parameter of this function is similar to calloc().
_count_index | is the allocation item count parameter index (starting with one). |
_size_index | is the allocation item size parameter index (starting with one). |
#define RTEMS_ARRAY_SIZE | ( | _array | ) | ( sizeof( _array ) / sizeof( ( _array )[ 0 ] ) ) |
Gets the element count of the array.
_array | is the name of the array. This parameter is evaluated twice. |
#define RTEMS_CONCAT | ( | _x, | |
_y | |||
) | _x##_y |
Concatenates _x and _y without expanding.
_x | is the left hand side token of the concatenation. |
_y | is the right hand side token of the concatenation. |
#define RTEMS_CONTAINER_OF | ( | _m, | |
_type, | |||
_member_name | |||
) | ( (_type *) ( (uintptr_t) ( _m ) - offsetof( _type, _member_name ) ) ) |
Gets the container of a member.
_m | is the pointer to a member of the container. |
_type | is the type of the container. |
_member_name | is the designator name of the container member. |
#define RTEMS_DECLARE_GLOBAL_SYMBOL | ( | _name | ) | extern char _name[] |
Declares a global symbol with the name.
_name | is the name of the global symbol. It shall be a valid designator. |
This macro must be placed at file scope.
#define RTEMS_DECONST | ( | _type, | |
_var | |||
) | RTEMS_DEQUALIFY_DEPTHX( *, _type, _var ) |
Performs a type cast which removes const qualifiers without warnings to the type for the pointer variable.
_type | is the target type of the cast. |
_var | is the pointer variable. |
#define RTEMS_DEFINE_GLOBAL_SYMBOL | ( | _name, | |
_value | |||
) |
Defines a global symbol with the name and value.
_name | is the user defined name of the symbol. The name shall be a valid designator. On the name a macro expansion is performed and afterwards it is stringified. |
_value | is the value of the symbol. On the value a macro expansion is performed and afterwards it is stringified. It shall expand to an integer expression understood by the assembler. The value shall be representable in the code model of the target architecture. |
This macro shall be placed at file scope.
#define RTEMS_DEQUALIFY | ( | _type, | |
_var | |||
) | RTEMS_DEQUALIFY_DEPTHX( *, _type, _var ) |
Performs a type cast which removes all qualifiers without warnings to the type for the pointer variable.
_type | is the target type of the cast. |
_var | is the pointer variable. |
#define RTEMS_DEQUALIFY_DEPTHX | ( | _ptr_level, | |
_type, | |||
_var | |||
) | ( (_type) (uintptr_t) (const volatile void *)( _var ) ) |
Performs a type cast which removes qualifiers without warnings to the type for the variable.
_ptr_level | is the pointer indirection level expressed in * . |
_type | is the target type of the cast. |
_var | is the variable. |
#define RTEMS_DEVOLATILE | ( | _type, | |
_var | |||
) | RTEMS_DEQUALIFY_DEPTHX( *, _type, _var ) |
Performs a type cast which removes volatile qualifiers without warnings to the type for the pointer variable.
_type | is the target type of the cast. |
_var | is the pointer variable. |
#define RTEMS_EXPAND | ( | _token | ) | _token |
Helper macro to perform a macro expansion on the token.
_token | is the token to expand. |
#define RTEMS_HAVE_MEMBER_SAME_TYPE | ( | _t_lhs, | |
_m_lhs, | |||
_t_rhs, | |||
_m_rhs | |||
) | true |
Checks if members of two types have compatible types.
_t_lhs | is the left hand side type. |
_m_lhs | is the left hand side member. |
_t_rhs | is the right hand side type. |
_m_rhs | is the right hand side member. |
#define RTEMS_OBFUSCATE_VARIABLE | ( | _var | ) | (void) ( _var ) |
Obfuscates the variable so that the compiler cannot perform optimizations based on the variable value.
_var | is the variable to obfuscate. |
The variable must be simple enough to fit into a register.
#define RTEMS_PREDICT_FALSE | ( | _exp | ) | ( _exp ) |
Evaluates the integral expression and tells the compiler that the predicted value is false (0).
_exp | is the integral expression. |
#define RTEMS_PREDICT_TRUE | ( | _exp | ) | ( _exp ) |
Evaluates the integral expression and tells the compiler that the predicted value is true (1).
_exp | is the integral expression. |
#define RTEMS_PRINTFLIKE | ( | _format_pos, | |
_ap_pos | |||
) |
Tells the compiler in a declaration that this function expects printf()-like arguments.
_format_pos | is the position of the format parameter index (starting with one). |
_ap_pos | is the position of the argument pointer parameter index (starting with one). |
#define RTEMS_RETURN_ADDRESS | ( | ) | NULL |
Gets the return address of the current function.
#define RTEMS_SECTION | ( | _section | ) |
Instructs the compiler to place the variable or function in the section.
_section | is the section name as a string. |
#define RTEMS_STATIC_ASSERT | ( | _cond, | |
_msg | |||
) |
It is defined if a static analysis run is performed.
Asserts at compile time that the condition is satisfied.
_cond | is the condition this static assertion shall satisfy. |
_msg | is the error message in case the static assertion fails. |
#define RTEMS_STRING | ( | ... | ) | #__VA_ARGS__ |
Stringifies the arguments without expanding them.
... | are the arguments to stringify. |
#define RTEMS_SYMBOL_NAME | ( | _name | ) | RTEMS_EXPAND( _name ) |
Maps the name to the associated symbol name.
_name | is the user defined name of the symbol. The name shall be a valid designator. On the name a macro expansion is performed. |
#define RTEMS_TYPEOF_REFX | ( | _level, | |
_target | |||
) |
Gets the pointer reference type.
_level | is the pointer indirection level expressed in * . |
_target | is the reference target type. |
The reference type idea is based on libHX by Jan Engelhardt.
#define RTEMS_WEAK |
Tells the compiler in a function definition that this function should be weak.
Use this attribute for function definitions. Do not use it for function declarations.
#define RTEMS_WEAK_ALIAS | ( | _target | ) |
Instructs the compiler to generate a weak alias to the target function.
_target | is the target function name. |
#define RTEMS_XCONCAT | ( | _x, | |
_y | |||
) | RTEMS_CONCAT( _x, _y ) |
Concatenates expansion of _x and expansion of _y.
_x | is expanded first and then used as the left hand side token of the concatenation. |
_y | is expanded first and then used as the right hand side token of the concatenation. |
#define RTEMS_XSTRING | ( | ... | ) | RTEMS_STRING( __VA_ARGS__ ) |
Stringifies the expansion of the arguments.
... | are the arguments to expand and stringify. |
#define RTEMS_ZERO_LENGTH_ARRAY 0 |
This constant represents the element count of a zero-length array.
Zero-length arrays are valid in C99 as flexible array members. C++11 does not allow flexible array members. Use the GNU extension which is also supported by other compilers.