AUI_PP_IS_EMPTY#
If the arguments after expansion have no tokens, evaluates to 1. Otherwise evaluates to 0.
| Header: | #include <AUI/Util/APreprocessor.h> |
| CMake: | aui_link(my_target PUBLIC aui::core) |
Definition#
#define AUI_PP_IS_EMPTY(...) \
AUI_PP_INTERNAL_IS_EMPTY(AUI_PP_HAS_COMMA(__VA_ARGS__), \
AUI_PP_HAS_COMMA(AUI_PP_COMMA __VA_ARGS__), \
AUI_PP_HAS_COMMA(__VA_ARGS__()), \
AUI_PP_HAS_COMMA(AUI_PP_COMMA __VA_ARGS__()))
Detailed Description#
Requires: - the number of arguments after expansion is at most 15. - If the argument is a macro, it must be able to be called with one argument.
Implementation details#
There is one case when it generates a compile error: if the argument is macro that cannot be called with one argument.
#define M(a, b) // it doesn't matter what it expands to
// Expected: expands to `0`.
// Actual: compile error.
AUI_PP_IS_EMPTY(M)
There are 4 cases tested:
__VA_ARGS__possible expansion has no unparen'd commas. Expected 0.__VA_ARGS__possible expansion is not enclosed in parenthesis. Expected 0.__VA_ARGS__possible expansion is not a macro that ()-evaluates to a comma. Expected 0__VA_ARGS__is empty, or has unparen'd commas, or is enclosed in parenthesis, or is a macro that ()-evaluates to comma. Expected 1.
We trigger detection on '0001', i.e. on empty.