Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package re2 for openSUSE:Factory checked in at 2022-04-08 00:27:21 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/re2 (Old) and /work/SRC/openSUSE:Factory/.re2.new.1900 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "re2" Fri Apr 8 00:27:21 2022 rev:44 rq:967237 version:MACRO Changes: -------- --- /work/SRC/openSUSE:Factory/re2/re2.changes 2022-02-06 23:55:22.218380832 +0100 +++ /work/SRC/openSUSE:Factory/.re2.new.1900/re2.changes 2022-04-08 00:27:47.054278175 +0200 @@ -1,0 +2,7 @@ +Fri Apr 1 17:55:09 UTC 2022 - Andreas Stieger <andreas.stie...@gmx.de> + +- Update to 2022-04-01: + * Improve performance slightly + * Prog::Fangout() is no longer experimental + +------------------------------------------------------------------- Old: ---- re2-2022-02-01.tar.gz New: ---- re2-2022-04-01.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ re2.spec ++++++ --- /var/tmp/diff_new_pack.mrQa4r/_old 2022-04-08 00:27:47.590272160 +0200 +++ /var/tmp/diff_new_pack.mrQa4r/_new 2022-04-08 00:27:47.594272115 +0200 @@ -1,7 +1,7 @@ # # spec file for package re2 # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,7 +16,7 @@ # -%global longver 2022-02-01 +%global longver 2022-04-01 %global shortver %(echo %{longver}|sed 's|-||g') %define libname libre2-9 Name: re2 @@ -28,12 +28,12 @@ URL: https://github.com/google/re2 Source0: %{url}/archive/%{longver}/%{name}-%{longver}.tar.gz Source99: baselibs.conf +BuildRequires: pkgconfig %if %{?suse_version} < 1550 -BuildRequires: gcc10-c++ +BuildRequires: gcc11-c++ %else BuildRequires: gcc-c++ %endif -BuildRequires: pkgconfig %description RE2 is a C++ library providing a fast, safe, thread-friendly alternative to @@ -80,7 +80,7 @@ %build %if 0%{?suse_version} < 1550 -export CXX=g++-10 +export CXX=g++-11 %endif ARCH_FLAGS="`echo %{optflags} | sed -e 's/-O2/-O3/g'`" export CXXFLAGS="${ARCH_FLAGS}" @@ -94,7 +94,7 @@ %check %if 0%{?suse_version} < 1550 -export CXX=g++-10 +export CXX=g++-11 %endif %make_build shared-testinstall DESTDIR=%{buildroot} includedir=%{_includedir} libdir=%{_libdir} ++++++ re2-2022-02-01.tar.gz -> re2-2022-04-01.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/re2-2022-02-01/.github/workflows/ci.yml new/re2-2022-04-01/.github/workflows/ci.yml --- old/re2-2022-02-01/.github/workflows/ci.yml 2022-01-27 21:47:09.000000000 +0100 +++ new/re2-2022-04-01/.github/workflows/ci.yml 2022-03-30 20:41:25.000000000 +0200 @@ -27,7 +27,7 @@ strategy: fail-fast: false matrix: - ver: [9, 10, 11, 12, 13] + ver: [9, 10, 11, 12, 13, 14] env: CC: clang-${{ matrix.ver }} CXX: clang++-${{ matrix.ver }} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/re2-2022-02-01/BUILD new/re2-2022-04-01/BUILD --- old/re2-2022-02-01/BUILD 2022-01-27 21:47:09.000000000 +0100 +++ new/re2-2022-04-01/BUILD 2022-03-30 20:41:25.000000000 +0200 @@ -8,21 +8,6 @@ exports_files(["LICENSE"]) -config_setting( - name = "macos", - values = {"cpu": "darwin"}, -) - -config_setting( - name = "wasm", - values = {"cpu": "wasm32"}, -) - -config_setting( - name = "windows", - values = {"cpu": "x64_windows"}, -) - cc_library( name = "re2", srcs = [ @@ -73,17 +58,17 @@ "re2/stringpiece.h", ], copts = select({ - ":wasm": [], - ":windows": [], + "@platforms//os:wasi": [], + "@platforms//os:windows": [], "//conditions:default": ["-pthread"], }), linkopts = select({ # macOS doesn't need `-pthread' when linking and it appears that # older versions of Clang will warn about the unused command line # argument, so just don't pass it. - ":macos": [], - ":wasm": [], - ":windows": [], + "@platforms//os:macos": [], + "@platforms//os:wasi": [], + "@platforms//os:windows": [], "//conditions:default": ["-pthread"], }), visibility = ["//visibility:public"], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/re2-2022-02-01/CMakeLists.txt new/re2-2022-04-01/CMakeLists.txt --- old/re2-2022-02-01/CMakeLists.txt 2022-01-27 21:47:09.000000000 +0100 +++ new/re2-2022-04-01/CMakeLists.txt 2022-03-30 20:41:25.000000000 +0200 @@ -10,9 +10,10 @@ include(CTest) include(GNUInstallDirs) -if(NOT CMAKE_CXX_STANDARD) +# Unlike GCC and upstream Clang, AppleClang still defaults to `-std=c++98` +# for some reason. Set CMAKE_CXX_STANDARD if we seem to need to set it. :/ +if(APPLE AND NOT CMAKE_CXX_FLAGS MATCHES "-std=" AND NOT CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 11) - set(CMAKE_CXX_STANDARD_REQUIRED ON) endif() option(BUILD_SHARED_LIBS "build shared libraries" OFF) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/re2-2022-02-01/Makefile new/re2-2022-04-01/Makefile --- old/re2-2022-02-01/Makefile 2022-01-27 21:47:09.000000000 +0100 +++ new/re2-2022-04-01/Makefile 2022-03-30 20:41:25.000000000 +0200 @@ -331,13 +331,13 @@ static-testinstall: LDFLAGS:=-pthread -L$(DESTDIR)$(libdir) -l:libre2.a $(LDICU) $(LDFLAGS) static-testinstall: @mkdir -p obj - @cp testinstall.cc obj + @cp testinstall.cc obj/static-testinstall.cc ifeq ($(shell uname),Darwin) @echo Skipping test for libre2.a on Darwin. else ifeq ($(shell uname),SunOS) @echo Skipping test for libre2.a on SunOS. else - (cd obj && $(CXX) testinstall.cc -o static-testinstall $(CXXFLAGS) $(LDFLAGS)) + (cd obj && $(CXX) static-testinstall.cc -o static-testinstall $(CXXFLAGS) $(LDFLAGS)) obj/static-testinstall endif @@ -346,8 +346,8 @@ shared-testinstall: LDFLAGS:=-pthread -L$(DESTDIR)$(libdir) -lre2 $(LDICU) $(LDFLAGS) shared-testinstall: @mkdir -p obj - @cp testinstall.cc obj - (cd obj && $(CXX) testinstall.cc -o shared-testinstall $(CXXFLAGS) $(LDFLAGS)) + @cp testinstall.cc obj/shared-testinstall.cc + (cd obj && $(CXX) shared-testinstall.cc -o shared-testinstall $(CXXFLAGS) $(LDFLAGS)) ifeq ($(shell uname),Darwin) DYLD_LIBRARY_PATH="$(DESTDIR)$(libdir):$(DYLD_LIBRARY_PATH)" obj/shared-testinstall else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/re2-2022-02-01/doc/README.xkcd new/re2-2022-04-01/doc/README.xkcd --- old/re2-2022-02-01/doc/README.xkcd 2022-01-27 21:47:09.000000000 +0100 +++ new/re2-2022-04-01/doc/README.xkcd 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -xkcd.png is a cropped version of http://xkcd.com/208/ Binary files old/re2-2022-02-01/doc/xkcd.png and new/re2-2022-04-01/doc/xkcd.png differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/re2-2022-02-01/re2/prefilter_tree.cc new/re2-2022-04-01/re2/prefilter_tree.cc --- old/re2-2022-02-01/re2/prefilter_tree.cc 2022-01-27 21:47:09.000000000 +0100 +++ new/re2-2022-04-01/re2/prefilter_tree.cc 2022-03-30 20:41:25.000000000 +0200 @@ -8,7 +8,6 @@ #include <algorithm> #include <map> #include <memory> -#include <set> #include <string> #include <utility> #include <vector> @@ -36,9 +35,6 @@ PrefilterTree::~PrefilterTree() { for (size_t i = 0; i < prefilter_vec_.size(); i++) delete prefilter_vec_[i]; - - for (size_t i = 0; i < entries_.size(); i++) - delete entries_[i].parents; } void PrefilterTree::Add(Prefilter* prefilter) { @@ -67,7 +63,6 @@ compiled_ = true; - // TODO(junyer): Use std::unordered_set<Prefilter*> instead? NodeMap nodes; AssignUniqueIds(&nodes, atom_vec); @@ -78,25 +73,21 @@ // not miss out on any regexps triggering by getting rid of a // prefilter node. for (size_t i = 0; i < entries_.size(); i++) { - StdIntMap* parents = entries_[i].parents; - if (parents->size() > 8) { + std::vector<int>& parents = entries_[i].parents; + if (parents.size() > 8) { // This one triggers too many things. If all the parents are AND // nodes and have other things guarding them, then get rid of // this trigger. TODO(vsri): Adjust the threshold appropriately, // make it a function of total number of nodes? bool have_other_guard = true; - for (StdIntMap::iterator it = parents->begin(); - it != parents->end(); ++it) { + for (int parent : parents) { have_other_guard = have_other_guard && - (entries_[it->first].propagate_up_at_count > 1); + (entries_[parent].propagate_up_at_count > 1); } - if (have_other_guard) { - for (StdIntMap::iterator it = parents->begin(); - it != parents->end(); ++it) - entries_[it->first].propagate_up_at_count -= 1; - - parents->clear(); // Forget the parents + for (int parent : parents) + entries_[parent].propagate_up_at_count -= 1; + parents.clear(); // Forget the parents } } } @@ -217,20 +208,7 @@ node->set_unique_id(canonical->unique_id()); } } - entries_.resize(nodes->size()); - - // Create parent StdIntMap for the entries. - for (int i = static_cast<int>(v.size()) - 1; i >= 0; i--) { - Prefilter* prefilter = v[i]; - if (prefilter == NULL) - continue; - - if (CanonicalNode(nodes, prefilter) != prefilter) - continue; - - Entry* entry = &entries_[prefilter->unique_id()]; - entry->parents = new StdIntMap(); - } + entries_.resize(unique_id); // Fill the entries. for (int i = static_cast<int>(v.size()) - 1; i >= 0; i--) { @@ -241,41 +219,34 @@ if (CanonicalNode(nodes, prefilter) != prefilter) continue; - Entry* entry = &entries_[prefilter->unique_id()]; + int id = prefilter->unique_id(); switch (prefilter->op()) { default: - case Prefilter::ALL: LOG(DFATAL) << "Unexpected op: " << prefilter->op(); return; case Prefilter::ATOM: - entry->propagate_up_at_count = 1; + entries_[id].propagate_up_at_count = 1; break; case Prefilter::OR: case Prefilter::AND: { - std::set<int> uniq_child; + // For each child, we append our id to the child's list of + // parent ids... unless we happen to have done so already. + // The number of appends is the number of unique children, + // which allows correct upward propagation from AND nodes. + int up_count = 0; for (size_t j = 0; j < prefilter->subs()->size(); j++) { - Prefilter* child = (*prefilter->subs())[j]; - Prefilter* canonical = CanonicalNode(nodes, child); - if (canonical == NULL) { - LOG(DFATAL) << "Null canonical node"; - return; - } - int child_id = canonical->unique_id(); - uniq_child.insert(child_id); - // To the child, we want to add to parent indices. - Entry* child_entry = &entries_[child_id]; - if (child_entry->parents->find(prefilter->unique_id()) == - child_entry->parents->end()) { - (*child_entry->parents)[prefilter->unique_id()] = 1; + int child_id = (*prefilter->subs())[j]->unique_id(); + std::vector<int>& parents = entries_[child_id].parents; + if (parents.empty() || parents.back() != id) { + parents.push_back(id); + up_count++; } } - entry->propagate_up_at_count = prefilter->op() == Prefilter::AND - ? static_cast<int>(uniq_child.size()) - : 1; - + entries_[id].propagate_up_at_count = + prefilter->op() == Prefilter::AND ? up_count : 1; break; } } @@ -336,10 +307,7 @@ regexps->set(entry.regexps[i], 1); int c; // Pass trigger up to parents. - for (StdIntMap::iterator it = entry.parents->begin(); - it != entry.parents->end(); - ++it) { - int j = it->first; + for (int j : entry.parents) { const Entry& parent = entries_[j]; // Delay until all the children have succeeded. if (parent.propagate_up_at_count > 1) { @@ -369,12 +337,12 @@ LOG(ERROR) << "#Unique Nodes: " << entries_.size(); for (size_t i = 0; i < entries_.size(); i++) { - StdIntMap* parents = entries_[i].parents; + const std::vector<int>& parents = entries_[i].parents; const std::vector<int>& regexps = entries_[i].regexps; LOG(ERROR) << "EntryId: " << i - << " N: " << parents->size() << " R: " << regexps.size(); - for (StdIntMap::iterator it = parents->begin(); it != parents->end(); ++it) - LOG(ERROR) << it->first; + << " N: " << parents.size() << " R: " << regexps.size(); + for (int parent : parents) + LOG(ERROR) << parent; } LOG(ERROR) << "Map:"; for (NodeMap::const_iterator iter = nodes->begin(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/re2-2022-02-01/re2/prefilter_tree.h new/re2-2022-04-01/re2/prefilter_tree.h --- old/re2-2022-02-01/re2/prefilter_tree.h 2022-01-27 21:47:09.000000000 +0100 +++ new/re2-2022-04-01/re2/prefilter_tree.h 2022-03-30 20:41:25.000000000 +0200 @@ -59,7 +59,8 @@ private: typedef SparseArray<int> IntMap; - typedef std::map<int, int> StdIntMap; + // TODO(junyer): Use std::unordered_set<Prefilter*> instead? + // It should be trivial to get rid of the stringification... typedef std::map<std::string, Prefilter*> NodeMap; // Each unique node has a corresponding Entry that helps in @@ -77,7 +78,7 @@ // are two different nodes, but they share the atom 'def'. So when // 'def' matches, it triggers two parents, corresponding to the two // different OR nodes. - StdIntMap* parents; + std::vector<int> parents; // When this node is ready to trigger the parent, what are the // regexps that are triggered. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/re2-2022-02-01/re2/prog.h new/re2-2022-04-01/re2/prog.h --- old/re2-2022-02-01/re2/prog.h 2022-01-27 21:47:09.000000000 +0100 +++ new/re2-2022-04-01/re2/prog.h 2022-03-30 20:41:25.000000000 +0200 @@ -361,7 +361,6 @@ // Returns true on success, false on error. bool PossibleMatchRange(std::string* min, std::string* max, int maxlen); - // EXPERIMENTAL! SUBJECT TO CHANGE! // Outputs the program fanout into the given sparse array. void Fanout(SparseArray<int>* fanout); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/re2-2022-02-01/re2/stringpiece.h new/re2-2022-04-01/re2/stringpiece.h --- old/re2-2022-02-01/re2/stringpiece.h 2022-01-27 21:47:09.000000000 +0100 +++ new/re2-2022-04-01/re2/stringpiece.h 2022-03-30 20:41:25.000000000 +0200 @@ -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 @@ // 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 @@ 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 { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/re2-2022-02-01/util/mutex.h new/re2-2022-04-01/util/mutex.h --- old/re2-2022-02-01/util/mutex.h 2022-01-27 21:47:09.000000000 +0100 +++ new/re2-2022-04-01/util/mutex.h 2022-03-30 20:41:25.000000000 +0200 @@ -33,8 +33,8 @@ #include <stdlib.h> typedef pthread_rwlock_t MutexType; #else -#include <mutex> -typedef std::mutex MutexType; +#include <shared_mutex> +typedef std::shared_mutex MutexType; #endif namespace re2 { @@ -95,8 +95,8 @@ Mutex::~Mutex() { } void Mutex::Lock() { mutex_.lock(); } void Mutex::Unlock() { mutex_.unlock(); } -void Mutex::ReaderLock() { Lock(); } // C++11 doesn't have std::shared_mutex. -void Mutex::ReaderUnlock() { Unlock(); } +void Mutex::ReaderLock() { mutex_.lock_shared(); } +void Mutex::ReaderUnlock() { mutex_.unlock_shared(); } #endif