[ccan] [PATCH 3/3] configurator: avoid potential unused parameter warnings hosing our config.h
Cody P Schafer
dev at codyps.com
Mon Aug 17 08:54:39 AEST 2015
Signed-off-by: Cody P Schafer <dev at codyps.com>
---
tools/configurator/configurator.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/tools/configurator/configurator.c b/tools/configurator/configurator.c
index 3bf5e49..fe1611e 100644
--- a/tools/configurator/configurator.c
+++ b/tools/configurator/configurator.c
@@ -63,7 +63,7 @@ struct test {
static struct test tests[] = {
{ "HAVE_32BIT_OFF_T", DEFINES_EVERYTHING|EXECUTE, NULL, NULL,
"#include <sys/types.h>\n"
- "int main(int argc, char *argv[]) {\n"
+ "int main(void) {\n"
" return sizeof(off_t) == 4 ? 0 : 1;\n"
"}\n" },
{ "HAVE_ALIGNOF", INSIDE_MAIN, NULL, NULL,
@@ -90,7 +90,7 @@ static struct test tests[] = {
"#include <stdlib.h>\n"
"static void __attribute__((noreturn)) func(int x) { exit(x); }" },
{ "HAVE_ATTRIBUTE_PRINTF", DEFINES_FUNC, NULL, NULL,
- "static void __attribute__((format(__printf__, 1, 2))) func(const char *fmt, ...) { }" },
+ "static void __attribute__((format(__printf__, 1, 2))) func(const char *fmt, ...) { (void)fmt; }" },
{ "HAVE_ATTRIBUTE_UNUSED", OUTSIDE_MAIN, NULL, NULL,
"static int __attribute__((unused)) func(int x) { return x; }" },
{ "HAVE_ATTRIBUTE_USED", OUTSIDE_MAIN, NULL, NULL,
@@ -191,7 +191,7 @@ static struct test tests[] = {
"HAVE_32BIT_OFF_T", NULL,
"#define _FILE_OFFSET_BITS 64\n"
"#include <sys/types.h>\n"
- "int main(int argc, char *argv[]) {\n"
+ "int main(void) {\n"
" return sizeof(off_t) == 8 ? 0 : 1;\n"
"}\n" },
{ "HAVE_FOR_LOOP_DECLARATION", INSIDE_MAIN, NULL, NULL,
@@ -277,7 +277,8 @@ static struct test tests[] = {
" return nest(base, i-1);\n"
"}\n"
"int main(int argc, char *argv[]) {\n"
- " return (nest(&argc, argc) > 0) ? 0 : 1\n;"
+ " (void)argv;\n"
+ " return (nest(&argc, argc) > 0) ? 0 : 1;\n"
"}\n" },
{ "HAVE_STATEMENT_EXPR", INSIDE_MAIN, NULL, NULL,
"return ({ int x = argc; x == argc ? 0 : 1; });" },
@@ -290,6 +291,7 @@ static struct test tests[] = {
{ "HAVE_UNALIGNED_ACCESS", DEFINES_EVERYTHING|EXECUTE, NULL, NULL,
"#include <string.h>\n"
"int main(int argc, char *argv[]) {\n"
+ " (void)argc;\n"
" char pad[sizeof(int *) * 1];\n"
" strncpy(pad, argv[0], sizeof(pad));\n"
" int *x = (int *)pad, *y = (int *)(pad + 1);\n"
@@ -403,7 +405,10 @@ static struct test *find_test(const char *name)
}
#define PRE_BOILERPLATE "/* Test program generated by configurator. */\n"
-#define MAIN_START_BOILERPLATE "int main(int argc, char *argv[]) {\n"
+#define MAIN_START_BOILERPLATE \
+ "int main(int argc, char *argv[]) {\n" \
+ " (void)argc;\n" \
+ " (void)argv;\n"
#define USE_FUNC_BOILERPLATE "(void)func;\n"
#define MAIN_BODY_BOILERPLATE "return 0;\n"
#define MAIN_END_BOILERPLATE "}\n"
--
2.5.0
More information about the ccan
mailing list