summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2016-11-21 16:58:22 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2016-11-21 16:58:22 +0900
commit11b439be08e713284f09eba5547142b6ea2924f3 (patch)
tree6e8aab0313cb718030050a0e2bfe1acdb6a21dd0 /util
parent2e30f7d1bb7894979dafc4fcd68dd8664c5584ab (diff)
downloadre2-11b439be08e713284f09eba5547142b6ea2924f3.tar.gz
re2-11b439be08e713284f09eba5547142b6ea2924f3.tar.bz2
re2-11b439be08e713284f09eba5547142b6ea2924f3.zip
Imported Upstream version 20160601upstream/20160601
Change-Id: I89d6c9dac409aeeb940c58029f34a1292d4cb0a1 Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'util')
-rw-r--r--util/fuzz.cc21
-rw-r--r--util/test.cc2
-rw-r--r--util/util.h16
3 files changed, 23 insertions, 16 deletions
diff --git a/util/fuzz.cc b/util/fuzz.cc
new file mode 100644
index 0000000..9cac118
--- /dev/null
+++ b/util/fuzz.cc
@@ -0,0 +1,21 @@
+// Copyright 2016 The RE2 Authors. All Rights Reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+// Entry point for libFuzzer.
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size);
+
+int main(int argc, char** argv) {
+ uint8_t data[32];
+ for (int i = 0; i < 32; i++) {
+ for (int j = 0; j < 32; j++) {
+ data[j] = random() & 0xFF;
+ }
+ LLVMFuzzerTestOneInput(data, 32);
+ }
+ return 0;
+}
diff --git a/util/test.cc b/util/test.cc
index b0167e7..0a751fe 100644
--- a/util/test.cc
+++ b/util/test.cc
@@ -23,7 +23,7 @@ void RegisterTest(void (*fn)(void), const char *name) {
tests[ntests++].name = name;
}
-int main(int argc, char **argv) {
+int main(int argc, char** argv) {
for (int i = 0; i < ntests; i++) {
printf("%s\n", tests[i].name);
tests[i].fn();
diff --git a/util/util.h b/util/util.h
index 7dfab93..1e78aa3 100644
--- a/util/util.h
+++ b/util/util.h
@@ -32,6 +32,7 @@
#include <set>
#include <atomic>
#include <mutex> // For std::call_once
+#include <unordered_set>
// Use std names.
using std::set;
@@ -46,22 +47,7 @@ using std::stack;
using std::sort;
using std::swap;
using std::make_pair;
-
-#if defined(__GNUC__) && !defined(USE_CXX0X) && !defined(_LIBCPP_ABI_VERSION)
-
-#include <tr1/unordered_set>
-using std::tr1::unordered_set;
-
-#else
-
-#include <unordered_set>
-#if defined(_WIN32)
-using std::tr1::unordered_set;
-#else
using std::unordered_set;
-#endif
-
-#endif
#ifdef _WIN32