deps: bump re2 to 2023-07-01

This commit is contained in:
Corentin Le Molgat
2023-07-05 15:13:59 +02:00
parent bf9f9d79e5
commit c5a2fa1eb6
5 changed files with 7 additions and 57 deletions

View File

@@ -77,7 +77,7 @@ new_git_repository(
## Re2
git_repository(
name = "com_google_re2",
tag = "2023-03-01",
tag = "2023-07-01",
remote = "https://github.com/google/re2.git",
)

View File

@@ -121,8 +121,8 @@ if(BUILD_re2)
FetchContent_Declare(
re2
GIT_REPOSITORY "https://github.com/google/re2.git"
GIT_TAG "2023-03-01"
#PATCH_COMMAND git apply --ignore-whitespace "${CMAKE_CURRENT_LIST_DIR}/../../patches/re2-2023-03-01.patch"
GIT_TAG "2023-07-01"
#PATCH_COMMAND git apply --ignore-whitespace "${CMAKE_CURRENT_LIST_DIR}/../../patches/re2-2023-07-01.patch"
)
FetchContent_MakeAvailable(re2)
list(POP_BACK CMAKE_MESSAGE_INDENT)

View File

@@ -185,7 +185,7 @@ bool LPParser::ParseIntegerVariablesList(StringPiece line) {
bool LPParser::ParseConstraint(StringPiece constraint) {
const StatusOr<ParsedConstraint> parsed_constraint_or_status =
::operations_research::glop::ParseConstraint(constraint.as_string());
::operations_research::glop::ParseConstraint(constraint);
if (!parsed_constraint_or_status.ok()) return false;
const ParsedConstraint& parsed_constraint =
parsed_constraint_or_status.value();
@@ -342,10 +342,9 @@ TokenType LPParser::ConsumeToken(StringPiece* sp) {
} // namespace
StatusOr<ParsedConstraint> ParseConstraint(absl::string_view constraint_view) {
StatusOr<ParsedConstraint> ParseConstraint(absl::string_view constraint) {
ParsedConstraint parsed_constraint;
// Get the name, if present.
StringPiece constraint{constraint_view};
StringPiece constraint_copy{constraint};
std::string consumed_name;
Fractional consumed_coeff;
@@ -413,8 +412,8 @@ StatusOr<ParsedConstraint> ParseConstraint(absl::string_view constraint_view) {
right_bound = consumed_coeff;
if (ConsumeToken(&constraint, &consumed_name, &consumed_coeff) !=
TokenType::END) {
return absl::InvalidArgumentError(absl::StrCat(
"End of input was expected, found: ", constraint.as_string()));
return absl::InvalidArgumentError(
absl::StrCat("End of input was expected, found: ", constraint));
}
}

View File

@@ -12,7 +12,6 @@
# limitations under the License.
exports_files([
"re2-2023-03-01.patch",
"protobuf-v23.3.patch",
"pybind11_bazel.patch",
"pybind11_protobuf.patch",

View File

@@ -1,48 +0,0 @@
diff --git a/re2/stringpiece.h b/re2/stringpiece.h
index 1d9c2d3..b9d6661 100644
--- a/re2/stringpiece.h
+++ b/re2/stringpiece.h
@@ -19,18 +19,13 @@
//
// Arghh! I wish C++ literals were "string".
-// Doing this simplifies the logic below.
-#ifndef __has_include
-#define __has_include(x) 0
-#endif
-
#include <stddef.h>
#include <string.h>
#include <algorithm>
#include <iosfwd>
#include <iterator>
#include <string>
-#if __has_include(<string_view>) && __cplusplus >= 201703L
+#ifdef __cpp_lib_string_view
#include <string_view>
#endif
@@ -57,7 +52,7 @@ class StringPiece {
// expected.
StringPiece()
: data_(NULL), size_(0) {}
-#if __has_include(<string_view>) && __cplusplus >= 201703L
+#ifdef __cpp_lib_string_view
StringPiece(const std::string_view& str)
: data_(str.data()), size_(str.size()) {}
#endif
@@ -103,6 +98,14 @@ class StringPiece {
size_ = len;
}
+#ifdef __cpp_lib_string_view
+ // Converts to `std::basic_string_view`.
+ operator std::basic_string_view<char, traits_type>() const {
+ if (!data_) return {};
+ return std::basic_string_view<char, traits_type>(data_, size_);
+ }
+#endif
+
// Converts to `std::basic_string`.
template <typename A>
explicit operator std::basic_string<char, traits_type, A>() const {