[libcxx-commits] [libcxx] 29b2f64 - [libc++] Fix fuzzing unit tests with exceptions disabled.
Eric Fiselier via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Dec 11 13:22:22 PST 2019
Author: Eric Fiselier
Date: 2019-12-11T16:22:11-05:00
New Revision: 29b2f64ddb8b7ab7ca7215e8701386b9c4da1865
URL: https://github.com/llvm/llvm-project/commit/29b2f64ddb8b7ab7ca7215e8701386b9c4da1865
DIFF: https://github.com/llvm/llvm-project/commit/29b2f64ddb8b7ab7ca7215e8701386b9c4da1865.diff
LOG: [libc++] Fix fuzzing unit tests with exceptions disabled.
We simply turn off the parts of the tests that require exceptions.
Added:
Modified:
libcxx/fuzzing/fuzzing.cpp
Removed:
################################################################################
diff --git a/libcxx/fuzzing/fuzzing.cpp b/libcxx/fuzzing/fuzzing.cpp
index 284993918aaa..9f3601fbf0b1 100644
--- a/libcxx/fuzzing/fuzzing.cpp
+++ b/libcxx/fuzzing/fuzzing.cpp
@@ -457,6 +457,7 @@ static int regex_helper(const uint8_t *data, size_t size, std::regex::flag_type
{
if (size > 0)
{
+#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
std::string s((const char *)data, size);
@@ -464,6 +465,11 @@ static int regex_helper(const uint8_t *data, size_t size, std::regex::flag_type
return std::regex_match(s, re) ? 1 : 0;
}
catch (std::regex_error &ex) {}
+#else
+ ((void)data);
+ ((void)size);
+ ((void)flag);
+#endif
}
return 0;
}
More information about the libcxx-commits
mailing list