]> git.ozlabs.org Git - ccan/blobdiff - tools/configurator/configurator.c
configurator: fix crash when more than one extra test provided
[ccan] / tools / configurator / configurator.c
index 239e91c962b9b3af8af341818055412ad3344f9a..f15f34483c36352549af73a9facea230ced71bfe 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; }" },
@@ -879,7 +888,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;
        }
 }