Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Unified Diff: third_party/re2/util/util.h

Issue 1530113002: Revert of Update re2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/re2/util/threadwin.cc ('k') | third_party/re2/util/valgrind.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/re2/util/util.h
diff --git a/third_party/re2/util/util.h b/third_party/re2/util/util.h
index c59d91f2ccf85d356a39fc9012ad74543b197212..a4fdfcc936ac99577b5380216d3fe42f95a37f75 100644
--- a/third_party/re2/util/util.h
+++ b/third_party/re2/util/util.h
@@ -9,18 +9,16 @@
#include <stdio.h>
#include <string.h>
#include <stdint.h>
-#include <stddef.h> // For size_t
+#include <stddef.h> // For size_t
#include <assert.h>
#include <stdarg.h>
-#include <time.h> // For clock_gettime, CLOCK_REALTIME
-#include <ctype.h> // For isdigit, isalpha
-
-#if !defined(_WIN32)
-#include <sys/time.h> // For gettimeofday
+#ifndef WIN32
+#include <sys/time.h>
#endif
+#include <time.h>
+#include <ctype.h> // For isdigit, isalpha.
// C++
-#include <ctime>
#include <vector>
#include <string>
#include <algorithm>
@@ -30,6 +28,9 @@
#include <ostream>
#include <utility>
#include <set>
+
+#include "build/build_config.h"
+#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
// Use std names.
using std::set;
@@ -45,7 +46,7 @@
using std::swap;
using std::make_pair;
-#if defined(__GNUC__) && !defined(USE_CXX0X) && !defined(_LIBCPP_ABI_VERSION)
+#if defined(__GNUC__) && !defined(USE_CXX0X) && !defined(_LIBCPP_ABI_VERSION) && !defined(OS_ANDROID)
#include <tr1/unordered_set>
using std::tr1::unordered_set;
@@ -53,22 +54,11 @@
#else
#include <unordered_set>
-#if defined(_WIN32)
+#if defined(WIN32) || (defined(OS_ANDROID) && !defined(_LIBCPP_ABI_VERSION))
using std::tr1::unordered_set;
#else
using std::unordered_set;
#endif
-
-#endif
-
-#ifdef _WIN32
-
-#define snprintf _snprintf_s
-#define stricmp _stricmp
-#define strtof strtod /* not really correct but best we can do */
-#define strtoll _strtoi64
-#define strtoull _strtoui64
-#define vsnprintf vsnprintf_s
#endif
@@ -87,31 +77,35 @@
typedef unsigned int uint;
typedef unsigned short ushort;
-// Prevent the compiler from complaining about or optimizing away variables
-// that appear unused.
-#undef ATTRIBUTE_UNUSED
-#if defined(__GNUC__)
-#define ATTRIBUTE_UNUSED __attribute__ ((unused))
-#else
-#define ATTRIBUTE_UNUSED
-#endif
-
// COMPILE_ASSERT causes a compile error about msg if expr is not true.
#if __cplusplus >= 201103L
#define COMPILE_ASSERT(expr, msg) static_assert(expr, #msg)
#else
template<bool> struct CompileAssert {};
#define COMPILE_ASSERT(expr, msg) \
- typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] ATTRIBUTE_UNUSED
+ typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
#endif
-// DISALLOW_COPY_AND_ASSIGN disallows the copy and operator= functions.
+// DISALLOW_EVIL_CONSTRUCTORS disallows the copy and operator= functions.
// It goes in the private: declarations in a class.
-#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
+#define DISALLOW_EVIL_CONSTRUCTORS(TypeName) \
TypeName(const TypeName&); \
void operator=(const TypeName&)
-#define arraysize(array) (int)(sizeof(array)/sizeof((array)[0]))
+#define arraysize(array) (sizeof(array)/sizeof((array)[0]))
+
+// Fake lock annotations. For real ones, see
+// http://code.google.com/p/data-race-test/
+#ifndef ANNOTATE_PUBLISH_MEMORY_RANGE
+#define ANNOTATE_PUBLISH_MEMORY_RANGE(a, b)
+#define ANNOTATE_IGNORE_WRITES_BEGIN()
+#define ANNOTATE_IGNORE_WRITES_END()
+#define ANNOTATE_BENIGN_RACE(a, b)
+#define NO_THREAD_SAFETY_ANALYSIS
+#define ANNOTATE_HAPPENS_BEFORE(x)
+#define ANNOTATE_HAPPENS_AFTER(x)
+#define ANNOTATE_UNPROTECTED_READ(x) (x)
+#endif
class StringPiece;
@@ -138,10 +132,17 @@
return ((uint64)x << 32) | y;
}
-bool RunningOnValgrind();
+inline bool RunningOnValgrindOrMemorySanitizer() {
+#if defined(MEMORY_SANITIZER)
+ return true;
+#else
+ return RunningOnValgrind();
+#endif
+}
} // namespace re2
+#include "util/arena.h"
#include "util/logging.h"
#include "util/mutex.h"
#include "util/utf.h"
« no previous file with comments | « third_party/re2/util/threadwin.cc ('k') | third_party/re2/util/valgrind.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698