summaryrefslogtreecommitdiffstats
path: root/third_party
diff options
context:
space:
mode:
authorearthdok@chromium.org <earthdok@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-30 18:11:19 +0000
committerearthdok@chromium.org <earthdok@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-30 18:11:19 +0000
commit0195d52cca3109df4568a413e00d4bdb4b8477bf (patch)
tree379dcb6e356249948014a7b62bb23e67a4dfc4ec /third_party
parente3440b108608ac60543500b60ab8bb7d217203ee (diff)
downloadchromium_src-0195d52cca3109df4568a413e00d4bdb4b8477bf.zip
chromium_src-0195d52cca3109df4568a413e00d4bdb4b8477bf.tar.gz
chromium_src-0195d52cca3109df4568a413e00d4bdb4b8477bf.tar.bz2
Patch re2 to support MSan.
BUG=178409 R=eugenis@chromium.org TBR=cpu@chromium.org Review URL: https://codereview.chromium.org/149723005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247998 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party')
-rw-r--r--third_party/re2/README.chromium4
-rw-r--r--third_party/re2/patches/re2-msan.patch63
-rw-r--r--third_party/re2/util/sparse_array.h5
-rw-r--r--third_party/re2/util/sparse_set.h5
-rw-r--r--third_party/re2/util/util.h8
5 files changed, 81 insertions, 4 deletions
diff --git a/third_party/re2/README.chromium b/third_party/re2/README.chromium
index 3617102..21c05a1 100644
--- a/third_party/re2/README.chromium
+++ b/third_party/re2/README.chromium
@@ -23,3 +23,7 @@ Local Modifications (to be applied in this order):
https://code.google.com/p/re2/issues/detail?id=76
- Memory optimization for filtered trees
(patches/re2-memory-optimization.patch)
+- Prevent unwanted reports from MemorySanitizer. Note: there's an upstream fix
+ for this (https://code.google.com/p/re2/issues/detail?id=77) which is rendered
+ ineffective by patches/remove-valgrind-code.patch
+ (patches/re2-msan.patch)
diff --git a/third_party/re2/patches/re2-msan.patch b/third_party/re2/patches/re2-msan.patch
new file mode 100644
index 0000000..8577669
--- /dev/null
+++ b/third_party/re2/patches/re2-msan.patch
@@ -0,0 +1,63 @@
+diff --git a/third_party/re2/util/sparse_array.h b/third_party/re2/util/sparse_array.h
+index 3e33f89..4ee5c94 100644
+--- a/third_party/re2/util/sparse_array.h
++++ b/third_party/re2/util/sparse_array.h
+@@ -231,7 +231,8 @@ class SparseArray {
+
+ template<typename Value>
+ SparseArray<Value>::SparseArray()
+- : size_(0), max_size_(0), sparse_to_dense_(NULL), dense_(), valgrind_(RunningOnValgrind()) {}
++ : size_(0), max_size_(0), sparse_to_dense_(NULL), dense_(),
++ valgrind_(RunningOnValgrindOrMemorySanitizer()) {}
+
+ // IndexValue pairs: exposed in SparseArray::iterator.
+ template<typename Value>
+@@ -418,7 +419,7 @@ void SparseArray<Value>::create_index(int i) {
+ template<typename Value> SparseArray<Value>::SparseArray(int max_size) {
+ max_size_ = max_size;
+ sparse_to_dense_ = new int[max_size];
+- valgrind_ = RunningOnValgrind();
++ valgrind_ = RunningOnValgrindOrMemorySanitizer();
+ dense_.resize(max_size);
+ // Don't need to zero the new memory, but appease Valgrind.
+ if (valgrind_) {
+diff --git a/third_party/re2/util/sparse_set.h b/third_party/re2/util/sparse_set.h
+index 165dd09..4a324d7 100644
+--- a/third_party/re2/util/sparse_set.h
++++ b/third_party/re2/util/sparse_set.h
+@@ -54,13 +54,14 @@ namespace re2 {
+ class SparseSet {
+ public:
+ SparseSet()
+- : size_(0), max_size_(0), sparse_to_dense_(NULL), dense_(NULL), valgrind_(RunningOnValgrind()) {}
++ : size_(0), max_size_(0), sparse_to_dense_(NULL), dense_(NULL),
++ valgrind_(RunningOnValgrindOrMemorySanitizer()) {}
+
+ SparseSet(int max_size) {
+ max_size_ = max_size;
+ sparse_to_dense_ = new int[max_size];
+ dense_ = new int[max_size];
+- valgrind_ = RunningOnValgrind();
++ valgrind_ = RunningOnValgrindOrMemorySanitizer();
+ // Don't need to zero the memory, but do so anyway
+ // to appease Valgrind.
+ if (valgrind_) {
+diff --git a/third_party/re2/util/util.h b/third_party/re2/util/util.h
+index de1ef5b..49159c2 100644
+--- a/third_party/re2/util/util.h
++++ b/third_party/re2/util/util.h
+@@ -129,6 +129,14 @@ static inline uint64 Hash64StringWithSeed(const char* s, int len, uint32 seed) {
+ return ((uint64)x << 32) | y;
+ }
+
++inline bool RunningOnValgrindOrMemorySanitizer() {
++#if defined(MEMORY_SANITIZER)
++ return true;
++#else
++ return RunningOnValgrind();
++#endif
++}
++
+ } // namespace re2
+
+ #include "util/arena.h"
diff --git a/third_party/re2/util/sparse_array.h b/third_party/re2/util/sparse_array.h
index 3e33f89..4ee5c94 100644
--- a/third_party/re2/util/sparse_array.h
+++ b/third_party/re2/util/sparse_array.h
@@ -231,7 +231,8 @@ class SparseArray {
template<typename Value>
SparseArray<Value>::SparseArray()
- : size_(0), max_size_(0), sparse_to_dense_(NULL), dense_(), valgrind_(RunningOnValgrind()) {}
+ : size_(0), max_size_(0), sparse_to_dense_(NULL), dense_(),
+ valgrind_(RunningOnValgrindOrMemorySanitizer()) {}
// IndexValue pairs: exposed in SparseArray::iterator.
template<typename Value>
@@ -418,7 +419,7 @@ void SparseArray<Value>::create_index(int i) {
template<typename Value> SparseArray<Value>::SparseArray(int max_size) {
max_size_ = max_size;
sparse_to_dense_ = new int[max_size];
- valgrind_ = RunningOnValgrind();
+ valgrind_ = RunningOnValgrindOrMemorySanitizer();
dense_.resize(max_size);
// Don't need to zero the new memory, but appease Valgrind.
if (valgrind_) {
diff --git a/third_party/re2/util/sparse_set.h b/third_party/re2/util/sparse_set.h
index 165dd09..4a324d7 100644
--- a/third_party/re2/util/sparse_set.h
+++ b/third_party/re2/util/sparse_set.h
@@ -54,13 +54,14 @@ namespace re2 {
class SparseSet {
public:
SparseSet()
- : size_(0), max_size_(0), sparse_to_dense_(NULL), dense_(NULL), valgrind_(RunningOnValgrind()) {}
+ : size_(0), max_size_(0), sparse_to_dense_(NULL), dense_(NULL),
+ valgrind_(RunningOnValgrindOrMemorySanitizer()) {}
SparseSet(int max_size) {
max_size_ = max_size;
sparse_to_dense_ = new int[max_size];
dense_ = new int[max_size];
- valgrind_ = RunningOnValgrind();
+ valgrind_ = RunningOnValgrindOrMemorySanitizer();
// Don't need to zero the memory, but do so anyway
// to appease Valgrind.
if (valgrind_) {
diff --git a/third_party/re2/util/util.h b/third_party/re2/util/util.h
index de1ef5b..49159c2 100644
--- a/third_party/re2/util/util.h
+++ b/third_party/re2/util/util.h
@@ -129,6 +129,14 @@ static inline uint64 Hash64StringWithSeed(const char* s, int len, uint32 seed) {
return ((uint64)x << 32) | y;
}
+inline bool RunningOnValgrindOrMemorySanitizer() {
+#if defined(MEMORY_SANITIZER)
+ return true;
+#else
+ return RunningOnValgrind();
+#endif
+}
+
} // namespace re2
#include "util/arena.h"