From ea7fff4c43a24dee1db4153250455e6040a1afce Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 9 Mar 2021 14:14:09 +0100 Subject: [PATCH] testsuite: Fix up pr98920.c on non-glibc or old glibc targets [PR98920] 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 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. --- gcc/testsuite/c-c++-common/asan/pr98920.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/testsuite/c-c++-common/asan/pr98920.c b/gcc/testsuite/c-c++-common/asan/pr98920.c index 881d3d4..789a2a3 100644 --- a/gcc/testsuite/c-c++-common/asan/pr98920.c +++ b/gcc/testsuite/c-c++-common/asan/pr98920.c @@ -3,10 +3,13 @@ #include #include +#if __has_include() #include +#endif int main(void) { +#ifdef REG_STARTEND regex_t r; const char s[] = "ban\0ana"; regmatch_t pmatch[10]; @@ -20,5 +23,6 @@ int main(void) return 3; } regfree(&r); +#endif return 0; } -- 2.7.4