]> git.ozlabs.org Git - ccan/commitdiff
configurator: more robust test for HAVE_NESTED_FUNCTIONS
authorRusty Russell <rusty@rustcorp.com.au>
Wed, 2 Mar 2011 00:15:51 +0000 (10:45 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 2 Mar 2011 00:15:51 +0000 (10:45 +1030)
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.

tools/configurator/configurator.c

index 85842cedba84301709ffc0764943c6d667ada107..837ef8ce00ee9302605682bb27748287a369a4da 100644 (file)
@@ -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,