Add new CONFIG(XXX) macro to replace IS_ENABLED(CONFIG_XXX)

The IS_ENABLED() macro is pretty long and unwieldy for something so
widely used, and often forces line breaks just for checking two Kconfigs
in a row. Let's replace it with something that takes up less space to
make our code more readable. From now on,

 if (IS_ENABLED(CONFIG_XXX))
 #if IS_ENABLED(CONFIG_XXX)

shall become

 if (CONFIG(XXX))
 #if CONFIG(XXX)

Change-Id: I2468427b569b974303084574125a9e1d9f6db596
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/31773
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin Roth <martinroth@google.com>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Julius Werner 2019-03-05 16:47:25 -08:00 committed by Patrick Georgi
parent 55f0a1409d
commit 496ef1a9e9
2 changed files with 6 additions and 2 deletions

View File

@ -17,5 +17,7 @@
#define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0, 0) #define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0, 0)
#define ___config_enabled(__ignored, val, ...) val #define ___config_enabled(__ignored, val, ...) val
#define IS_ENABLED(option) config_enabled(option) #define IS_ENABLED(option) config_enabled(option) /* deprecated */
#define CONFIG(option) config_enabled(CONFIG_##option)
#endif #endif

View File

@ -17,5 +17,7 @@
#define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0, 0) #define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0, 0)
#define ___config_enabled(__ignored, val, ...) val #define ___config_enabled(__ignored, val, ...) val
#define IS_ENABLED(option) config_enabled(option) #define IS_ENABLED(option) config_enabled(option) /* deprecated */
#define CONFIG(option) config_enabled(CONFIG_##option)
#endif #endif