diff --git a/CHANGELOG.md b/CHANGELOG.md index bc8910bd5..ea44debe9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ This is a list of notable changes to Hyperscan, in reverse chronological order. +## [5.2.1] 2019-10-13 +- Bugfix for issue #186: fix compile issue when `BUILD_SHARED_LIBS` is on in + release mode. +- Disable redundant move check for older compiler versions. + ## [5.2.0] 2019-07-12 - Literal API: add new API `hs_compile_lit()` and `hs_compile_lit_multi()` to process pure literal rule sets. The 2 literal APIs treat each expression text diff --git a/CMakeLists.txt b/CMakeLists.txt index 3801f994a..83197af1e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ project (hyperscan C CXX) set (HS_MAJOR_VERSION 5) set (HS_MINOR_VERSION 2) -set (HS_PATCH_VERSION 0) +set (HS_PATCH_VERSION 1) set (HS_VERSION ${HS_MAJOR_VERSION}.${HS_MINOR_VERSION}.${HS_PATCH_VERSION}) set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) @@ -395,6 +395,12 @@ if (CXX_IGNORED_ATTR) set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-ignored-attributes") endif() +# gcc 9 complains about redundant move for returned variable +CHECK_CXX_COMPILER_FLAG("-Wredundant-move" CXX_REDUNDANT_MOVE) +if (CXX_REDUNDANT_MOVE) + set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-redundant-move") +endif() + # note this for later # g++ doesn't have this flag but clang does CHECK_CXX_COMPILER_FLAG("-Wweak-vtables" CXX_WEAK_VTABLES) diff --git a/doc/dev-reference/compilation.rst b/doc/dev-reference/compilation.rst index 5d2c70f79..93290467b 100644 --- a/doc/dev-reference/compilation.rst +++ b/doc/dev-reference/compilation.rst @@ -613,8 +613,9 @@ When an expression has the :c:member:`HS_FLAG_COMBINATION` flag set, it ignores all other flags except the :c:member:`HS_FLAG_SINGLEMATCH` flag and the :c:member:`HS_FLAG_QUIET` flag. -Hyperscan will reject logical combination expressions at compile time that -evaluate to *true* when no patterns have matched; for example: :: +Hyperscan will accept logical combination expressions at compile time that +evaluate to *true* when no patterns have matched, and report the match for +combination at end of data if no patterns have matched; for example: :: !101 !101|102 diff --git a/tools/hsbench/engine_hyperscan.cpp b/tools/hsbench/engine_hyperscan.cpp index c1f1e8c49..79c58f77d 100644 --- a/tools/hsbench/engine_hyperscan.cpp +++ b/tools/hsbench/engine_hyperscan.cpp @@ -414,6 +414,7 @@ buildEngineHyperscan(const ExpressionMap &expressions, ScanMode scan_mode, hs_compile_error_t *compile_err; Timer timer; +#ifndef RELEASE_BUILD if (useLiteralApi) { // Pattern length computation should be done before timer start. vector lens(count); @@ -434,6 +435,26 @@ buildEngineHyperscan(const ExpressionMap &expressions, ScanMode scan_mode, grey); timer.complete(); } +#else + if (useLiteralApi) { + // Pattern length computation should be done before timer start. + vector lens(count); + for (unsigned int i = 0; i < count; i++) { + lens[i] = strlen(patterns[i]); + } + timer.start(); + err = hs_compile_lit_multi(patterns.data(), flags.data(), + ids.data(), lens.data(), count, + full_mode, nullptr, &db, &compile_err); + timer.complete(); + } else { + timer.start(); + err = hs_compile_ext_multi(patterns.data(), flags.data(), + ids.data(), ext_ptr.data(), count, + full_mode, nullptr, &db, &compile_err); + timer.complete(); + } +#endif compileSecs = timer.seconds(); peakMemorySize = getPeakHeap(); diff --git a/tools/hscheck/main.cpp b/tools/hscheck/main.cpp index 9cfe73dff..197087bba 100644 --- a/tools/hscheck/main.cpp +++ b/tools/hscheck/main.cpp @@ -336,9 +336,8 @@ void checkExpression(UNUSED void *threadarg) { #else if (use_literal_api) { size_t len = strlen(regexp); - err = hs_compile_lit_multi_int(®exp, &flags, nullptr, &extp, - &len, 1, mode, nullptr, &db, - &compile_err, *g_grey); + err = hs_compile_lit_multi(®exp, &flags, nullptr, &len, 1, + mode, nullptr, &db, &compile_err); } else { err = hs_compile_ext_multi(®exp, &flags, nullptr, &extp, 1, mode, nullptr, &db, &compile_err);