Not all OSes have regex.h and not all OSes that do have REG_STARTEND macro support.
Conditionalize the test on that.
2021-03-09 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/98920
* c-c++-common/asan/pr98920.c: Only include regex.h if the header
exists. If REG_STARTEND macro isn't defined, just return 0 from main
instead of the actual test.
#include <stdio.h>
#include <sys/types.h>
+#if __has_include(<regex.h>)
#include <regex.h>
+#endif
int main(void)
{
+#ifdef REG_STARTEND
regex_t r;
const char s[] = "ban\0ana";
regmatch_t pmatch[10];
return 3;
}
regfree(&r);
+#endif
return 0;
}