X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fconfigurator%2Fconfigurator.c;h=5d959cf33c6b04bdad29c8df6fb3d5f7e77874bc;hp=2139bcb2059267e9ebfe098831ee25d94c85fe8f;hb=2953f5147b5d84b846a1d756652582ad3e5348fe;hpb=8d9d288e9a77cc58bbc2a0cb9274962139638c5b diff --git a/tools/configurator/configurator.c b/tools/configurator/configurator.c index 2139bcb2..5d959cf3 100644 --- a/tools/configurator/configurator.c +++ b/tools/configurator/configurator.c @@ -317,6 +317,54 @@ static struct test tests[] = { "for(i = 0; i < 0; i++) {};\n" "return 0;\n", "-Werror -fopenmp" }, + { "HAVE_VALGRIND_MEMCHECK_H", OUTSIDE_MAIN, NULL, NULL, + "#include \n" }, + { "HAVE_UCONTEXT", DEFINES_EVERYTHING|EXECUTE, + NULL, NULL, + "#include \n" + "static int x = 0;\n" + "static char stack[2048];\n" + "static ucontext_t a, b;\n" + "static void fn(void) {\n" + " x |= 2;\n" + " setcontext(&b);\n" + " x |= 4;\n" + "}\n" + "int main(int argc, char *argv[]) {\n" + " x |= 1;\n" + " getcontext(&a);\n" + " a.uc_stack.ss_sp = stack;\n" + " a.uc_stack.ss_size = sizeof(stack);\n" + " makecontext(&a, fn, 0);\n" + " swapcontext(&b, &a);\n" + " return (x == 3) ? 0 : 1;\n" + "}\n" + }, + { "HAVE_POINTER_SAFE_MAKECONTEXT", DEFINES_EVERYTHING|EXECUTE, + "HAVE_UCONTEXT", NULL, + "#include \n" + "#include \n" + "static int worked = 0;\n" + "static char stack[1024];\n" + "static ucontext_t a, b;\n" + "static void fn(void *p, void *q) {\n" + " void *cp = &worked;\n" + " void *cq = (void *)(~((ptrdiff_t)cp));\n" + " if ((p == cp) && (q == cq))\n" + " worked = 1;\n" + " setcontext(&b);\n" + "}\n" + "int main(int argc, char *argv[]) {\n" + " void *ap = &worked;\n" + " void *aq = (void *)(~((ptrdiff_t)ap));\n" + " getcontext(&a);\n" + " a.uc_stack.ss_sp = stack;\n" + " a.uc_stack.ss_size = sizeof(stack);\n" + " makecontext(&a, (void (*)(void))fn, 2, ap, aq);\n" + " swapcontext(&b, &a);\n" + " return worked ? 0 : 1;\n" + "}\n" + }, }; static char *grab_fd(int fd) @@ -495,7 +543,8 @@ static bool run_test(const char *cmd, struct test *test) fclose(outf); if (verbose > 1) - if (system("cat " INPUT_FILE) == -1); + if (system("cat " INPUT_FILE) == -1) + ; newcmd = strdup(cmd);