#include #define CONFIG_FOO1 1 #undef CONFIG_FOO2 #define __enabled_CONFIG_FOO1 1 #define __enabled_CONFIG_FOO2 0 /* * Usage: ENABLED(CONFIG_FOO) * Please do not use the __enabled_CONFIG_FOO defines directly to not break * grepability of the code. */ #define ENABLED(x) __enabled_ ## x int main(void) { #ifdef CONFIG_FOO1 puts("Foo1.0"); #endif #ifdef CONFIG_FOO2 puts("Foo2.0"); #endif if (ENABLED(CONFIG_FOO1)) { puts("Foo1.1"); } if (ENABLED(CONFIG_FOO2)) { puts("Foo2.1"); } return 0; }