Browse Source

configurator: more robust test for HAVE_NESTED_FUNCTIONS

Thanks to Andreas Schlick, we have a nicer test for when gcc warns about
trampolines (gcc 4.6's -Wtrampolines).  This works at any optimization level,
and means when that warning is enabled we recognize that we shouldn't allow
nested functions.
Rusty Russell 15 years ago
parent
commit
975dff7213
1 changed files with 4 additions and 4 deletions
  1. 4 4
      tools/configurator/configurator.c

+ 4 - 4
tools/configurator/configurator.c

@@ -111,12 +111,12 @@ static struct test tests[] = {
 	  "	return mmap(0, 65536, PROT_READ, MAP_SHARED, fd, 0);\n"
 	  "	return mmap(0, 65536, PROT_READ, MAP_SHARED, fd, 0);\n"
 	  "}" },
 	  "}" },
 	{ "HAVE_NESTED_FUNCTIONS", DEFINES_FUNC, NULL,
 	{ "HAVE_NESTED_FUNCTIONS", DEFINES_FUNC, NULL,
-	  "static int func(int val) {\n"
+	  "void (*func(int val))(int);\n"
+	  "void (*func(int val))(int) {\n"
 	  "	auto void add(int val2);\n"
 	  "	auto void add(int val2);\n"
 	  "	void add(int val2) { val += val2; }\n"
 	  "	void add(int val2) { val += val2; }\n"
-	  "	add(7);\n"
-	  "	return val;\n"
-	  "}" },
+	  "	return add;\n"
+	  "}\n" },
 	{ "HAVE_STATEMENT_EXPR", INSIDE_MAIN, NULL,
 	{ "HAVE_STATEMENT_EXPR", INSIDE_MAIN, NULL,
 	  "return ({ int x = argc; x == argc ? 0 : 1; });" },
 	  "return ({ int x = argc; x == argc ? 0 : 1; });" },
 	{ "HAVE_TYPEOF", INSIDE_MAIN, NULL,
 	{ "HAVE_TYPEOF", INSIDE_MAIN, NULL,