From 496ef1a9e9a746005d85fbb8363355894d7a16ad Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Tue, 5 Mar 2019 16:47:25 -0800 Subject: 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/31773 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth Reviewed-by: Patrick Georgi --- payloads/libpayload/include/kconfig.h | 4 +++- src/include/kconfig.h | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/payloads/libpayload/include/kconfig.h b/payloads/libpayload/include/kconfig.h index adb3403cf2..9cce6ea706 100644 --- a/payloads/libpayload/include/kconfig.h +++ b/payloads/libpayload/include/kconfig.h @@ -17,5 +17,7 @@ #define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0, 0) #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 diff --git a/src/include/kconfig.h b/src/include/kconfig.h index 73106e905c..0478548d59 100644 --- a/src/include/kconfig.h +++ b/src/include/kconfig.h @@ -17,5 +17,7 @@ #define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0, 0) #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 -- cgit v1.2.3