From: Rusty Russell Date: Wed, 2 Mar 2011 00:15:51 +0000 (+1030) Subject: configurator: more robust test for HAVE_NESTED_FUNCTIONS X-Git-Url: https://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=975dff721336d8902d9ae737c360865205100451 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. --- diff --git a/tools/configurator/configurator.c b/tools/configurator/configurator.c index 85842ced..837ef8ce 100644 --- a/tools/configurator/configurator.c +++ b/tools/configurator/configurator.c @@ -111,12 +111,12 @@ static struct test tests[] = { " return mmap(0, 65536, PROT_READ, MAP_SHARED, fd, 0);\n" "}" }, { "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" " void add(int val2) { val += val2; }\n" - " add(7);\n" - " return val;\n" - "}" }, + " return add;\n" + "}\n" }, { "HAVE_STATEMENT_EXPR", INSIDE_MAIN, NULL, "return ({ int x = argc; x == argc ? 0 : 1; });" }, { "HAVE_TYPEOF", INSIDE_MAIN, NULL,