From 509d27117c4e794f566ad37b1fdabb4b78be51ce Mon Sep 17 00:00:00 2001 From: nyanpasu64 Date: Sun, 19 Sep 2021 10:24:56 -0700 Subject: [PATCH] Fix building test-helpers.c++ hasSubstring() on Windows C++17 The std::boyer_moore_horspool_searcher() codepath is complex and untested, and was broken without being caught on CI, so remove it since hasSubstring() isn't performance-critical. Partly reverts bd88a9157e81000168e03e281172da4fb04e5e45. #include was added in that commit, so I assume it's unused in the rest of this file and can safely be removed. --- c++/src/kj/test-helpers.c++ | 5 ----- 1 file changed, 5 deletions(-) diff --git a/c++/src/kj/test-helpers.c++ b/c++/src/kj/test-helpers.c++ index c4fcbc19f..cd480a450 100644 --- a/c++/src/kj/test-helpers.c++ +++ b/c++/src/kj/test-helpers.c++ @@ -34,8 +34,6 @@ #include #endif -#include - namespace kj { namespace _ { // private @@ -49,9 +47,6 @@ bool hasSubstring(StringPtr haystack, StringPtr needle) { #if !defined(_WIN32) return memmem(haystack.begin(), haystack.size(), needle.begin(), needle.size()) != nullptr; -#elif defined(__cpp_lib_boyer_moore_searcher) - std::boyer_moore_horspool_searcher searcher{needle.begin(), needle.size()}; - return std::search(haystack.begin(), haystack.end(), searcher) != haystack.end(); #else // TODO(perf): This is not the best algorithm for substring matching. strstr can't be used // because this is supposed to be safe to call on strings with embedded nulls.