![]() |
|
Define function attributes. More...
Include dependency graph for attributes.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Macros | |
| #define | ARCH_PRINTF_FUNCTION(_fmt, _firstArg) |
| Macro used to indicate a function takes a printf-like specification. | |
| #define | ARCH_SCANF_FUNCTION(_fmt, _firstArg) |
| Macro used to indicate a function takes a scanf-like specification. | |
| #define | ARCH_NOINLINE |
| Macro used to indicate that a function should never be inlined. | |
| #define | ARCH_UNUSED_ARG |
| Macro used to indicate a function parameter may be unused. | |
| #define | ARCH_UNUSED_FUNCTION |
| Macro used to indicate a function may be unused. | |
| #define | ARCH_USED_FUNCTION |
| Macro used to indicate that a function's code must always be emitted even if not required. | |
| #define | ARCH_CONSTRUCTOR(_name, _priority) |
| Macro to begin the definition of a function that should be executed by the dynamic loader when the dynamic object (library or program) is loaded. | |
| #define | ARCH_DESTRUCTOR(_name, _priority) |
| Macro to begin the definition of a function that should be executed by the dynamic loader when the dynamic object (library or program) is unloaded. | |
| #define | ARCH_EMPTY_BASES |
| Macro to begin the definition of a class that is using private inheritance to take advantage of the empty base optimization. | |
| #define | ARCH_NO_SANITIZE_ADDRESS_FUNCTION |
| Macro used to indicate that a function should not be instrumented with address santizers. | |
| #define | _ARCH_CAT_NOEXPAND(a, b) a ## b |
| #define | _ARCH_CAT(a, b) _ARCH_CAT_NOEXPAND(a, b) |
| #define | _ARCH_ENSURE_PER_LIB_INIT(T, prefix) static Arch_PerLibInit<T> _ARCH_CAT(prefix, __COUNTER__) |
Define function attributes.
This file allows you to define architecture-specific or compiler-specific options to be used outside lib/arch.
Definition in file attributes.h.
| #define _ARCH_CAT | ( | a, | |
| b | |||
| ) | _ARCH_CAT_NOEXPAND(a, b) |
Definition at line 249 of file attributes.h.
| #define _ARCH_CAT_NOEXPAND | ( | a, | |
| b | |||
| ) | a ## b |
Definition at line 248 of file attributes.h.
| #define _ARCH_ENSURE_PER_LIB_INIT | ( | T, | |
| prefix | |||
| ) | static Arch_PerLibInit<T> _ARCH_CAT(prefix, __COUNTER__) |
Definition at line 250 of file attributes.h.
| #define ARCH_CONSTRUCTOR | ( | _name, | |
| _priority | |||
| ) |
Macro to begin the definition of a function that should be executed by the dynamic loader when the dynamic object (library or program) is loaded.
_priority is used to order the execution of constructors. Valid values are integers in the range [0,255]. Constructors with lower numbers are run first. It is unspecified if these functions are run before or after dynamic initialization of non-local variables.
_name is the name of the function and must be unique across all invocations of ARCH_CONSTRUCTOR in the same translation unit.
Definition at line 124 of file attributes.h.
| #define ARCH_DESTRUCTOR | ( | _name, | |
| _priority | |||
| ) |
Macro to begin the definition of a function that should be executed by the dynamic loader when the dynamic object (library or program) is unloaded.
_priority is used to order the execution of destructors. Valid values are integers in the range [0,255]. Destructors with higher numbers are run first. It is unspecified if these functions are run before or after dynamically initialized non-local variables.
_name is the name of the function and must be unique across all invocations of ARCH_CONSTRUCTOR in the same translation unit.
Definition at line 139 of file attributes.h.
| #define ARCH_EMPTY_BASES |
Macro to begin the definition of a class that is using private inheritance to take advantage of the empty base optimization.
Some compilers require an explicit tag.
In C++20, usage of private inheritance may be able to be retired with the [[no_unique_address]] tag.
Definition at line 147 of file attributes.h.
| #define ARCH_NO_SANITIZE_ADDRESS_FUNCTION |
Macro used to indicate that a function should not be instrumented with address santizers.
In general, this attribute should be used sparingly. Its purpose is mostly for tests that when built with address sanitizer will trigger a false-positive, meaning the test is checking something that address sanitizer is trying to catch.
Its important to understand that this attribute will only disable address sanitizer instrumentation for the function it's applied to. Any sanitized functions called from the target function will still be instrumented.
This attribute is used as follows:
Definition at line 170 of file attributes.h.
| #define ARCH_NOINLINE |
Macro used to indicate that a function should never be inlined.
This attribute is used as follows:
Definition at line 60 of file attributes.h.
| #define ARCH_PRINTF_FUNCTION | ( | _fmt, | |
| _firstArg | |||
| ) |
Macro used to indicate a function takes a printf-like specification.
This attribute is used as follows:
This indicates that the third argument is the format string, and that the fourth argument is where the var-args corresponding to the format string begin.
Definition at line 36 of file attributes.h.
| #define ARCH_SCANF_FUNCTION | ( | _fmt, | |
| _firstArg | |||
| ) |
Macro used to indicate a function takes a scanf-like specification.
This attribute is used as follows:
This indicates that the third argument is the format string, and that the fourth argument is where the var-args corresponding to the format string begin.
Definition at line 50 of file attributes.h.
| #define ARCH_UNUSED_ARG |
Macro used to indicate a function parameter may be unused.
In general, avoid this attribute if possible. Mostly this attribute should be used when the set of arguments to a function is described as part of a macro. The usage is:
Definition at line 74 of file attributes.h.
| #define ARCH_UNUSED_FUNCTION |
Macro used to indicate a function may be unused.
In general, avoid this attribute if possible. Mostly this attribute should be used when you need to keep a function around (for some good reason), but it is not used in the rest of the code. The usage is:
Definition at line 89 of file attributes.h.
| #define ARCH_USED_FUNCTION |
Macro used to indicate that a function's code must always be emitted even if not required.
This attribute is especially useful with templated registration functions, which might not be present in the linked binary if they are not used (or the compiler optimizes away their use.)
The usage is:
Definition at line 109 of file attributes.h.