|
Define function attributes. More...
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_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 210 of file attributes.h.
#define _ARCH_CAT_NOEXPAND | ( | a, | |
b | |||
) | a ## b |
Definition at line 209 of file attributes.h.
#define _ARCH_ENSURE_PER_LIB_INIT | ( | T, | |
prefix | |||
) | static Arch_PerLibInit<T> _ARCH_CAT(prefix, __COUNTER__) |
Definition at line 211 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. The remaining arguments should be types for the signature of the function. The types are only to make the name unique (when mangled); the function will be called with no arguments so the arguments must not be used. If you don't need any arguments you must use void.
Definition at line 126 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. The remaining arguments should be types for the signature of the function. The types are only to make the name unique (when mangled); the function will be called with no arguments so the arguments must not be used. If you don't need any arguments you must use void.
Definition at line 145 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 153 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 58 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 34 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 48 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 72 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 87 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 107 of file attributes.h.