lkml.org 
[lkml]   [2012]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCH 1/3] kconfig: fix IS_ENABLED to not require all options to be defined
Date
| +#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



\
 
 \ /
  Last update: 2012-04-13 12:35    [W:0.054 / U:0.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site