diff --git a/WORKSPACE b/WORKSPACE index 6260b5401f..0af7c4b088 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -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", ) diff --git a/cmake/dependencies/CMakeLists.txt b/cmake/dependencies/CMakeLists.txt index ee3380de82..311ad27292 100644 --- a/cmake/dependencies/CMakeLists.txt +++ b/cmake/dependencies/CMakeLists.txt @@ -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) diff --git a/ortools/lp_data/lp_parser.cc b/ortools/lp_data/lp_parser.cc index 58286306e5..bd26c019ab 100644 --- a/ortools/lp_data/lp_parser.cc +++ b/ortools/lp_data/lp_parser.cc @@ -185,7 +185,7 @@ bool LPParser::ParseIntegerVariablesList(StringPiece line) { bool LPParser::ParseConstraint(StringPiece constraint) { const StatusOr 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 ParseConstraint(absl::string_view constraint_view) { +StatusOr 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 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)); } } diff --git a/patches/BUILD.bazel b/patches/BUILD.bazel index c4edd40a17..faa1885374 100644 --- a/patches/BUILD.bazel +++ b/patches/BUILD.bazel @@ -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", diff --git a/patches/re2-2023-03-01.patch b/patches/re2-2023-03-01.patch deleted file mode 100644 index e3b4be698a..0000000000 --- a/patches/re2-2023-03-01.patch +++ /dev/null @@ -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 - #include - #include - #include - #include - #include --#if __has_include() && __cplusplus >= 201703L -+#ifdef __cpp_lib_string_view - #include - #endif - -@@ -57,7 +52,7 @@ class StringPiece { - // expected. - StringPiece() - : data_(NULL), size_(0) {} --#if __has_include() && __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() const { -+ if (!data_) return {}; -+ return std::basic_string_view(data_, size_); -+ } -+#endif -+ - // Converts to `std::basic_string`. - template - explicit operator std::basic_string() const {