Common macros and compiler attributes/pragmas configuration. More...
Common macros and compiler attributes/pragmas configuration.
Definition in file modules.h.
Go to the source code of this file.
#define | IS_ACTIVE(macro) __is_active(macro) |
Allows to verify a macro definition outside the preprocessor. | |
#define | IS_USED(module) IS_ACTIVE(module) |
Checks whether a module is being used or not. | |
#define IS_ACTIVE | ( | macro | ) | __is_active(macro) |
Allows to verify a macro definition outside the preprocessor.
This macro is based on Linux's clever 'IS_BUILTIN' (https://github.com/torvalds/linux/blob/master/include/linux/kconfig.h). It takes a macro
value that may be defined to 1 or not even defined (e.g. FEATURE_FOO) and then expands it to an expression that can be used in C code, either 1 or 0.
The advantage of using this is that the compiler sees all the code, so checks can be performed, sections that would not be executed are removed during optimization. For example:
[in] | macro | Macro to evaluate |