Messages in this thread Patch in this message | | | From | (Dick Streefland) | Subject | Re: [PATCH 1/3] kconfig: fix IS_ENABLED to not require all options to be defined | Date | Fri, 13 Apr 2012 10:31:54 -0000 |
| |
| +#define __ARG_PLACEHOLDER_1 0, | +#define config_enabled(cfg) _config_enabled(cfg) | +#define _config_enabled(value) __config_enabled(__ARG_PLACEHOLDER_##value) | +#define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0) | +#define ___config_enabled(__ignored, val, ...) val
The ISO C99 standard requires that the variable argument macro ___config_enabled() is expanded with at least three arguments. When a CONFIG_* macro is not defined, there are only two arguments, and gcc will issue a somewhat cryptic warning message when you compile with the -pedantic option:
"warning: ISO C99 requires rest arguments to be used"
Adding an additional dummy argument makes the code ISO C99 compliant, and eliminates the warning:
diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h index be342b9..eac65da 100644 --- a/include/linux/kconfig.h +++ b/include/linux/kconfig.h @@ -19,7 +19,7 @@ #define __ARG_PLACEHOLDER_1 0, #define config_enabled(cfg) _config_enabled(cfg) #define _config_enabled(value) __config_enabled(__ARG_PLACEHOLDER_##value) -#define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0) +#define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0, 0) #define ___config_enabled(__ignored, val, ...) val /* Signed-off-by: Dick Streefland <dick@streefland.net>
-- Dick
| |