Created
April 12, 2012 22:30
-
-
Save jnavila/2371469 to your computer and use it in GitHub Desktop.
preprocessor macro that returns 1 if macro is set to 1, else 0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define dummy_macro(...) | |
#define CONFIG_1 )(1 | |
#define is_set(macro) is_set1(macro) | |
#define is_set1(macro) is_set2(CONFIG_##macro) | |
#define is_set2(x) (dummy_macro( x ) +0) | |
#define FOO 1 | |
is_set(FOO) | |
is_set(BAR) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment