[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2e99.4f88009a.417f5@altium.nl>
Date: Fri, 13 Apr 2012 10:31:54 -0000
From: dick@...eefland.net (Dick Streefland)
To: linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] kconfig: fix IS_ENABLED to not require all options to be defined
| +#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@...eefland.net>
--
Dick
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists