When defined() appears inside a macro with ## op, syntaxError gets emitted.
error: failed to evaluate #if condition, undefined function-like macro invocation: defined( ... ) [syntaxError]
#if NRF_MODULE_ENABLED(FOO)
Reproducer: main.c
#define NRF_MODULE_ENABLED(module) \
(defined(module ## _ENABLED) && (module ## _ENABLED))
#define FOO_ENABLED 1
#if NRF_MODULE_ENABLED(FOO)
int foo(void) { return 1; }
#endif
This is caused by the DEFINED branch in expandToken, which doesn't match defined(A ## B), and makes the token 'defined(...)' fall through.
When defined() appears inside a macro with ## op, syntaxError gets emitted.
Reproducer: main.c
This is caused by the DEFINED branch in expandToken, which doesn't match defined(A ## B), and makes the token 'defined(...)' fall through.