]> git.ozlabs.org Git - ccan/blobdiff - tools/configurator/configurator.c
configurator: fix openmp test on some versions of clang.
[ccan] / tools / configurator / configurator.c
index 239e91c962b9b3af8af341818055412ad3344f9a..d99d4a003065557a79815dfeca4d292eb4b1e699 100644 (file)
@@ -136,6 +136,15 @@ static const struct test base_tests[] = {
        { "HAVE_ATTRIBUTE_CONST", "__attribute__((const)) support",
          "DEFINES_FUNC", NULL, NULL,
          "static int __attribute__((const)) func(int x) { return x; }" },
+       { "HAVE_ATTRIBUTE_DEPRECATED", "__attribute__((deprecated)) support",
+         "DEFINES_FUNC", NULL, NULL,
+         "static int __attribute__((deprecated)) func(int x) { return x; }" },
+       { "HAVE_ATTRIBUTE_NONNULL", "__attribute__((nonnull)) support",
+         "DEFINES_FUNC", NULL, NULL,
+         "static char *__attribute__((nonnull)) func(char *p) { return p; }" },
+       { "HAVE_ATTRIBUTE_SENTINEL", "__attribute__((sentinel)) support",
+         "DEFINES_FUNC", NULL, NULL,
+         "static int __attribute__((sentinel)) func(int i, ...) { return i; }" },
        { "HAVE_ATTRIBUTE_PURE", "__attribute__((pure)) support",
          "DEFINES_FUNC", NULL, NULL,
          "static int __attribute__((pure)) func(int x) { return x; }" },
@@ -422,7 +431,7 @@ static const struct test base_tests[] = {
          "     return i + 1;\n"
          "}" },
        { "HAVE_OPENMP", "#pragma omp and -fopenmp support",
-         "INSIDE_MAIN", NULL, NULL,
+         "INSIDE_MAIN|EXECUTE|MAY_NOT_COMPILE", NULL, NULL,
          "int i;\n"
          "#pragma omp parallel for\n"
          "for(i = 0; i < 0; i++) {};\n"
@@ -479,6 +488,13 @@ static const struct test base_tests[] = {
          "     return worked ? 0 : 1;\n"
          "}\n"
        },
+       { "HAVE_BUILTIN_CPU_SUPPORTS", "__builtin_cpu_supports()",
+         "DEFINES_FUNC", NULL, NULL,
+         "#include <stdbool.h>\n"
+         "static bool func(void) {\n"
+         "     return __builtin_cpu_supports(\"mmx\");\n"
+         "}"
+       },
 };
 
 static void c12r_err(int eval, const char *fmt, ...)
@@ -879,7 +895,8 @@ static void read_tests(size_t num_tests)
 {
        while (read_test(tests + num_tests)) {
                num_tests++;
-               tests = realloc(tests, num_tests * sizeof(tests[0]));
+               tests = realloc(tests, (num_tests + 1) * sizeof(tests[0]));
+               tests[num_tests].name = NULL;
        }
 }