[compiler-rt] 3b8b5d1 - [sanitizer_common][test] Handle missing REG_STARTEND in Posix/regex_startend.cpp
Rainer Orth via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 17 01:57:34 PDT 2021
Author: Rainer Orth
Date: 2021-03-17T09:56:19+01:00
New Revision: 3b8b5d1f22f2c5d8ae55709a92d02011dea056ca
URL: https://github.com/llvm/llvm-project/commit/3b8b5d1f22f2c5d8ae55709a92d02011dea056ca
DIFF: https://github.com/llvm/llvm-project/commit/3b8b5d1f22f2c5d8ae55709a92d02011dea056ca.diff
LOG: [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
Added:
Modified:
compiler-rt/test/sanitizer_common/TestCases/Posix/regex_startend.cpp
Removed:
################################################################################
diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/regex_startend.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/regex_startend.cpp
index 1a445783bcbe..e143c6c9b5e2 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Posix/regex_startend.cpp
+++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/regex_startend.cpp
@@ -14,6 +14,8 @@
#include <stdlib.h>
#include <string.h>
+/// REG_STARTEND is a BSD extension not supported everywhere.
+#ifdef REG_STARTEND
void test_matched(const regex_t *preg, const char *string, size_t start,
size_t end, const char *expected) {
regmatch_t match[1];
@@ -59,3 +61,8 @@ int main(void) {
printf("Successful test\n");
return 0;
}
+#else
+int main(void) {
+ return 0;
+}
+#endif
More information about the llvm-commits
mailing list