summaryrefslogtreecommitdiffstats
path: root/third_party
diff options
context:
space:
mode:
authorbattre@chromium.org <battre@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-24 14:53:58 +0000
committerbattre@chromium.org <battre@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-24 14:53:58 +0000
commite38e38c5f2c7e9da39048a74292aca4a61efb5db (patch)
treeeb7baf7fae6e0d203a83a7da89a0864eb42cc522 /third_party
parentf3da41f41639a147cac7f51b9d36a2ad87ed06a6 (diff)
downloadchromium_src-e38e38c5f2c7e9da39048a74292aca4a61efb5db.zip
chromium_src-e38e38c5f2c7e9da39048a74292aca4a61efb5db.tar.gz
chromium_src-e38e38c5f2c7e9da39048a74292aca4a61efb5db.tar.bz2
Updated to most recent version RE2 and remove upstreamed patches.
BUG=169866,169855,169851 Review URL: https://chromiumcodereview.appspot.com/12033058 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@178575 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party')
-rw-r--r--third_party/re2/.gitignore1
-rw-r--r--third_party/re2/CONTRIBUTORS1
-rw-r--r--third_party/re2/README.chromium12
-rwxr-xr-xthird_party/re2/doc/mksyntaxgo41
-rw-r--r--third_party/re2/doc/syntax.txt4
-rw-r--r--third_party/re2/patches/fix-implicit-conversion.patch12
-rw-r--r--third_party/re2/patches/msvc-x64.patch31
-rw-r--r--third_party/re2/patches/re2-android.patch40
-rw-r--r--third_party/re2/patches/re2-msvc9-chrome.patch116
-rw-r--r--third_party/re2/patches/remove-static-initializers.patch22
-rw-r--r--third_party/re2/patches/remove-testinstall.cc-and-fix-filepermissions.patch29
-rw-r--r--third_party/re2/patches/remove-valgrind-code.patch38
-rw-r--r--third_party/re2/patches/rename-posix-option.patch18
-rw-r--r--third_party/re2/re2/dfa.cc4
-rw-r--r--third_party/re2/re2/filtered_re2.cc6
-rw-r--r--third_party/re2/re2/parse.cc2
-rw-r--r--third_party/re2/re2/re2.cc28
-rw-r--r--third_party/re2/testinstall.cc24
-rw-r--r--third_party/re2/util/logging.h7
-rw-r--r--third_party/re2/util/util.h14
20 files changed, 204 insertions, 246 deletions
diff --git a/third_party/re2/.gitignore b/third_party/re2/.gitignore
deleted file mode 100644
index 632f7e6..0000000
--- a/third_party/re2/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-.hg*
diff --git a/third_party/re2/CONTRIBUTORS b/third_party/re2/CONTRIBUTORS
index 15053eb5..7f6a93d 100644
--- a/third_party/re2/CONTRIBUTORS
+++ b/third_party/re2/CONTRIBUTORS
@@ -28,6 +28,7 @@
Brian Gunlogson <unixman83@gmail.com>
Dominic Battré <battre@chromium.org>
+John Millikin <jmillikin@gmail.com>
Rob Pike <r@google.com>
Russ Cox <rsc@swtch.com>
Sanjay Ghemawat <sanjay@google.com>
diff --git a/third_party/re2/README.chromium b/third_party/re2/README.chromium
index 5dd8306..99ee638 100644
--- a/third_party/re2/README.chromium
+++ b/third_party/re2/README.chromium
@@ -1,9 +1,9 @@
Name: re2 - an efficient, principled regular expression library
Short Name: re2
URL: http://code.google.com/p/re2/
-Version: 401ab4168e8e
+Version: 7f91923f3ad4
Date: 2012-06-20
-Revision: 97:401ab4168e8e
+Revision: 100:7f91923f3ad4
License: BSD 3-Clause License
License File: LICENSE
Security Critical: yes
@@ -13,15 +13,9 @@ RE2 is a fast, safe, thread-friendly alternative to backtracking regular
expression engines like those used in PCRE, Perl, and Python.
Local Modifications (to be applied in this order):
-- Rename POSIX configuration (patches/rename-posix-option.patch)
- Remove valgrind specific code that exists in chromium already
(patches/remove-valgrind-code.patch)
-- Fix an implicit conversion from NULL to false
- (patches/fix-implicit-conversion.patch)
- Support for Windows (patches/re2-msvc9-chrome.patch)
- Support Android (patches/re2-android.patch)
-- Remove testinstall.cc because it lacks a license header and remove executable
- bit from non-executable .py file.
- (patches/remove-testinstall.cc-and-fix-filepermissions.patch)
- Remove static initializers (patches/remove-static-initializers.patch)
-- Support for Windows x64 (patches/msvc-x64.patch)
+- Rename POSIX configuration (patches/rename-posix-option.patch)
diff --git a/third_party/re2/doc/mksyntaxgo b/third_party/re2/doc/mksyntaxgo
new file mode 100755
index 0000000..42e87d6
--- /dev/null
+++ b/third_party/re2/doc/mksyntaxgo
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+set -e
+out=$GOROOT/src/pkg/regexp/syntax/doc.go
+cp syntax.txt $out
+sam -d $out <<'!'
+,x g/NOT SUPPORTED/d
+/^Unicode character class/,$d
+,s/[«»]//g
+,x g/^Possessive repetitions:/d
+,x g/\\C/d
+,x g/Flag syntax/d
+,s/.=(true|false)/flag &/g
+,s/^Flags:/ Flag syntax is xyz (set) or -xyz (clear) or xy-z (set xy, clear z). The flags are:\n/
+,s/\n\n\n+/\n\n/g
+,x/(^.* .*\n)+/ | awk -F' ' '{printf(" %-14s %s\n", $1, $2)}'
+1,2c
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// DO NOT EDIT. This file is generated by mksyntaxgo from the RE2 distribution.
+
+/*
+Package syntax parses regular expressions into parse trees and compiles
+parse trees into programs. Most clients of regular expressions will use the
+facilities of package regexp (such as Compile and Match) instead of this package.
+
+Syntax
+
+The regular expression syntax understood by this package when parsing with the Perl flag is as follows.
+Parts of the syntax can be disabled by passing alternate flags to Parse.
+
+.
+$a
+*/
+package syntax
+.
+w
+q
+!
diff --git a/third_party/re2/doc/syntax.txt b/third_party/re2/doc/syntax.txt
index 740e5ce..f940750 100644
--- a/third_party/re2/doc/syntax.txt
+++ b/third_party/re2/doc/syntax.txt
@@ -2,7 +2,7 @@ RE2 regular expression syntax reference
-------------------------­-------­-----
Single characters:
-. any character, including newline (s=true)
+. any character, possibly including newline (s=true)
[xyz] character class
[^xyz] negated character class
\d Perl character class
@@ -60,7 +60,7 @@ re@> possessive match of «re» NOT SUPPORTED vim
Flags:
i case-insensitive (default false)
-m multi-line mode: ^ and $ match begin/end line in addition to begin/end text (default false)
+m multi-line mode: «^» and «$» match begin/end line in addition to begin/end text (default false)
s let «.» match «\n» (default false)
U ungreedy: swap meaning of «x*» and «x*?», «x+» and «x+?», etc (default false)
Flag syntax is «xyz» (set) or «-xyz» (clear) or «xy-z» (set «xy», clear «z»).
diff --git a/third_party/re2/patches/fix-implicit-conversion.patch b/third_party/re2/patches/fix-implicit-conversion.patch
deleted file mode 100644
index bc68f11..0000000
--- a/third_party/re2/patches/fix-implicit-conversion.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -r e12d4aa8907f re2/dfa.cc
---- a/re2/dfa.cc Wed Jul 25 15:13:19 2012 +0200
-+++ b/re2/dfa.cc Wed Jul 25 15:13:47 2012 +0200
-@@ -1778,7 +1780,7 @@
- return false;
- }
- if (params.start == DeadState)
-- return NULL;
-+ return false;
- if (params.start == FullMatchState) {
- if (run_forward == want_earliest_match)
- *epp = text.begin();
diff --git a/third_party/re2/patches/msvc-x64.patch b/third_party/re2/patches/msvc-x64.patch
deleted file mode 100644
index 72e0441..0000000
--- a/third_party/re2/patches/msvc-x64.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-diff --git a/third_party/re2/re2/dfa.cc b/third_party/re2/re2/dfa.cc
-index 32c8c33..36ec66f 100644
---- a/third_party/re2/re2/dfa.cc
-+++ b/third_party/re2/re2/dfa.cc
-@@ -470,8 +470,8 @@ DFA::DFA(Prog* prog, Prog::MatchKind kind, int64 max_mem)
- // At minimum, the search requires room for two states in order
- // to limp along, restarting frequently. We'll get better performance
- // if there is room for a larger number of states, say 20.
-- int one_state = sizeof(State) + (prog_->size()+nmark)*sizeof(int) +
-- (prog_->bytemap_range()+1)*sizeof(State*);
-+ size_t one_state = sizeof(State) + (prog_->size()+nmark)*sizeof(int) +
-+ (prog_->bytemap_range()+1)*sizeof(State*);
- if (state_budget_ < 20*one_state) {
- LOG(INFO) << StringPrintf("DFA out of memory: prog size %lld mem %lld",
- prog_->size(), max_mem);
-diff --git a/third_party/re2/util/logging.h b/third_party/re2/util/logging.h
-index 7302ea6..4478f9b 100644
---- a/third_party/re2/util/logging.h
-+++ b/third_party/re2/util/logging.h
-@@ -59,7 +59,11 @@ class LogMessage {
- void Flush() {
- stream() << "\n";
- string s = str_.str();
-+#ifdef WIN32
-+ write(2, s.data(), static_cast<unsigned int>(s.size()));
-+#else
- if(write(2, s.data(), s.size()) < 0) {} // shut up gcc
-+#endif
- flushed_ = true;
- }
- ~LogMessage() {
diff --git a/third_party/re2/patches/re2-android.patch b/third_party/re2/patches/re2-android.patch
index bcaea8d..67e9816 100644
--- a/third_party/re2/patches/re2-android.patch
+++ b/third_party/re2/patches/re2-android.patch
@@ -1,34 +1,8 @@
-diff --git a/third_party/re2/re2/parse.cc b/third_party/re2/re2/parse.cc
-index 0cf4ab4..6423fe9 100644
---- a/third_party/re2/re2/parse.cc
-+++ b/third_party/re2/re2/parse.cc
-@@ -16,6 +16,8 @@
- // and recognizes the Perl escape sequences \d, \s, \w, \D, \S, and \W.
- // See regexp.h for rationale.
-
-+#include <ctype.h>
-+
- #include "util/util.h"
- #include "re2/regexp.h"
- #include "re2/stringpiece.h"
-diff --git a/third_party/re2/re2/re2.cc b/third_party/re2/re2/re2.cc
-index 989add6..78978f1 100644
---- a/third_party/re2/re2/re2.cc
-+++ b/third_party/re2/re2/re2.cc
-@@ -9,6 +9,8 @@
-
- #include "re2/re2.h"
-
-+#include <ctype.h>
-+
- #include <stdio.h>
- #include <string>
- #ifdef WIN32
-diff --git a/third_party/re2/util/util.h b/third_party/re2/util/util.h
-index dab7e16..11b5f4a 100644
---- a/third_party/re2/util/util.h
-+++ b/third_party/re2/util/util.h
-@@ -28,6 +28,7 @@
+diff --git a/util/util.h b/util/util.h
+index 17ef824..8f54040 100644
+--- a/util/util.h
++++ b/util/util.h
+@@ -29,6 +29,7 @@
#include <utility>
#include <set>
@@ -36,7 +10,7 @@ index dab7e16..11b5f4a 100644
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
// Use std names.
-@@ -44,7 +45,7 @@ using std::sort;
+@@ -45,7 +46,7 @@ using std::sort;
using std::swap;
using std::make_pair;
@@ -45,7 +19,7 @@ index dab7e16..11b5f4a 100644
#include <tr1/unordered_set>
using std::tr1::unordered_set;
-@@ -52,7 +53,7 @@ using std::tr1::unordered_set;
+@@ -53,7 +54,7 @@ using std::tr1::unordered_set;
#else
#include <unordered_set>
diff --git a/third_party/re2/patches/re2-msvc9-chrome.patch b/third_party/re2/patches/re2-msvc9-chrome.patch
index 17da0cd..ce5d05a 100644
--- a/third_party/re2/patches/re2-msvc9-chrome.patch
+++ b/third_party/re2/patches/re2-msvc9-chrome.patch
@@ -1,7 +1,7 @@
-diff --git a/third_party/re2/AUTHORS b/third_party/re2/AUTHORS
+diff --git a/AUTHORS b/AUTHORS
index 3c0f928..e17d9bf 100644
---- a/third_party/re2/AUTHORS
-+++ b/third_party/re2/AUTHORS
+--- a/AUTHORS
++++ b/AUTHORS
@@ -8,5 +8,6 @@
# Please keep the list sorted.
@@ -9,23 +9,23 @@ index 3c0f928..e17d9bf 100644
+Brian Gunlogson <unixman83@gmail.com>
Google Inc.
Stefano Rivera <stefano.rivera@gmail.com>
-diff --git a/third_party/re2/CONTRIBUTORS b/third_party/re2/CONTRIBUTORS
-index ac64332..15053eb 100644
---- a/third_party/re2/CONTRIBUTORS
-+++ b/third_party/re2/CONTRIBUTORS
+diff --git a/CONTRIBUTORS b/CONTRIBUTORS
+index 7b44e04..7f6a93d 100644
+--- a/CONTRIBUTORS
++++ b/CONTRIBUTORS
@@ -26,6 +26,7 @@
# Please keep the list sorted.
+Brian Gunlogson <unixman83@gmail.com>
Dominic Battré <battre@chromium.org>
+ John Millikin <jmillikin@gmail.com>
Rob Pike <r@google.com>
- Russ Cox <rsc@swtch.com>
-diff --git a/third_party/re2/mswin/stdint.h b/third_party/re2/mswin/stdint.h
+diff --git a/mswin/stdint.h b/mswin/stdint.h
new file mode 100644
index 0000000..d02608a
--- /dev/null
-+++ b/third_party/re2/mswin/stdint.h
++++ b/mswin/stdint.h
@@ -0,0 +1,247 @@
+// ISO C9x compliant stdint.h for Microsoft Visual Studio
+// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
@@ -274,10 +274,10 @@ index 0000000..d02608a
+
+
+#endif // _MSC_STDINT_H_ ]
-diff --git a/third_party/re2/re2/compile.cc b/third_party/re2/re2/compile.cc
+diff --git a/re2/compile.cc b/re2/compile.cc
index 9cddb71..adb45fd 100644
---- a/third_party/re2/re2/compile.cc
-+++ b/third_party/re2/re2/compile.cc
+--- a/re2/compile.cc
++++ b/re2/compile.cc
@@ -502,7 +502,7 @@ int Compiler::RuneByteSuffix(uint8 lo, uint8 hi, bool foldcase, int next) {
return UncachedRuneByteSuffix(lo, hi, foldcase, next);
}
@@ -287,10 +287,10 @@ index 9cddb71..adb45fd 100644
map<uint64, int>::iterator it = rune_cache_.find(key);
if (it != rune_cache_.end())
return it->second;
-diff --git a/third_party/re2/re2/prefilter_tree.cc b/third_party/re2/re2/prefilter_tree.cc
+diff --git a/re2/prefilter_tree.cc b/re2/prefilter_tree.cc
index d8bc37a..cdcf77e 100644
---- a/third_party/re2/re2/prefilter_tree.cc
-+++ b/third_party/re2/re2/prefilter_tree.cc
+--- a/re2/prefilter_tree.cc
++++ b/re2/prefilter_tree.cc
@@ -8,6 +8,11 @@
#include "re2/prefilter_tree.h"
#include "re2/re2.h"
@@ -303,10 +303,10 @@ index d8bc37a..cdcf77e 100644
DEFINE_int32(filtered_re2_min_atom_len,
3,
"Strings less than this length are not stored as atoms");
-diff --git a/third_party/re2/re2/re2.cc b/third_party/re2/re2/re2.cc
-index 3cc3dd4..989add6 100644
---- a/third_party/re2/re2/re2.cc
-+++ b/third_party/re2/re2/re2.cc
+diff --git a/re2/re2.cc b/re2/re2.cc
+index 8d1d468..0da886d 100644
+--- a/re2/re2.cc
++++ b/re2/re2.cc
@@ -11,7 +11,13 @@
#include <stdio.h>
@@ -348,10 +348,10 @@ index 3cc3dd4..989add6 100644
RE2::Options::Options(RE2::CannedOptions opt)
: encoding_(opt == RE2::Latin1 ? EncodingLatin1 : EncodingUTF8),
-diff --git a/third_party/re2/re2/re2.h b/third_party/re2/re2/re2.h
-index 9f5b66d..98b06b8 100644
---- a/third_party/re2/re2/re2.h
-+++ b/third_party/re2/re2/re2.h
+diff --git a/re2/re2.h b/re2/re2.h
+index 272028b..c509853 100644
+--- a/re2/re2.h
++++ b/re2/re2.h
@@ -552,28 +552,16 @@ class RE2 {
// If this happens too often, RE2 falls back on the NFA implementation.
@@ -384,10 +384,10 @@ index 9f5b66d..98b06b8 100644
/*implicit*/ Options(CannedOptions);
Encoding encoding() const { return encoding_; }
-diff --git a/third_party/re2/re2/stringpiece.h b/third_party/re2/re2/stringpiece.h
+diff --git a/re2/stringpiece.h b/re2/stringpiece.h
index ab9297c..38a5150 100644
---- a/third_party/re2/re2/stringpiece.h
-+++ b/third_party/re2/re2/stringpiece.h
+--- a/re2/stringpiece.h
++++ b/re2/stringpiece.h
@@ -23,6 +23,9 @@
#include <cstddef>
#include <iosfwd>
@@ -398,10 +398,10 @@ index ab9297c..38a5150 100644
namespace re2 {
-diff --git a/third_party/re2/re2/testing/re2_test.cc b/third_party/re2/re2/testing/re2_test.cc
+diff --git a/re2/testing/re2_test.cc b/re2/testing/re2_test.cc
index b99cacf..911e868 100644
---- a/third_party/re2/re2/testing/re2_test.cc
-+++ b/third_party/re2/re2/testing/re2_test.cc
+--- a/re2/testing/re2_test.cc
++++ b/re2/testing/re2_test.cc
@@ -6,7 +6,9 @@
// TODO: Test extractions for PartialMatch/Consume
@@ -440,10 +440,10 @@ index b99cacf..911e868 100644
TEST(RE2, FullMatchTypeTests) {
// Type tests
-diff --git a/third_party/re2/util/logging.h b/third_party/re2/util/logging.h
-index 734e7a1..7302ea6 100644
---- a/third_party/re2/util/logging.h
-+++ b/third_party/re2/util/logging.h
+diff --git a/util/logging.h b/util/logging.h
+index 4443f7c..d0a2d87 100644
+--- a/util/logging.h
++++ b/util/logging.h
@@ -7,8 +7,13 @@
#ifndef RE2_UTIL_LOGGING_H__
#define RE2_UTIL_LOGGING_H__
@@ -458,10 +458,10 @@ index 734e7a1..7302ea6 100644
// Debug-only checking.
#define DCHECK(condition) assert(condition)
-diff --git a/third_party/re2/util/mutex.h b/third_party/re2/util/mutex.h
+diff --git a/util/mutex.h b/util/mutex.h
index 9787bfb..e321fae 100644
---- a/third_party/re2/util/mutex.h
-+++ b/third_party/re2/util/mutex.h
+--- a/util/mutex.h
++++ b/util/mutex.h
@@ -12,8 +12,10 @@
namespace re2 {
@@ -484,10 +484,10 @@ index 9787bfb..e321fae 100644
# ifdef GMUTEX_TRYLOCK
// We need Windows NT or later for TryEnterCriticalSection(). If you
// don't need that functionality, you can remove these _WIN32_WINNT
-diff --git a/third_party/re2/util/pcre.cc b/third_party/re2/util/pcre.cc
+diff --git a/util/pcre.cc b/util/pcre.cc
index 5e67e1f..1602133 100644
---- a/third_party/re2/util/pcre.cc
-+++ b/third_party/re2/util/pcre.cc
+--- a/util/pcre.cc
++++ b/util/pcre.cc
@@ -11,6 +11,11 @@
#include "util/flags.h"
#include "util/pcre.h"
@@ -500,10 +500,10 @@ index 5e67e1f..1602133 100644
#define PCREPORT(level) LOG(level)
// Default PCRE limits.
-diff --git a/third_party/re2/util/pcre.h b/third_party/re2/util/pcre.h
+diff --git a/util/pcre.h b/util/pcre.h
index 4dda95d..771ac91 100644
---- a/third_party/re2/util/pcre.h
-+++ b/third_party/re2/util/pcre.h
+--- a/util/pcre.h
++++ b/util/pcre.h
@@ -180,9 +180,15 @@ struct pcre_extra { int flags, match_limit, match_limit_recursion; };
#define PCRE_ERROR_MATCHLIMIT 2
#define PCRE_ERROR_RECURSIONLIMIT 3
@@ -520,10 +520,10 @@ index 4dda95d..771ac91 100644
} // namespace re2
#endif
-diff --git a/third_party/re2/util/stringprintf.cc b/third_party/re2/util/stringprintf.cc
+diff --git a/util/stringprintf.cc b/util/stringprintf.cc
index c908181..d4691d1 100644
---- a/third_party/re2/util/stringprintf.cc
-+++ b/third_party/re2/util/stringprintf.cc
+--- a/util/stringprintf.cc
++++ b/util/stringprintf.cc
@@ -4,6 +4,10 @@
#include "util/util.h"
@@ -535,10 +535,10 @@ index c908181..d4691d1 100644
namespace re2 {
static void StringAppendV(string* dst, const char* format, va_list ap) {
-diff --git a/third_party/re2/util/test.cc b/third_party/re2/util/test.cc
+diff --git a/util/test.cc b/util/test.cc
index 0644829..2fe1bfa 100644
---- a/third_party/re2/util/test.cc
-+++ b/third_party/re2/util/test.cc
+--- a/util/test.cc
++++ b/util/test.cc
@@ -3,7 +3,9 @@
// license that can be found in the LICENSE file.
@@ -563,10 +563,10 @@ index 0644829..2fe1bfa 100644
}
} // namespace re2
-diff --git a/third_party/re2/util/util.h b/third_party/re2/util/util.h
-index 63a9c6f..dab7e16 100644
---- a/third_party/re2/util/util.h
-+++ b/third_party/re2/util/util.h
+diff --git a/util/util.h b/util/util.h
+index c46ab1b..17ef824 100644
+--- a/util/util.h
++++ b/util/util.h
@@ -12,7 +12,9 @@
#include <stddef.h> // For size_t
#include <assert.h>
@@ -575,9 +575,9 @@ index 63a9c6f..dab7e16 100644
#include <sys/time.h>
+#endif
#include <time.h>
+ #include <ctype.h> // For isdigit, isalpha.
- // C++
-@@ -50,7 +52,11 @@ using std::tr1::unordered_set;
+@@ -51,7 +53,11 @@ using std::tr1::unordered_set;
#else
#include <unordered_set>
@@ -589,10 +589,10 @@ index 63a9c6f..dab7e16 100644
#endif
-diff --git a/third_party/re2/util/valgrind.h b/third_party/re2/util/valgrind.h
+diff --git a/util/valgrind.h b/util/valgrind.h
index ca10b1a..d097b0c 100644
---- a/third_party/re2/util/valgrind.h
-+++ b/third_party/re2/util/valgrind.h
+--- a/util/valgrind.h
++++ b/util/valgrind.h
@@ -4064,6 +4064,7 @@ typedef
#endif /* PLAT_ppc64_aix5 */
diff --git a/third_party/re2/patches/remove-static-initializers.patch b/third_party/re2/patches/remove-static-initializers.patch
index 73df64c..c9ef9e3 100644
--- a/third_party/re2/patches/remove-static-initializers.patch
+++ b/third_party/re2/patches/remove-static-initializers.patch
@@ -1,7 +1,7 @@
-diff --git a/third_party/re2/re2/compile.cc b/third_party/re2/re2/compile.cc
+diff --git a/re2/compile.cc b/re2/compile.cc
index adb45fd..14e401a 100644
---- a/third_party/re2/re2/compile.cc
-+++ b/third_party/re2/re2/compile.cc
+--- a/re2/compile.cc
++++ b/re2/compile.cc
@@ -44,7 +44,7 @@ struct PatchList {
static PatchList Append(Prog::Inst *inst0, PatchList l1, PatchList l2);
};
@@ -61,11 +61,11 @@ index adb45fd..14e401a 100644
re->Decref();
if (c.failed_)
return NULL;
-diff --git a/third_party/re2/re2/re2.cc b/third_party/re2/re2/re2.cc
-index 78978f1..61b88e7 100644
---- a/third_party/re2/re2/re2.cc
-+++ b/third_party/re2/re2/re2.cc
-@@ -34,10 +34,10 @@ namespace re2 {
+diff --git a/re2/re2.cc b/re2/re2.cc
+index 0da886d..b9e44fc 100644
+--- a/re2/re2.cc
++++ b/re2/re2.cc
+@@ -32,10 +32,10 @@ namespace re2 {
static const int kMaxArgs = 16;
static const int kVecSize = 1+kMaxArgs;
@@ -80,10 +80,10 @@ index 78978f1..61b88e7 100644
#define kDefaultMaxMem (8<<20)
-diff --git a/third_party/re2/re2/variadic_function.h b/third_party/re2/re2/variadic_function.h
+diff --git a/re2/variadic_function.h b/re2/variadic_function.h
index 8d2b763..7c7d6d5 100644
---- a/third_party/re2/re2/variadic_function.h
-+++ b/third_party/re2/re2/variadic_function.h
+--- a/re2/variadic_function.h
++++ b/re2/variadic_function.h
@@ -11,8 +11,6 @@ template <typename Result, typename Param0, typename Param1, typename Arg,
Result (*Func)(Param0, Param1, const Arg* const [], int count)>
class VariadicFunction2 {
diff --git a/third_party/re2/patches/remove-testinstall.cc-and-fix-filepermissions.patch b/third_party/re2/patches/remove-testinstall.cc-and-fix-filepermissions.patch
deleted file mode 100644
index 6b92769..0000000
--- a/third_party/re2/patches/remove-testinstall.cc-and-fix-filepermissions.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-diff --git a/third_party/re2/re2/unicode.py b/third_party/re2/re2/unicode.py
-old mode 100755
-new mode 100644
-diff --git a/third_party/re2/testinstall.cc b/third_party/re2/testinstall.cc
-deleted file mode 100644
-index 40b7a8a..0000000
---- a/third_party/re2/testinstall.cc
-+++ /dev/null
-@@ -1,20 +0,0 @@
--#include <re2/re2.h>
--#include <re2/filtered_re2.h>
--#include <stdio.h>
--
--using namespace re2;
--
--int main(void) {
-- FilteredRE2 f;
-- int id;
-- f.Add("a.*b.*c", RE2::DefaultOptions, &id);
-- vector<string> v;
-- f.Compile(&v);
--
-- if(RE2::FullMatch("axbyc", "a.*b.*c")) {
-- printf("PASS\n");
-- return 0;
-- }
-- printf("FAIL\n");
-- return 2;
--}
diff --git a/third_party/re2/patches/remove-valgrind-code.patch b/third_party/re2/patches/remove-valgrind-code.patch
index 1d8884a..ba6007a 100644
--- a/third_party/re2/patches/remove-valgrind-code.patch
+++ b/third_party/re2/patches/remove-valgrind-code.patch
@@ -1,7 +1,7 @@
-diff --git a/third_party/re2/re2/dfa.cc b/third_party/re2/re2/dfa.cc
-index 3a6a387..32c8c33 100644
---- a/third_party/re2/re2/dfa.cc
-+++ b/third_party/re2/re2/dfa.cc
+diff --git a/re2/dfa.cc b/re2/dfa.cc
+index 2556c0f..f1fc7b0 100644
+--- a/re2/dfa.cc
++++ b/re2/dfa.cc
@@ -27,6 +27,8 @@
#include "util/flags.h"
#include "util/sparse_set.h"
@@ -11,11 +11,11 @@ index 3a6a387..32c8c33 100644
DEFINE_bool(re2_dfa_bail_when_slow, true,
"Whether the RE2 DFA should bail out early "
"if the NFA would be faster (for testing).");
-diff --git a/third_party/re2/util/util.h b/third_party/re2/util/util.h
-index a43ff76..63a9c6f 100644
---- a/third_party/re2/util/util.h
-+++ b/third_party/re2/util/util.h
-@@ -26,6 +26,8 @@
+diff --git a/util/util.h b/util/util.h
+index 471c64f..c46ab1b 100644
+--- a/util/util.h
++++ b/util/util.h
+@@ -27,6 +27,8 @@
#include <utility>
#include <set>
@@ -24,25 +24,7 @@ index a43ff76..63a9c6f 100644
// Use std names.
using std::set;
using std::pair;
-@@ -80,17 +82,6 @@ template<bool> struct CompileAssert {};
-
- #define arraysize(array) (sizeof(array)/sizeof((array)[0]))
-
--// Fake lock annotations. For real ones, see
--// http://code.google.com/p/data-race-test/
--#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)
--
- class StringPiece;
-
- string CEscape(const StringPiece& src);
-@@ -116,8 +107,6 @@ static inline uint64 Hash64StringWithSeed(const char* s, int len, uint32 seed) {
+@@ -119,8 +121,6 @@ static inline uint64 Hash64StringWithSeed(const char* s, int len, uint32 seed) {
return ((uint64)x << 32) | y;
}
diff --git a/third_party/re2/patches/rename-posix-option.patch b/third_party/re2/patches/rename-posix-option.patch
index 5c8a8e7..47caa63 100644
--- a/third_party/re2/patches/rename-posix-option.patch
+++ b/third_party/re2/patches/rename-posix-option.patch
@@ -1,8 +1,8 @@
-diff --git a/third_party/re2/re2/re2.cc b/third_party/re2/re2/re2.cc
-index 6acd802..3cc3dd4 100644
---- a/third_party/re2/re2/re2.cc
-+++ b/third_party/re2/re2/re2.cc
-@@ -38,8 +38,8 @@ const int RE2::Options::kDefaultMaxMem; // initialized in re2.h
+diff --git a/re2/re2.cc b/re2/re2.cc
+index b9e44fc..fb43abf 100644
+--- a/re2/re2.cc
++++ b/re2/re2.cc
+@@ -56,8 +56,8 @@ RE2::Options::Options()
RE2::Options::Options(RE2::CannedOptions opt)
: encoding_(opt == RE2::Latin1 ? EncodingLatin1 : EncodingUTF8),
@@ -13,10 +13,10 @@ index 6acd802..3cc3dd4 100644
log_errors_(opt != RE2::Quiet),
max_mem_(kDefaultMaxMem),
literal_(false),
-diff --git a/third_party/re2/re2/re2.h b/third_party/re2/re2/re2.h
-index 272028b..9f5b66d 100644
---- a/third_party/re2/re2/re2.h
-+++ b/third_party/re2/re2/re2.h
+diff --git a/re2/re2.h b/re2/re2.h
+index c509853..98b06b8 100644
+--- a/re2/re2.h
++++ b/re2/re2.h
@@ -251,7 +251,7 @@ class RE2 {
enum CannedOptions {
DefaultOptions = 0,
diff --git a/third_party/re2/re2/dfa.cc b/third_party/re2/re2/dfa.cc
index 36ec66f..f1fc7b0 100644
--- a/third_party/re2/re2/dfa.cc
+++ b/third_party/re2/re2/dfa.cc
@@ -470,8 +470,8 @@ DFA::DFA(Prog* prog, Prog::MatchKind kind, int64 max_mem)
// At minimum, the search requires room for two states in order
// to limp along, restarting frequently. We'll get better performance
// if there is room for a larger number of states, say 20.
- size_t one_state = sizeof(State) + (prog_->size()+nmark)*sizeof(int) +
- (prog_->bytemap_range()+1)*sizeof(State*);
+ int64 one_state = sizeof(State) + (prog_->size()+nmark)*sizeof(int) +
+ (prog_->bytemap_range()+1)*sizeof(State*);
if (state_budget_ < 20*one_state) {
LOG(INFO) << StringPrintf("DFA out of memory: prog size %lld mem %lld",
prog_->size(), max_mem);
diff --git a/third_party/re2/re2/filtered_re2.cc b/third_party/re2/re2/filtered_re2.cc
index 9269cee..f576258 100644
--- a/third_party/re2/re2/filtered_re2.cc
+++ b/third_party/re2/re2/filtered_re2.cc
@@ -27,8 +27,10 @@ RE2::ErrorCode FilteredRE2::Add(const StringPiece& pattern,
RE2::ErrorCode code = re->error_code();
if (!re->ok()) {
- LOG(ERROR) << "Couldn't compile regular expression, skipping: "
- << re << " due to error " << re->error();
+ if (options.log_errors()) {
+ LOG(ERROR) << "Couldn't compile regular expression, skipping: "
+ << re << " due to error " << re->error();
+ }
delete re;
} else {
*id = re2_vec_.size();
diff --git a/third_party/re2/re2/parse.cc b/third_party/re2/re2/parse.cc
index 6423fe9..0cf4ab4 100644
--- a/third_party/re2/re2/parse.cc
+++ b/third_party/re2/re2/parse.cc
@@ -16,8 +16,6 @@
// and recognizes the Perl escape sequences \d, \s, \w, \D, \S, and \W.
// See regexp.h for rationale.
-#include <ctype.h>
-
#include "util/util.h"
#include "re2/regexp.h"
#include "re2/stringpiece.h"
diff --git a/third_party/re2/re2/re2.cc b/third_party/re2/re2/re2.cc
index 61b88e7..fb43abf 100644
--- a/third_party/re2/re2/re2.cc
+++ b/third_party/re2/re2/re2.cc
@@ -9,8 +9,6 @@
#include "re2/re2.h"
-#include <ctype.h>
-
#include <stdio.h>
#include <string>
#ifdef WIN32
@@ -152,7 +150,8 @@ int RE2::Options::ParseFlags() const {
int flags = Regexp::ClassNL;
switch (encoding()) {
default:
- LOG(ERROR) << "Unknown encoding " << encoding();
+ if (log_errors())
+ LOG(ERROR) << "Unknown encoding " << encoding();
break;
case RE2::Options::EncodingUTF8:
break;
@@ -554,10 +553,11 @@ bool RE2::Match(const StringPiece& text,
}
if (startpos < 0 || startpos > endpos || endpos > text.size()) {
- LOG(ERROR) << "RE2: invalid startpos, endpos pair.";
+ if (options_.log_errors())
+ LOG(ERROR) << "RE2: invalid startpos, endpos pair.";
return false;
}
-
+
StringPiece subtext = text;
subtext.remove_prefix(startpos);
subtext.remove_suffix(text.size() - endpos);
@@ -673,7 +673,8 @@ bool RE2::Match(const StringPiece& text,
LOG(INFO) << "Match " << trunc(pattern_)
<< " [" << CEscape(subtext) << "]"
<< " DFA inconsistency.";
- LOG(ERROR) << "DFA inconsistency";
+ if (options_.log_errors())
+ LOG(ERROR) << "DFA inconsistency";
return false;
}
if (FLAGS_trace_re2)
@@ -757,7 +758,7 @@ bool RE2::Match(const StringPiece& text,
<< " [" << CEscape(subtext) << "]"
<< " using OnePass.";
if (!prog_->SearchOnePass(subtext1, text, anchor, kind, submatch, ncap)) {
- if (!skipped_test)
+ if (!skipped_test && options_.log_errors())
LOG(ERROR) << "SearchOnePass inconsistency";
return false;
}
@@ -768,7 +769,7 @@ bool RE2::Match(const StringPiece& text,
<< " using BitState.";
if (!prog_->SearchBitState(subtext1, text, anchor,
kind, submatch, ncap)) {
- if (!skipped_test)
+ if (!skipped_test && options_.log_errors())
LOG(ERROR) << "SearchBitState inconsistency";
return false;
}
@@ -778,7 +779,7 @@ bool RE2::Match(const StringPiece& text,
<< " [" << CEscape(subtext) << "]"
<< " using NFA.";
if (!prog_->SearchNFA(subtext1, text, anchor, kind, submatch, ncap)) {
- if (!skipped_test)
+ if (!skipped_test && options_.log_errors())
LOG(ERROR) << "SearchNFA inconsistency";
return false;
}
@@ -877,8 +878,10 @@ bool RE2::Rewrite(string *out, const StringPiece &rewrite,
if (isdigit(c)) {
int n = (c - '0');
if (n >= veclen) {
- LOG(ERROR) << "requested group " << n
- << " in regexp " << rewrite.data();
+ if (options_.log_errors()) {
+ LOG(ERROR) << "requested group " << n
+ << " in regexp " << rewrite.data();
+ }
return false;
}
StringPiece snip = vec[n];
@@ -887,7 +890,8 @@ bool RE2::Rewrite(string *out, const StringPiece &rewrite,
} else if (c == '\\') {
out->push_back('\\');
} else {
- LOG(ERROR) << "invalid rewrite pattern: " << rewrite.data();
+ if (options_.log_errors())
+ LOG(ERROR) << "invalid rewrite pattern: " << rewrite.data();
return false;
}
} else {
diff --git a/third_party/re2/testinstall.cc b/third_party/re2/testinstall.cc
new file mode 100644
index 0000000..17edfb4
--- /dev/null
+++ b/third_party/re2/testinstall.cc
@@ -0,0 +1,24 @@
+// Copyright 2008 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 <re2/re2.h>
+#include <re2/filtered_re2.h>
+#include <stdio.h>
+
+using namespace re2;
+
+int main(void) {
+ FilteredRE2 f;
+ int id;
+ f.Add("a.*b.*c", RE2::DefaultOptions, &id);
+ vector<string> v;
+ f.Compile(&v);
+
+ if(RE2::FullMatch("axbyc", "a.*b.*c")) {
+ printf("PASS\n");
+ return 0;
+ }
+ printf("FAIL\n");
+ return 2;
+}
diff --git a/third_party/re2/util/logging.h b/third_party/re2/util/logging.h
index 4478f9b21..d0a2d87 100644
--- a/third_party/re2/util/logging.h
+++ b/third_party/re2/util/logging.h
@@ -59,11 +59,8 @@ class LogMessage {
void Flush() {
stream() << "\n";
string s = str_.str();
-#ifdef WIN32
- write(2, s.data(), static_cast<unsigned int>(s.size()));
-#else
- if(write(2, s.data(), s.size()) < 0) {} // shut up gcc
-#endif
+ int n = (int)s.size(); // shut up msvc
+ if(write(2, s.data(), n) < 0) {} // shut up gcc
flushed_ = true;
}
~LogMessage() {
diff --git a/third_party/re2/util/util.h b/third_party/re2/util/util.h
index 11b5f4a..8f54040 100644
--- a/third_party/re2/util/util.h
+++ b/third_party/re2/util/util.h
@@ -16,6 +16,7 @@
#include <sys/time.h>
#endif
#include <time.h>
+#include <ctype.h> // For isdigit, isalpha.
// C++
#include <vector>
@@ -89,6 +90,19 @@ template<bool> struct CompileAssert {};
#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;
string CEscape(const StringPiece& src);