Skip to content

Commit 3b8b5d1

Browse files
committed
[sanitizer_common][test] Handle missing REG_STARTEND in Posix/regex_startend.cpp
As reported in D96348 <https://reviews.llvm.org/D96348>, the `Posix/regex_startend.cpp` test `FAIL`s on Solaris because `REG_STARTEND` isn't defined. It's a BSD extension not present everywhere. E.g. AIX doesn't have it, too. Fixed by wrapping the test in `#ifdef REG_STARTEND`. Tested on `amd64-pc-solaris2.11`, `sparcv9-sun-solaris2.11`, and `x86_64-pc-linux-gnu`. Differential Revision: https://reviews.llvm.org/D98425
1 parent c86dacd commit 3b8b5d1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

compiler-rt/test/sanitizer_common/TestCases/Posix/regex_startend.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#include <stdlib.h>
1515
#include <string.h>
1616

17+
/// REG_STARTEND is a BSD extension not supported everywhere.
18+
#ifdef REG_STARTEND
1719
void test_matched(const regex_t *preg, const char *string, size_t start,
1820
size_t end, const char *expected) {
1921
regmatch_t match[1];
@@ -59,3 +61,8 @@ int main(void) {
5961
printf("Successful test\n");
6062
return 0;
6163
}
64+
#else
65+
int main(void) {
66+
return 0;
67+
}
68+
#endif

0 commit comments

Comments
 (0)