Merge pull request #192 from VectorCamp/develop

Merge with master
This commit is contained in:
Konstantinos Margaritis 2023-11-17 21:33:50 +02:00 committed by GitHub
commit 645f2ae34b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
74 changed files with 1269 additions and 1061 deletions

View File

@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8.12) cmake_minimum_required (VERSION 3.18.4)
project (vectorscan C CXX) project (vectorscan C CXX)
@ -7,6 +7,11 @@ set (HS_MINOR_VERSION 4)
set (HS_PATCH_VERSION 10) set (HS_PATCH_VERSION 10)
set (HS_VERSION ${HS_MAJOR_VERSION}.${HS_MINOR_VERSION}.${HS_PATCH_VERSION}) set (HS_VERSION ${HS_MAJOR_VERSION}.${HS_MINOR_VERSION}.${HS_PATCH_VERSION})
string (TIMESTAMP BUILD_DATE "%Y-%m-%d")
message(STATUS "Build date: ${BUILD_DATE}")
# Dependencies check
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
include(CheckCCompilerFlag) include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag) include(CheckCXXCompilerFlag)
@ -19,9 +24,18 @@ INCLUDE (CheckSymbolExists)
include (CMakeDependentOption) include (CMakeDependentOption)
include (GNUInstallDirs) include (GNUInstallDirs)
include (${CMAKE_MODULE_PATH}/platform.cmake) include (${CMAKE_MODULE_PATH}/platform.cmake)
include (${CMAKE_MODULE_PATH}/boost.cmake)
include (${CMAKE_MODULE_PATH}/ragel.cmake) include (${CMAKE_MODULE_PATH}/ragel.cmake)
find_package(PkgConfig QUIET) find_package(PkgConfig REQUIRED)
find_program(RAGEL ragel)
if(${RAGEL} STREQUAL "RAGEL-NOTFOUND")
message(FATAL_ERROR "Ragel state machine compiler not found")
endif()
# Build type check
if (NOT CMAKE_BUILD_TYPE) if (NOT CMAKE_BUILD_TYPE)
message(STATUS "Default build type 'Release with debug info'") message(STATUS "Default build type 'Release with debug info'")
@ -55,220 +69,72 @@ foreach (OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} "${LIBDIR}") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} "${LIBDIR}")
endforeach (OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES) endforeach (OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES)
if(CMAKE_GENERATOR STREQUAL Xcode)
set(XCODE TRUE)
endif()
# older versions of cmake don't know things support isystem
if (XCODE OR CMAKE_CXX_COMPILER_ID MATCHES "Intel")
set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem")
endif ()
set(CMAKE_INCLUDE_CURRENT_DIR 1) set(CMAKE_INCLUDE_CURRENT_DIR 1)
include_directories(${PROJECT_SOURCE_DIR}/src) include_directories(${PROJECT_SOURCE_DIR}/src)
include_directories(${PROJECT_BINARY_DIR}) include_directories(${PROJECT_BINARY_DIR})
include_directories(SYSTEM include) include_directories(SYSTEM include)
include (${CMAKE_MODULE_PATH}/boost.cmake) # Compiler detection
find_package(Python COMPONENTS Interpreter) include (${CMAKE_MODULE_PATH}/compiler.cmake)
find_program(RAGEL ragel)
if(NOT Python_Interpreter_FOUND) # CMake options
message(FATAL_ERROR "No python interpreter found")
if (BUILD_STATIC_AND_SHARED)
message(FATAL_ERROR "This option is no longer supported, please set at least one of BUILD_STATIC_LIBS and BUILD_SHARED_LIBS")
endif() endif()
# allow for reproducible builds - python for portability option(BUILD_SHARED_LIBS "Build shared libs" OFF)
if (DEFINED ENV{SOURCE_DATE_EPOCH}) option(BUILD_STATIC_LIBS "Build static libs" OFF)
execute_process(
COMMAND "${PYTHON}" "${CMAKE_MODULE_PATH}/formatdate.py" "$ENV{SOURCE_DATE_EPOCH}"
OUTPUT_VARIABLE BUILD_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE)
else ()
string (TIMESTAMP BUILD_DATE "%Y-%m-%d")
endif ()
message(STATUS "Build date: ${BUILD_DATE}")
if (BUILD_SHARED_LIBS)
if(${RAGEL} STREQUAL "RAGEL-NOTFOUND") message(STATUS "Building shared libraries")
message(FATAL_ERROR "Ragel state machine compiler not found")
endif() endif()
if (BUILD_STATIC_LIBS)
option(DEBUG_OUTPUT "Enable debug output (warning: very verbose)" FALSE) message(STATUS "Building static libraries")
if(DEBUG_OUTPUT)
add_definitions(-DDEBUG)
set(RELEASE_BUILD FALSE)
endif(DEBUG_OUTPUT)
option(BUILD_SHARED_LIBS "Build shared libs instead of static" OFF)
option(BUILD_STATIC_AND_SHARED "Build shared libs as well as static" OFF)
if (BUILD_STATIC_AND_SHARED OR BUILD_SHARED_LIBS)
message(STATUS "Building shared libraries")
else()
message(STATUS "Building static libraries")
endif() endif()
if (NOT BUILD_SHARED_LIBS) if (NOT BUILD_SHARED_LIBS)
# build static libs # build static libs
set(BUILD_STATIC_LIBS ON) set(BUILD_STATIC_LIBS ON)
mark_as_advanced(BUILD_STATIC_LIBS)
endif () endif ()
CMAKE_DEPENDENT_OPTION(DUMP_SUPPORT "Dump code support; normally on, except in release builds" ON "NOT RELEASE_BUILD" OFF)
CMAKE_DEPENDENT_OPTION(DISABLE_ASSERTS "Disable assert(); Asserts are enabled in debug builds, disabled in release builds" OFF "NOT RELEASE_BUILD" ON)
option(DEBUG_OUTPUT "Enable debug output (warning: very verbose)" OFF)
if(DEBUG_OUTPUT)
add_definitions(-DDEBUG)
set(RELEASE_BUILD FALSE)
endif(DEBUG_OUTPUT)
#for config #for config
if (RELEASE_BUILD) if (RELEASE_BUILD)
set(HS_OPTIMIZE ON) set(HS_OPTIMIZE ON)
add_definitions(-DNDEBUG)
endif() endif()
include (${CMAKE_MODULE_PATH}/sanitize.cmake) # Detect OS and if Fat Runtime is available
include (${CMAKE_MODULE_PATH}/osdetection.cmake)
CMAKE_DEPENDENT_OPTION(DUMP_SUPPORT "Dump code support; normally on, except in release builds" ON "NOT RELEASE_BUILD" OFF)
CMAKE_DEPENDENT_OPTION(DISABLE_ASSERTS "Disable assert(); Asserts are enabled in debug builds, disabled in release builds" OFF "NOT RELEASE_BUILD" ON)
option(BUILD_AVX512 "Experimental: support avx512 in the fat runtime" OFF)
option(BUILD_AVX512VBMI "Experimental: support avx512vbmi in the fat runtime" OFF)
if (BUILD_AVX512VBMI)
set(BUILD_AVX512 ON)
endif ()
# TODO: per platform config files?
# remove CMake's idea of optimisation
foreach (CONFIG ${CMAKE_BUILD_TYPE} ${CMAKE_CONFIGURATION_TYPES})
string(REGEX REPLACE "-O[^ ]*" "" CMAKE_C_FLAGS_${CONFIG} "${CMAKE_C_FLAGS_${CONFIG}}")
string(REGEX REPLACE "-O[^ ]*" "" CMAKE_CXX_FLAGS_${CONFIG} "${CMAKE_CXX_FLAGS_${CONFIG}}")
endforeach ()
if (CMAKE_C_COMPILER_ID MATCHES "Intel")
set(SKYLAKE_FLAG "-xCORE-AVX512")
else ()
set(SKYLAKE_FLAG "-march=skylake-avx512")
set(ICELAKE_FLAG "-march=icelake-server")
endif ()
if(ARCH_PPC64EL)
set(ARCH_FLAG mcpu)
else()
set(ARCH_FLAG march)
endif()
# Detect best GNUCC_ARCH to tune for
if (CMAKE_COMPILER_IS_GNUCC AND NOT CROSS_COMPILE)
message(STATUS "gcc version ${CMAKE_C_COMPILER_VERSION}")
# If gcc doesn't recognise the host cpu, then mtune=native becomes
# generic, which isn't very good in some cases. march=native looks at
# cpuid info and then chooses the best microarch it can (and replaces
# the flag), so use that for tune.
set(TUNE_FLAG "mtune")
set(GNUCC_TUNE "")
message(STATUS "ARCH_FLAG '${ARCH_FLAG}' '${GNUCC_ARCH}', TUNE_FLAG '${TUNE_FLAG}' '${GNUCC_TUNE}' ")
# arg1 might exist if using ccache
string (STRIP "${CMAKE_C_COMPILER_ARG1}" CC_ARG1)
set (EXEC_ARGS ${CC_ARG1} -c -Q --help=target -${ARCH_FLAG}=native -${TUNE_FLAG}=native)
execute_process(COMMAND ${CMAKE_C_COMPILER} ${EXEC_ARGS}
OUTPUT_VARIABLE _GCC_OUTPUT)
set(_GCC_OUTPUT_TUNE ${_GCC_OUTPUT})
string(FIND "${_GCC_OUTPUT}" "${ARCH_FLAG}=" POS)
string(SUBSTRING "${_GCC_OUTPUT}" ${POS} -1 _GCC_OUTPUT)
string(REGEX REPLACE "${ARCH_FLAG}=[ \t]*([^ \n]*)[ \n].*" "\\1" GNUCC_ARCH "${_GCC_OUTPUT}")
string(FIND "${_GCC_OUTPUT_TUNE}" "${TUNE_FLAG}=" POS_TUNE)
string(SUBSTRING "${_GCC_OUTPUT_TUNE}" ${POS_TUNE} -1 _GCC_OUTPUT_TUNE)
string(REGEX REPLACE "${TUNE_FLAG}=[ \t]*([^ \n]*)[ \n].*" "\\1" GNUCC_TUNE "${_GCC_OUTPUT_TUNE}")
string(FIND "${GNUCC_ARCH}" "sve" POS_SVE)
string(FIND "${GNUCC_ARCH}" "sve2" POS_SVE2)
string(FIND "${GNUCC_ARCH}" "sve2-bitperm" POS_SVE2_BITPERM)
if(NOT POS_SVE2_BITPERM EQUAL 0)
set(SVE2_BITPERM_FOUND 1)
set(SVE2_FOUND 1)
set(SVE_FOUND 1)
elseif(NOT POS_SVE2 EQUAL 0)
set(SVE2_FOUND 1)
set(SVE_FOUND 1)
elseif (NOT POS_SVE EQUAL 0)
set(SVE_FOUND 1)
set(SVE2_BITPERM_FOUND 1)
endif()
message(STATUS "ARCH_FLAG '${ARCH_FLAG}' '${GNUCC_ARCH}', TUNE_FLAG '${TUNE_FLAG}' '${GNUCC_TUNE}' ")
# test the parsed flag
set (EXEC_ARGS ${CC_ARG1} -E - -${ARCH_FLAG}=${GNUCC_ARCH} -${TUNE_FLAG}=${GNUCC_TUNE})
execute_process(COMMAND ${CMAKE_C_COMPILER} ${EXEC_ARGS}
OUTPUT_QUIET ERROR_QUIET
INPUT_FILE /dev/null
RESULT_VARIABLE GNUCC_TUNE_TEST)
if (NOT GNUCC_TUNE_TEST EQUAL 0)
message(WARNING "Something went wrong determining gcc tune: -mtune=${GNUCC_TUNE} not valid, falling back to -mtune=native")
set(GNUCC_TUNE native)
else()
set(GNUCC_TUNE ${GNUCC_TUNE})
message(STATUS "gcc will tune for ${GNUCC_ARCH}, ${GNUCC_TUNE}")
endif()
elseif (CMAKE_COMPILER_IS_CLANG AND NOT CROSS_COMPILE)
if (ARCH_IA32 OR ARCH_X86_64)
set(GNUCC_ARCH native)
set(TUNE_FLAG generic)
elseif(ARCH_AARCH64)
set(GNUCC_ARCH armv8)
set(TUNE_FLAG generic)
elseif(ARCH_ARM32)
set(GNUCC_ARCH armv7a)
set(TUNE_FLAG generic)
else()
set(GNUCC_ARCH native)
set(TUNE_FLAG generic)
endif()
message(STATUS "clang will tune for ${GNUCC_ARCH}, ${TUNE_FLAG}")
elseif (CROSS_COMPILE)
set(GNUCC_ARCH generic)
set(TUNE_FLAG generic)
endif()
if (ARCH_IA32 OR ARCH_X86_64) if (ARCH_IA32 OR ARCH_X86_64)
if (NOT FAT_RUNTIME) include (${CMAKE_MODULE_PATH}/cflags-x86.cmake)
if (BUILD_AVX512) set(ARCH_FLAG march)
set(ARCH_C_FLAGS "${SKYLAKE_FLAG}") elseif (ARCH_ARM32 OR ARCH_AARCH64)
set(ARCH_CXX_FLAGS "${SKYLAKE_FLAG}") include (${CMAKE_MODULE_PATH}/cflags-arm.cmake)
elseif (BUILD_AVX2) set(ARCH_FLAG march)
set(ARCH_C_FLAGS "-mavx2") elseif (ARCH_PPC64EL)
set(ARCH_CXX_FLAGS "-mavx2") include (${CMAKE_MODULE_PATH}/cflags-ppc64le.cmake)
else() set(ARCH_FLAG mcpu)
set(ARCH_C_FLAGS "-msse4.2") endif ()
set(ARCH_CXX_FLAGS "-msse4.2")
endif()
else()
set(ARCH_C_FLAGS "-msse4.2")
set(ARCH_CXX_FLAGS "-msse4.2")
endif()
endif()
if (ARCH_AARCH64) # Detect Native arch flags if requested
if (NOT FAT_RUNTIME) include (${CMAKE_MODULE_PATH}/archdetect.cmake)
if (BUILD_SVE2_BITPERM AND NOT SVE2_BITPERM_FOUND)
set(GNUCC_ARCH "${GNUCC_ARCH}+sve2-bitperm")
elseif (BUILD_SVE2 AND NOT SVE2_FOUND)
set(GNUCC_ARCH "${GNUCC_ARCH}+sve2")
elseif (BUILD_SVE AND NOT SVE_FOUND)
set(GNUCC_ARCH "${GNUCC_ARCH}+sve")
endif ()
else()
set(ARCH_C_FLAGS "")
set(ARCH_CXX_FLAGS "")
endif()
endif(ARCH_AARCH64)
message(STATUS "ARCH_C_FLAGS : ${ARCH_C_FLAGS}") # Configure Compiler flags (Generic)
message(STATUS "ARCH_CXX_FLAGS : ${ARCH_CXX_FLAGS}")
include (${CMAKE_MODULE_PATH}/sanitize.cmake)
if (NOT FAT_RUNTIME) if (NOT FAT_RUNTIME)
if (GNUCC_TUNE) if (GNUCC_TUNE)
@ -280,14 +146,14 @@ if (NOT FAT_RUNTIME)
endif() endif()
endif() endif()
# compiler version checks TODO: test more compilers # remove CMake's idea of optimisation
if (CMAKE_COMPILER_IS_GNUCXX) foreach (CONFIG ${CMAKE_BUILD_TYPE} ${CMAKE_CONFIGURATION_TYPES})
set(GNUCXX_MINVER "9") string(REGEX REPLACE "-O[^ ]*" "" CMAKE_C_FLAGS_${CONFIG} "${CMAKE_C_FLAGS_${CONFIG}}")
message(STATUS "g++ version ${CMAKE_CXX_COMPILER_VERSION}") string(REGEX REPLACE "-O[^ ]*" "" CMAKE_CXX_FLAGS_${CONFIG} "${CMAKE_CXX_FLAGS_${CONFIG}}")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS GNUCXX_MINVER) endforeach ()
message(FATAL_ERROR "A minimum of g++ ${GNUCXX_MINVER} is required for C++17 support")
endif() message(STATUS "ARCH_C_FLAGS : ${ARCH_C_FLAGS}")
endif() message(STATUS "ARCH_CXX_FLAGS : ${ARCH_CXX_FLAGS}")
if(RELEASE_BUILD) if(RELEASE_BUILD)
if (NOT CMAKE_BUILD_TYPE MATCHES MINSIZEREL) if (NOT CMAKE_BUILD_TYPE MATCHES MINSIZEREL)
@ -302,256 +168,13 @@ else()
set(OPT_CXX_FLAG "-O0") set(OPT_CXX_FLAG "-O0")
endif(RELEASE_BUILD) endif(RELEASE_BUILD)
# set compiler flags - more are tested and added later include (${CMAKE_MODULE_PATH}/cflags-generic.cmake)
set(EXTRA_C_FLAGS "${OPT_C_FLAG} -std=c17 -Wall -Wextra -Wshadow -Wcast-qual -fno-strict-aliasing")
set(EXTRA_CXX_FLAGS "${OPT_CXX_FLAG} -std=c++17 -Wall -Wextra -Wshadow -Wswitch -Wreturn-type -Wcast-qual -Wno-deprecated -Wnon-virtual-dtor -fno-strict-aliasing")
if (NOT CMAKE_COMPILER_IS_CLANG)
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -fno-new-ttp-matching")
endif()
if (NOT RELEASE_BUILD)
# -Werror is most useful during development, don't potentially break
# release builds
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Werror")
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Werror")
if (CMAKE_COMPILER_IS_CLANG)
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER "13.0")
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-unused-but-set-variable")
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-unused-but-set-variable")
endif()
endif()
endif()
if (DISABLE_ASSERTS)
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -DNDEBUG")
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -DNDEBUG")
endif()
if(CMAKE_COMPILER_IS_GNUCC)
# spurious warnings?
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-array-bounds -Wno-maybe-uninitialized")
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-maybe-uninitialized")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -fabi-version=0")
endif ()
# don't complain about abi
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-abi")
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-abi")
endif()
if (NOT(ARCH_IA32 AND RELEASE_BUILD))
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -fno-omit-frame-pointer")
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -fno-omit-frame-pointer")
endif()
CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H)
if (ARCH_IA32 OR ARCH_X86_64)
CHECK_INCLUDE_FILES(intrin.h HAVE_C_INTRIN_H)
CHECK_INCLUDE_FILE_CXX(intrin.h HAVE_CXX_INTRIN_H)
CHECK_INCLUDE_FILES(x86intrin.h HAVE_C_X86INTRIN_H)
CHECK_INCLUDE_FILE_CXX(x86intrin.h HAVE_CXX_X86INTRIN_H)
elseif (ARCH_ARM32 OR ARCH_AARCH64)
CHECK_INCLUDE_FILE_CXX(arm_neon.h HAVE_C_ARM_NEON_H)
if (BUILD_SVE OR BUILD_SVE2 OR BUILD_SVE2_BITPERM)
set(CMAKE_REQUIRED_FLAGS ${ARCH_CXX_FLAGS})
CHECK_INCLUDE_FILE_CXX(arm_sve.h HAVE_C_ARM_SVE_H)
if (NOT HAVE_C_ARM_SVE_H)
message(FATAL_ERROR "arm_sve.h is required to build for SVE.")
endif()
endif()
elseif (ARCH_PPC64EL)
CHECK_INCLUDE_FILE_CXX(altivec.h HAVE_C_PPC64EL_ALTIVEC_H)
endif()
CHECK_FUNCTION_EXISTS(posix_memalign HAVE_POSIX_MEMALIGN)
CHECK_FUNCTION_EXISTS(_aligned_malloc HAVE__ALIGNED_MALLOC)
# these end up in the config file
CHECK_C_COMPILER_FLAG(-fvisibility=hidden HAS_C_HIDDEN)
CHECK_CXX_COMPILER_FLAG(-fvisibility=hidden HAS_CXX_HIDDEN)
# are we using libc++
CHECK_CXX_SYMBOL_EXISTS(_LIBCPP_VERSION ciso646 HAVE_LIBCPP)
if (RELEASE_BUILD)
if (HAS_C_HIDDEN)
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -fvisibility=hidden")
endif()
if (HAS_CXX_HIDDEN)
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -fvisibility=hidden")
endif()
endif()
option(FAT_RUNTIME "Build a library that supports multiple microarchitectures" ON)
if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND FAT_RUNTIME MATCHES "ON")
message("Fat Runtime for ${GNUCC_ARCH}")
# This is a Linux-only feature for now - requires platform support
# elsewhere
message(STATUS "generator is ${CMAKE_GENERATOR}")
if (CMAKE_C_COMPILER_IS_CLANG AND CMAKE_C_COMPILER_VERSION VERSION_LESS "3.9")
message (STATUS "Clang v3.9 or higher required for fat runtime, cannot build fat runtime")
set (FAT_RUNTIME_REQUISITES FALSE)
elseif (NOT (CMAKE_GENERATOR MATCHES "Unix Makefiles" OR
(CMAKE_VERSION VERSION_GREATER "3.0" AND CMAKE_GENERATOR MATCHES "Ninja")))
message (STATUS "Building the fat runtime requires the Unix Makefiles generator, or Ninja with CMake v3.0 or higher")
set (FAT_RUNTIME_REQUISITES FALSE)
else()
include (${CMAKE_MODULE_PATH}/attrib.cmake)
if (NOT HAS_C_ATTR_IFUNC)
message(STATUS "Compiler does not support ifunc attribute, cannot build fat runtime")
set (FAT_RUNTIME_REQUISITES FALSE)
else ()
set (FAT_RUNTIME_REQUISITES TRUE)
endif()
endif()
if (NOT FAT_RUNTIME_REQUISITES OR NOT RELEASE_BUILD)
set (FAT_RUNTIME OFF)
endif()
endif ()
include (${CMAKE_MODULE_PATH}/arch.cmake)
# testing a builtin takes a little more work
CHECK_C_SOURCE_COMPILES("void *aa_test(void *x) { return __builtin_assume_aligned(x, 16);}\nint main(void) { return 0; }" HAVE_CC_BUILTIN_ASSUME_ALIGNED)
CHECK_CXX_SOURCE_COMPILES("void *aa_test(void *x) { return __builtin_assume_aligned(x, 16);}\nint main(void) { return 0; }" HAVE_CXX_BUILTIN_ASSUME_ALIGNED)
# Clang does not use __builtin_constant_p() the same way as gcc
if (NOT CMAKE_COMPILER_IS_CLANG)
CHECK_C_SOURCE_COMPILES("int main(void) { __builtin_constant_p(0); }" HAVE__BUILTIN_CONSTANT_P)
endif()
set(C_FLAGS_TO_CHECK
# Variable length arrays are way bad, most especially at run time
"-Wvla"
# Pointer arith on void pointers is doing it wrong.
"-Wpointer-arith"
# Build our C code with -Wstrict-prototypes -Wmissing-prototypes
"-Wstrict-prototypes"
"-Wmissing-prototypes"
)
foreach (FLAG ${C_FLAGS_TO_CHECK})
# munge the name so it doesn't break things
string(REPLACE "-" "_" FNAME C_FLAG${FLAG})
CHECK_C_COMPILER_FLAG("${FLAG}" ${FNAME})
if (${FNAME})
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} ${FLAG}")
endif()
endforeach()
set(CXX_FLAGS_TO_CHECK
"-Wvla"
"-Wpointer-arith"
)
foreach (FLAG ${CXX_FLAGS_TO_CHECK})
string(REPLACE "-" "_" FNAME CXX_FLAG${FLAG})
CHECK_CXX_COMPILER_FLAG("${FLAG}" ${FNAME})
if (${FNAME})
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} ${FLAG}")
endif()
endforeach()
# self-assign should be thrown away, but clang whinges
CHECK_C_COMPILER_FLAG("-Wself-assign" CC_SELF_ASSIGN)
if (CC_SELF_ASSIGN)
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-self-assign")
endif()
CHECK_CXX_COMPILER_FLAG("-Wself-assign" CXX_SELF_ASSIGN)
if (CXX_SELF_ASSIGN)
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-self-assign")
endif()
# clang gets up in our face for going paren crazy with macros
CHECK_C_COMPILER_FLAG("-Wparentheses-equality" CC_PAREN_EQUALITY)
if (CC_PAREN_EQUALITY)
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-parentheses-equality")
endif()
# clang complains about unused const vars in our Ragel-generated code.
CHECK_CXX_COMPILER_FLAG("-Wunused-const-variable" CXX_UNUSED_CONST_VAR)
if (CXX_UNUSED_CONST_VAR)
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-unused-const-variable")
endif()
# clang-14 complains about unused-but-set variable.
CHECK_CXX_COMPILER_FLAG("-Wunused-but-set-variable" CXX_UNUSED_BUT_SET_VAR)
if (CXX_UNUSED_BUT_SET_VAR)
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-unused-but-set-variable")
endif()
# clang-14 complains about using bitwise operator instead of logical ones.
CHECK_CXX_COMPILER_FLAG("-Wbitwise-instead-of-logical" CXX_BITWISE_INSTEAD_OF_LOGICAL)
if (CXX_BITWISE_INSTEAD_OF_LOGICAL)
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-bitwise-instead-of-logical")
endif()
# gcc 6 complains about type attributes that get ignored, like alignment
CHECK_CXX_COMPILER_FLAG("-Wignored-attributes" CXX_IGNORED_ATTR)
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)
if (CXX_WEAK_VTABLES)
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wweak-vtables")
endif()
CHECK_CXX_COMPILER_FLAG("-Wmissing-declarations" CXX_MISSING_DECLARATIONS)
if (CXX_MISSING_DECLARATIONS)
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wmissing-declarations")
endif()
CHECK_CXX_COMPILER_FLAG("-Wunused-local-typedefs" CXX_UNUSED_LOCAL_TYPEDEFS)
# gcc5 complains about this
CHECK_CXX_COMPILER_FLAG("-Wunused-variable" CXX_WUNUSED_VARIABLE)
# gcc 10 complains about this
CHECK_C_COMPILER_FLAG("-Wstringop-overflow" CC_STRINGOP_OVERFLOW)
CHECK_CXX_COMPILER_FLAG("-Wstringop-overflow" CXX_STRINGOP_OVERFLOW)
if(CC_STRINGOP_OVERFLOW OR CXX_STRINGOP_OVERFLOW)
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-stringop-overflow")
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-stringop-overflow")
endif()
include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(LINUX TRUE)
endif(CMAKE_SYSTEM_NAME MATCHES "Linux")
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
set(FREEBSD true)
endif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
if (FAT_RUNTIME)
if (NOT (ARCH_IA32 OR ARCH_X86_64 OR ARCH_AARCH64))
message(FATAL_ERROR "Fat runtime is only supported on Intel and Aarch64 architectures")
else()
message(STATUS "Building runtime for multiple microarchitectures")
endif()
else()
if (CROSS_COMPILE)
message(STATUS "Building for target CPU: ${ARCH_C_FLAGS}")
else()
message(STATUS "Building for current host CPU: ${ARCH_C_FLAGS}")
endif()
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARCH_C_FLAGS}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARCH_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARCH_CXX_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARCH_CXX_FLAGS}")
add_subdirectory(doc/dev-reference)
# PCRE check, we have a fixed requirement for PCRE to use Chimera # PCRE check, we have a fixed requirement for PCRE to use Chimera
# and hscollider # and hscollider
set(PCRE_REQUIRED_MAJOR_VERSION 8) set(PCRE_REQUIRED_MAJOR_VERSION 8)
@ -567,19 +190,26 @@ if (CORRECT_PCRE_VERSION AND PCRE_BUILD_SOURCE AND BUILD_STATIC_LIBS)
set(BUILD_CHIMERA TRUE) set(BUILD_CHIMERA TRUE)
endif() endif()
add_subdirectory(unit) set(RAGEL_C_FLAGS "-Wno-unused -funsigned-char")
if (EXISTS ${CMAKE_SOURCE_DIR}/tools/CMakeLists.txt)
add_subdirectory(tools) set_source_files_properties(
endif() src/parser/Parser.cpp
if (EXISTS ${CMAKE_SOURCE_DIR}/chimera/CMakeLists.txt AND BUILD_CHIMERA) PROPERTIES
add_subdirectory(chimera) COMPILE_FLAGS "${RAGEL_C_FLAGS}")
endif()
ragelmaker(src/parser/Parser.rl)
set_source_files_properties(
src/parser/control_verbs.cpp
PROPERTIES
COMPILE_FLAGS "${RAGEL_C_FLAGS}")
ragelmaker(src/parser/control_verbs.rl)
# do substitutions # do substitutions
configure_file(${CMAKE_MODULE_PATH}/config.h.in ${PROJECT_BINARY_DIR}/config.h) configure_file(${CMAKE_MODULE_PATH}/config.h.in ${PROJECT_BINARY_DIR}/config.h)
configure_file(src/hs_version.h.in ${PROJECT_BINARY_DIR}/hs_version.h) configure_file(src/hs_version.h.in ${PROJECT_BINARY_DIR}/hs_version.h)
configure_file(libhs.pc.in libhs.pc @ONLY) # only replace @ quoted vars configure_file(libhs.pc.in libhs.pc @ONLY) # only replace @ quoted vars
install(FILES ${CMAKE_BINARY_DIR}/libhs.pc install(FILES ${CMAKE_BINARY_DIR}/libhs.pc
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
@ -593,24 +223,6 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXX_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXX_FLAGS}")
endif() endif()
set(RAGEL_C_FLAGS "-Wno-unused -funsigned-char")
set_source_files_properties(
${CMAKE_BINARY_DIR}/src/parser/Parser.cpp
PROPERTIES
COMPILE_FLAGS "${RAGEL_C_FLAGS}")
ragelmaker(src/parser/Parser.rl)
set_source_files_properties(
${CMAKE_BINARY_DIR}/src/parser/control_verbs.cpp
PROPERTIES
COMPILE_FLAGS "${RAGEL_C_FLAGS}")
ragelmaker(src/parser/control_verbs.rl)
add_subdirectory(util)
SET(hs_HEADERS SET(hs_HEADERS
src/hs.h src/hs.h
src/hs_common.h src/hs_common.h
@ -631,11 +243,15 @@ set (hs_exec_common_SRCS
${hs_exec_common_SRCS} ${hs_exec_common_SRCS}
src/util/arch/x86/cpuid_flags.c src/util/arch/x86/cpuid_flags.c
) )
elseif (ARCH_ARM32 OR ARCH_AARCH64 OR ARCH_PPC64EL) elseif (ARCH_ARM32 OR ARCH_AARCH64)
set (hs_exec_common_SRCS set (hs_exec_common_SRCS
${hs_exec_common_SRCS} ${hs_exec_common_SRCS}
src/util/arch/arm/cpuid_flags.c src/util/arch/arm/cpuid_flags.c
) )
elseif (ARCH_PPC64EL)
set (hs_exec_common_SRCS
${hs_exec_common_SRCS}
src/util/arch/ppc64el/cpuid_flags.c)
endif () endif ()
set (hs_exec_SRCS set (hs_exec_SRCS
@ -780,10 +396,10 @@ set (hs_exec_SRCS
src/database.h src/database.h
) )
if (NOT RELEASE_BUILD OR FAT_RUNTIME)
if (ARCH_IA32 OR ARCH_X86_64) if (ARCH_IA32 OR ARCH_X86_64)
set (hs_exec_SRCS set (hs_exec_SRCS
${hs_exec_SRCS} ${hs_exec_SRCS}
src/nfa/vermicelli_simd.cpp
src/util/supervector/arch/x86/impl.cpp) src/util/supervector/arch/x86/impl.cpp)
elseif (ARCH_ARM32 OR ARCH_AARCH64) elseif (ARCH_ARM32 OR ARCH_AARCH64)
set (hs_exec_SRCS set (hs_exec_SRCS
@ -792,21 +408,24 @@ set (hs_exec_SRCS
elseif (ARCH_PPC64EL) elseif (ARCH_PPC64EL)
set (hs_exec_SRCS set (hs_exec_SRCS
${hs_exec_SRCS} ${hs_exec_SRCS}
src/nfa/vermicelli_simd.cpp
src/util/supervector/arch/ppc64el/impl.cpp) src/util/supervector/arch/ppc64el/impl.cpp)
endif ()
endif() endif()
if (FAT_RUNTIME OR (NOT FAT_RUNTIME AND NOT BUILD_SVE2)) if (ARCH_IA32 OR ARCH_X86_64)
set (hs_exec_SRCS set (hs_exec_avx2_SRCS
${hs_exec_SRCS} src/fdr/teddy_avx2.c
src/nfa/vermicelli_simd.cpp) src/util/arch/x86/masked_move.c
src/util/arch/x86/masked_move.h
)
endif() endif()
set (hs_exec_avx2_SRCS if (ARCH_ARM32 OR ARCH_AARCH64)
src/fdr/teddy_avx2.c set (hs_exec_neon_SRCS
src/util/arch/x86/masked_move.c src/nfa/vermicelli_simd.cpp)
src/util/arch/x86/masked_move.h set (hs_exec_sve_SRCS
) src/nfa/vermicelli_simd.cpp)
endif()
SET (hs_compile_SRCS SET (hs_compile_SRCS
${hs_HEADERS} ${hs_HEADERS}
@ -1252,11 +871,20 @@ set (LIB_VERSION ${HS_VERSION})
set (LIB_SOVERSION ${HS_MAJOR_VERSION}) set (LIB_SOVERSION ${HS_MAJOR_VERSION})
if (NOT FAT_RUNTIME) if (NOT FAT_RUNTIME)
set(hs_exec_SRCS ${hs_exec_SRCS} ${hs_exec_common_SRCS}) set(hs_exec_SRCS ${hs_exec_SRCS} ${hs_exec_common_SRCS})
if (BUILD_AVX2) if (ARCH_IA32 OR ARCH_X86_64)
set(hs_exec_SRCS ${hs_exec_SRCS} ${hs_exec_avx2_SRCS}) if (BUILD_AVX2)
set(hs_exec_SRCS ${hs_exec_SRCS} ${hs_exec_avx2_SRCS})
endif()
elseif (ARCH_AARCH64)
if (BUILD_SVE2)
set(hs_exec_SRCS ${hs_exec_SRCS} ${hs_exec_sve2_SRCS})
elseif (BUILD_SVE)
set(hs_exec_SRCS ${hs_exec_SRCS} ${hs_exec_sve_SRCS})
else()
set(hs_exec_SRCS ${hs_exec_SRCS} ${hs_exec_neon_SRCS})
endif()
endif() endif()
if (BUILD_STATIC_LIBS) if (BUILD_STATIC_LIBS)
@ -1273,7 +901,7 @@ if (NOT FAT_RUNTIME)
$<TARGET_OBJECTS:hs_compile>) $<TARGET_OBJECTS:hs_compile>)
endif (BUILD_STATIC_LIBS) endif (BUILD_STATIC_LIBS)
if (BUILD_STATIC_AND_SHARED OR BUILD_SHARED_LIBS) if (BUILD_SHARED_LIBS)
add_library(hs_exec_shared OBJECT ${hs_exec_SRCS}) add_library(hs_exec_shared OBJECT ${hs_exec_SRCS})
set_target_properties(hs_exec_shared PROPERTIES POSITION_INDEPENDENT_CODE TRUE) set_target_properties(hs_exec_shared PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
add_library(hs_compile_shared OBJECT ${hs_compile_SRCS}) add_library(hs_compile_shared OBJECT ${hs_compile_SRCS})
@ -1352,7 +980,7 @@ else ()
${RUNTIME_LIBS}) ${RUNTIME_LIBS})
endif (BUILD_STATIC_LIBS) endif (BUILD_STATIC_LIBS)
if (BUILD_STATIC_AND_SHARED OR BUILD_SHARED_LIBS) if (BUILD_SHARED_LIBS)
# build shared libs # build shared libs
add_library(hs_compile_shared OBJECT ${hs_compile_SRCS}) add_library(hs_compile_shared OBJECT ${hs_compile_SRCS})
set_target_properties(hs_compile_shared PROPERTIES POSITION_INDEPENDENT_CODE TRUE) set_target_properties(hs_compile_shared PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
@ -1411,29 +1039,25 @@ else ()
if (ARCH_AARCH64) if (ARCH_AARCH64)
set(BUILD_WRAPPER "${PROJECT_SOURCE_DIR}/cmake/build_wrapper.sh") set(BUILD_WRAPPER "${PROJECT_SOURCE_DIR}/cmake/build_wrapper.sh")
if (BUILD_STATIC_LIBS) if (BUILD_STATIC_LIBS)
add_library(hs_exec_neon OBJECT ${hs_exec_SRCS}) add_library(hs_exec_neon OBJECT ${hs_exec_SRCS} ${hs_exec_neon_SRCS})
list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_neon>) list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_neon>)
set_target_properties(hs_exec_neon PROPERTIES set_target_properties(hs_exec_neon PROPERTIES
COMPILE_FLAGS "-march=armv8-a" COMPILE_FLAGS "-march=${ARMV8_ARCH}"
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} neon ${CMAKE_MODULE_PATH}/keep.syms.in" RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} neon ${CMAKE_MODULE_PATH}/keep.syms.in"
) )
if (BUILD_SVE) add_library(hs_exec_sve OBJECT ${hs_exec_SRCS} ${hs_exec_sve_SRCS})
add_library(hs_exec_sve OBJECT ${hs_exec_SRCS} ${hs_exec_sve_SRCS}) list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_sve>)
list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_sve>) set_target_properties(hs_exec_sve PROPERTIES
set_target_properties(hs_exec_sve PROPERTIES COMPILE_FLAGS "-march=${SVE_ARCH}"
COMPILE_FLAGS "-march=armv8-a+sve" RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} sve ${CMAKE_MODULE_PATH}/keep.syms.in"
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} sve ${CMAKE_MODULE_PATH}/keep.syms.in" )
) add_library(hs_exec_sve2 OBJECT ${hs_exec_SRCS} ${hs_exec_sve2_SRCS})
endif (BUILD_SVE) list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_sve2>)
if (BUILD_SVE2) set_target_properties(hs_exec_sve2 PROPERTIES
add_library(hs_exec_sve2 OBJECT ${hs_exec_SRCS} ${hs_exec_sve2_SRCS}) COMPILE_FLAGS "-march=${SVE2_BITPERM_ARCH}"
list(APPEND RUNTIME_LIBS $<TARGET_OBJECTS:hs_exec_sve2>) RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} sve2 ${CMAKE_MODULE_PATH}/keep.syms.in"
set_target_properties(hs_exec_sve2 PROPERTIES )
COMPILE_FLAGS "-march=armv8-a+sve2"
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} sve2 ${CMAKE_MODULE_PATH}/keep.syms.in"
)
endif (BUILD_SVE2)
add_library(hs_exec_common OBJECT add_library(hs_exec_common OBJECT
${hs_exec_common_SRCS} ${hs_exec_common_SRCS}
@ -1456,36 +1080,32 @@ else ()
${RUNTIME_LIBS}) ${RUNTIME_LIBS})
endif (BUILD_STATIC_LIBS) endif (BUILD_STATIC_LIBS)
if (BUILD_STATIC_AND_SHARED OR BUILD_SHARED_LIBS) if (BUILD_SHARED_LIBS)
# build shared libs # build shared libs
add_library(hs_compile_shared OBJECT ${hs_compile_SRCS}) add_library(hs_compile_shared OBJECT ${hs_compile_SRCS})
set_target_properties(hs_compile_shared PROPERTIES POSITION_INDEPENDENT_CODE TRUE) set_target_properties(hs_compile_shared PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
add_library(hs_exec_shared_neon OBJECT ${hs_exec_SRCS}) add_library(hs_exec_shared_neon OBJECT ${hs_exec_SRCS} ${hs_exec_neon_SRCS})
list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_neon>) list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_neon>)
set_target_properties(hs_exec_shared_neon PROPERTIES set_target_properties(hs_exec_shared_neon PROPERTIES
COMPILE_FLAGS "-march=armv8-a" COMPILE_FLAGS "-march=${ARMV8_ARCH}"
POSITION_INDEPENDENT_CODE TRUE POSITION_INDEPENDENT_CODE TRUE
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} neon ${CMAKE_MODULE_PATH}/keep.syms.in" RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} neon ${CMAKE_MODULE_PATH}/keep.syms.in"
) )
if (BUILD_SVE) add_library(hs_exec_shared_sve OBJECT ${hs_exec_SRCS} ${hs_exec_sve_SRCS})
add_library(hs_exec_shared_sve OBJECT ${hs_exec_SRCS} ${hs_exec_sve_SRCS}) list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_sve>)
list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_sve>) set_target_properties(hs_exec_shared_sve PROPERTIES
set_target_properties(hs_exec_shared_sve PROPERTIES COMPILE_FLAGS "-march=${SVE_ARCH}"
COMPILE_FLAGS "-march=armv8-a+sve" POSITION_INDEPENDENT_CODE TRUE
POSITION_INDEPENDENT_CODE TRUE RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} sve ${CMAKE_MODULE_PATH}/keep.syms.in"
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} sve ${CMAKE_MODULE_PATH}/keep.syms.in" )
) add_library(hs_exec_shared_sve2 OBJECT ${hs_exec_SRCS} ${hs_exec_sve2_SRCS})
endif (BUILD_SVE) list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_sve2>)
if (BUILD_SVE2) set_target_properties(hs_exec_shared_sve2 PROPERTIES
add_library(hs_exec_shared_sve2 OBJECT ${hs_exec_SRCS} ${hs_exec_sve2_SRCS}) COMPILE_FLAGS "-march=${SVE2_BITPERM_ARCH}"
list(APPEND RUNTIME_SHLIBS $<TARGET_OBJECTS:hs_exec_shared_sve2>) POSITION_INDEPENDENT_CODE TRUE
set_target_properties(hs_exec_shared_sve2 PROPERTIES RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} sve2 ${CMAKE_MODULE_PATH}/keep.syms.in"
COMPILE_FLAGS "-march=armv8-a+sve2" )
POSITION_INDEPENDENT_CODE TRUE
RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} sve2 ${CMAKE_MODULE_PATH}/keep.syms.in"
)
endif (BUILD_SVE2)
add_library(hs_exec_common_shared OBJECT add_library(hs_exec_common_shared OBJECT
${hs_exec_common_SRCS} ${hs_exec_common_SRCS}
src/dispatcher.c src/dispatcher.c
@ -1501,7 +1121,7 @@ if (NOT BUILD_SHARED_LIBS)
install(TARGETS hs_runtime DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(TARGETS hs_runtime DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif() endif()
if (BUILD_STATIC_AND_SHARED OR BUILD_SHARED_LIBS) if (BUILD_SHARED_LIBS)
if (NOT FAT_RUNTIME) if (NOT FAT_RUNTIME)
add_library(hs_runtime_shared SHARED src/hs_version.c add_library(hs_runtime_shared SHARED src/hs_version.c
src/hs_valid_platform.c $<TARGET_OBJECTS:hs_exec_shared> src/hs_valid_platform.c $<TARGET_OBJECTS:hs_exec_shared>
@ -1533,19 +1153,12 @@ if (NOT BUILD_SHARED_LIBS)
install(TARGETS hs DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(TARGETS hs DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif() endif()
if (BUILD_STATIC_AND_SHARED OR BUILD_SHARED_LIBS) if (BUILD_SHARED_LIBS)
set(hs_shared_SRCS set(hs_shared_SRCS
src/hs_version.c src/hs_version.c
src/hs_valid_platform.c src/hs_valid_platform.c
$<TARGET_OBJECTS:hs_compile_shared>) $<TARGET_OBJECTS:hs_compile_shared>)
if (XCODE)
# force this lib to use C++ linkage
add_custom_command(OUTPUT empty.cxx
COMMAND ${CMAKE_COMMAND} -E touch empty.cxx)
set (hs_shared_SRCS ${hs_shared_SRCS} empty.cxx)
endif (XCODE)
if (NOT FAT_RUNTIME) if (NOT FAT_RUNTIME)
set(hs_shared_SRCS set(hs_shared_SRCS
${hs_shared_SRCS} ${hs_shared_SRCS}
@ -1578,6 +1191,16 @@ if (NOT BUILD_STATIC_LIBS)
add_library(hs ALIAS hs_shared) add_library(hs ALIAS hs_shared)
endif () endif ()
add_subdirectory(util)
add_subdirectory(unit)
if (EXISTS ${CMAKE_SOURCE_DIR}/tools/CMakeLists.txt)
add_subdirectory(tools)
endif()
if (EXISTS ${CMAKE_SOURCE_DIR}/chimera/CMakeLists.txt AND BUILD_CHIMERA)
add_subdirectory(chimera)
endif()
option(BUILD_EXAMPLES "Build Hyperscan example code (default TRUE)" TRUE) option(BUILD_EXAMPLES "Build Hyperscan example code (default TRUE)" TRUE)
if(BUILD_EXAMPLES) if(BUILD_EXAMPLES)
add_subdirectory(examples) add_subdirectory(examples)
@ -1587,3 +1210,5 @@ option(BUILD_BENCHMARKS "Build benchmarks (default TRUE)" TRUE)
if(BUILD_BENCHMARKS) if(BUILD_BENCHMARKS)
add_subdirectory(benchmarks) add_subdirectory(benchmarks)
endif() endif()
add_subdirectory(doc/dev-reference)

View File

@ -29,22 +29,6 @@ matching of regular expressions across streams of data.
Vectorscan is typically used in a DPI library stack, just like Hyperscan. Vectorscan is typically used in a DPI library stack, just like Hyperscan.
# Cross Compiling for AArch64
- To cross compile for AArch64, first adjust the variables set in cmake/setenv-arm64-cross.sh.
- `export CROSS=<arm-cross-compiler-dir>/bin/aarch64-linux-gnu-`
- `export CROSS_SYS=<arm-cross-compiler-system-dir>`
- `export BOOST_PATH=<boost-source-dir>`
- Set the environment variables:
- `source cmake/setenv-arm64-cross.sh`
- Configure Vectorscan:
- `mkdir <build-dir-name>`
- `cd <build-dir>`
- `cmake -DCROSS_COMPILE_AARCH64=1 <hyperscan-source-dir> -DCMAKE_TOOLCHAIN_FILE=<hyperscan-source-dir>/cmake/arm64-cross.cmake`
- Build Vectorscan:
- `make -jT` where T is the number of threads used to compile.
- `cmake --build . -- -j T` can also be used instead of make.
# Compiling for SVE # Compiling for SVE
The following cmake variables can be set in order to target Arm's Scalable The following cmake variables can be set in order to target Arm's Scalable

View File

@ -1,207 +0,0 @@
# detect architecture features
#
# must be called after determining where compiler intrinsics are defined
if (HAVE_C_X86INTRIN_H)
set (INTRIN_INC_H "x86intrin.h")
elseif (HAVE_C_INTRIN_H)
set (INTRIN_INC_H "intrin.h")
elseif (HAVE_C_ARM_NEON_H)
set (INTRIN_INC_H "arm_neon.h")
elseif (HAVE_C_PPC64EL_ALTIVEC_H)
set (INTRIN_INC_H "altivec.h")
set (FAT_RUNTIME OFF)
else()
message (FATAL_ERROR "No intrinsics header found")
endif ()
if (ARCH_ARM32 OR ARCH_AARCH64)
CHECK_C_SOURCE_COMPILES("#include <${INTRIN_INC_H}>
int main() {
int32x4_t a = vdupq_n_s32(1);
(void)a;
}" HAVE_NEON)
endif ()
if (ARCH_AARCH64)
if (APPLE)
set (FAT_RUNTIME OFF)
endif()
set(PREV_FLAGS "${CMAKE_C_FLAGS}")
if (BUILD_SVE2_BITPERM)
set(CMAKE_C_FLAGS "-march=${GNUCC_ARCH} ${CMAKE_C_FLAGS}")
CHECK_C_SOURCE_COMPILES("#include <arm_sve.h>
int main() {
svuint8_t a = svbext(svdup_u8(1), svdup_u8(2));
(void)a;
}" HAVE_SVE2_BITPERM)
if (HAVE_SVE2_BITPERM)
add_definitions(-DHAVE_SVE2_BITPERM)
endif ()
endif()
if (BUILD_SVE2)
set(CMAKE_C_FLAGS "-march=${GNUCC_ARCH} ${CMAKE_C_FLAGS}")
CHECK_C_SOURCE_COMPILES("#include <arm_sve.h>
int main() {
svuint8_t a = svbsl(svdup_u8(1), svdup_u8(2), svdup_u8(3));
(void)a;
}" HAVE_SVE2)
endif()
if (HAVE_SVE2 OR HAVE_SVE2_BITPERM)
add_definitions(-DHAVE_SVE2)
endif ()
if (BUILD_SVE)
set(CMAKE_C_FLAGS "-march=${GNUCC_ARCH} ${CMAKE_C_FLAGS}")
CHECK_C_SOURCE_COMPILES("#include <arm_sve.h>
int main() {
svuint8_t a = svdup_u8(1);
(void)a;
}" HAVE_SVE)
endif ()
if (HAVE_SVE OR HAVE_SVE2 OR HAVE_SVE2_BITPERM)
add_definitions(-DHAVE_SVE)
endif ()
set(CMAKE_C_FLAGS "${PREV_FLAGS}")
endif()
if (BUILD_AVX512)
CHECK_C_COMPILER_FLAG(${SKYLAKE_FLAG} HAS_ARCH_SKYLAKE)
if (NOT HAS_ARCH_SKYLAKE)
message (FATAL_ERROR "AVX512 not supported by compiler")
endif ()
endif ()
if (BUILD_AVX512VBMI)
CHECK_C_COMPILER_FLAG(${ICELAKE_FLAG} HAS_ARCH_ICELAKE)
if (NOT HAS_ARCH_ICELAKE)
message (FATAL_ERROR "AVX512VBMI not supported by compiler")
endif ()
endif ()
if (FAT_RUNTIME)
if (ARCH_IA32 OR ARCH_X86_64)
if (NOT DEFINED(BUILD_AVX2))
set(BUILD_AVX2 TRUE)
endif ()
# test the highest level microarch to make sure everything works
if (BUILD_AVX512)
if (BUILD_AVX512VBMI)
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${ICELAKE_FLAG}")
else ()
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${SKYLAKE_FLAG}")
endif (BUILD_AVX512VBMI)
elseif (BUILD_AVX2)
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} -march=core-avx2 -mavx2")
elseif ()
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} -march=core-i7 -mssse3")
endif ()
elseif(ARCH_AARCH64)
if (NOT DEFINED(BUILD_SVE))
set(BUILD_SVE TRUE)
endif ()
if (NOT DEFINED(BUILD_SVE2))
set(BUILD_SVE2 TRUE)
endif ()
endif()
else (NOT FAT_RUNTIME)
# if not fat runtime, then test given cflags
set (CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_C_FLAGS} ${ARCH_C_FLAGS}")
endif ()
if (ARCH_IA32 OR ARCH_X86_64)
# ensure we have the minimum of SSE4.2 - call a SSE4.2 intrinsic
CHECK_C_SOURCE_COMPILES("#include <${INTRIN_INC_H}>
int main() {
__m128i a = _mm_set1_epi8(1);
(void)_mm_shuffle_epi8(a, a);
}" HAVE_SSE42)
# now look for AVX2
CHECK_C_SOURCE_COMPILES("#include <${INTRIN_INC_H}>
#if !defined(__AVX2__)
#error no avx2
#endif
int main(){
__m256i z = _mm256_setzero_si256();
(void)_mm256_xor_si256(z, z);
}" HAVE_AVX2)
# and now for AVX512
CHECK_C_SOURCE_COMPILES("#include <${INTRIN_INC_H}>
#if !defined(__AVX512BW__)
#error no avx512bw
#endif
int main(){
__m512i z = _mm512_setzero_si512();
(void)_mm512_abs_epi8(z);
}" HAVE_AVX512)
# and now for AVX512VBMI
CHECK_C_SOURCE_COMPILES("#include <${INTRIN_INC_H}>
#if !defined(__AVX512VBMI__)
#error no avx512vbmi
#endif
int main(){
__m512i a = _mm512_set1_epi8(0xFF);
__m512i idx = _mm512_set_epi64(3ULL, 2ULL, 1ULL, 0ULL, 7ULL, 6ULL, 5ULL, 4ULL);
(void)_mm512_permutexvar_epi8(idx, a);
}" HAVE_AVX512VBMI)
elseif (ARCH_ARM32 OR ARCH_AARCH64)
CHECK_C_SOURCE_COMPILES("#include <${INTRIN_INC_H}>
int main() {
int32x4_t a = vdupq_n_s32(1);
(void)a;
}" HAVE_NEON)
elseif (ARCH_PPC64EL)
CHECK_C_SOURCE_COMPILES("#include <${INTRIN_INC_H}>
int main() {
vector int a = vec_splat_s32(1);
(void)a;
}" HAVE_VSX)
else ()
message (FATAL_ERROR "Unsupported architecture")
endif ()
if (FAT_RUNTIME)
if ((ARCH_IA32 OR ARCH_X86_64) AND NOT HAVE_SSE42)
message(FATAL_ERROR "SSE4.2 support required to build fat runtime")
endif ()
if ((ARCH_IA32 OR ARCH_X86_64) AND BUILD_AVX2 AND NOT HAVE_AVX2)
message(FATAL_ERROR "AVX2 support required to build fat runtime")
endif ()
if ((ARCH_IA32 OR ARCH_X86_64) AND BUILD_AVX512 AND NOT HAVE_AVX512)
message(FATAL_ERROR "AVX512 support requested but not supported")
endif ()
if ((ARCH_IA32 OR ARCH_X86_64) AND BUILD_AVX512VBMI AND NOT HAVE_AVX512VBMI)
message(FATAL_ERROR "AVX512VBMI support requested but not supported")
endif ()
else (NOT FAT_RUNTIME)
if ((ARCH_IA32 OR ARCH_X86_64) AND NOT BUILD_AVX2)
message(STATUS "Building without AVX2 support")
endif ()
if ((ARCH_IA32 OR ARCH_X86_64) AND NOT HAVE_AVX512)
message(STATUS "Building without AVX512 support")
endif ()
if ((ARCH_IA32 OR ARCH_X86_64) AND NOT HAVE_AVX512VBMI)
message(STATUS "Building without AVX512VBMI support")
endif ()
if ((ARCH_IA32 OR ARCH_X86_64) AND NOT HAVE_SSE42)
message(FATAL_ERROR "A minimum of SSE4.2 compiler support is required")
endif ()
if ((ARCH_ARM32 OR ARCH_AARCH64) AND NOT HAVE_NEON)
message(FATAL_ERROR "NEON support required for ARM support")
endif ()
if (ARCH_PPPC64EL AND NOT HAVE_VSX)
message(FATAL_ERROR "VSX support required for Power support")
endif ()
endif ()
unset (PREV_FLAGS)
unset (CMAKE_REQUIRED_FLAGS)
unset (INTRIN_INC_H)

91
cmake/archdetect.cmake Normal file
View File

@ -0,0 +1,91 @@
if (USE_CPU_NATIVE)
# Detect best GNUCC_ARCH to tune for
if (CMAKE_COMPILER_IS_GNUCC)
message(STATUS "gcc version ${CMAKE_C_COMPILER_VERSION}")
# If gcc doesn't recognise the host cpu, then mtune=native becomes
# generic, which isn't very good in some cases. march=native looks at
# cpuid info and then chooses the best microarch it can (and replaces
# the flag), so use that for tune.
set(TUNE_FLAG "mtune")
set(GNUCC_TUNE "")
message(STATUS "ARCH_FLAG '${ARCH_FLAG}' '${GNUCC_ARCH}', TUNE_FLAG '${TUNE_FLAG}' '${GNUCC_TUNE}' ")
# arg1 might exist if using ccache
string (STRIP "${CMAKE_C_COMPILER_ARG1}" CC_ARG1)
set (EXEC_ARGS ${CC_ARG1} -c -Q --help=target -${ARCH_FLAG}=native -${TUNE_FLAG}=native)
execute_process(COMMAND ${CMAKE_C_COMPILER} ${EXEC_ARGS}
OUTPUT_VARIABLE _GCC_OUTPUT)
set(_GCC_OUTPUT_TUNE ${_GCC_OUTPUT})
string(FIND "${_GCC_OUTPUT}" "${ARCH_FLAG}=" POS)
string(SUBSTRING "${_GCC_OUTPUT}" ${POS} -1 _GCC_OUTPUT)
string(REGEX REPLACE "${ARCH_FLAG}=[ \t]*([^ \n]*)[ \n].*" "\\1" GNUCC_ARCH "${_GCC_OUTPUT}")
string(FIND "${_GCC_OUTPUT_TUNE}" "${TUNE_FLAG}=" POS_TUNE)
string(SUBSTRING "${_GCC_OUTPUT_TUNE}" ${POS_TUNE} -1 _GCC_OUTPUT_TUNE)
string(REGEX REPLACE "${TUNE_FLAG}=[ \t]*([^ \n]*)[ \n].*" "\\1" GNUCC_TUNE "${_GCC_OUTPUT_TUNE}")
message(STATUS "ARCH_FLAG '${ARCH_FLAG}' '${GNUCC_ARCH}', TUNE_FLAG '${TUNE_FLAG}' '${GNUCC_TUNE}' ")
# test the parsed flag
set (EXEC_ARGS ${CC_ARG1} -E - -${ARCH_FLAG}=${GNUCC_ARCH} -${TUNE_FLAG}=${GNUCC_TUNE})
execute_process(COMMAND ${CMAKE_C_COMPILER} ${EXEC_ARGS}
OUTPUT_QUIET ERROR_QUIET
INPUT_FILE /dev/null
RESULT_VARIABLE GNUCC_TUNE_TEST)
if (NOT GNUCC_TUNE_TEST EQUAL 0)
message(WARNING "Something went wrong determining gcc tune: -mtune=${GNUCC_TUNE} not valid, falling back to -mtune=native")
set(GNUCC_TUNE native)
else()
set(GNUCC_TUNE ${GNUCC_TUNE})
message(STATUS "gcc will tune for ${GNUCC_ARCH}, ${GNUCC_TUNE}")
endif()
elseif (CMAKE_COMPILER_IS_CLANG)
if (ARCH_IA32 OR ARCH_X86_64)
set(GNUCC_ARCH x86_64_v2)
set(TUNE_FLAG generic)
elseif(ARCH_AARCH64)
if (BUILD_SVE2_BITPERM)
set(GNUCC_ARCH ${SVE2_BITPERM_ARCH})
elseif (BUILD_SVE2)
set(GNUCC_ARCH ${SVE2_ARCH})
elseif (BUILD_SVE)
set(GNUCC_ARCH ${SVE_ARCH})
else ()
set(GNUCC_ARCH ${ARMV8_ARCH})
endif()
set(TUNE_FLAG generic)
elseif(ARCH_ARM32)
set(GNUCC_ARCH armv7a)
set(TUNE_FLAG generic)
else()
set(GNUCC_ARCH native)
set(TUNE_FLAG generic)
endif()
message(STATUS "clang will tune for ${GNUCC_ARCH}, ${TUNE_FLAG}")
endif()
else()
if (ARCH_IA32 OR ARCH_X86_64)
set(GNUCC_ARCH native)
set(TUNE_FLAG generic)
elseif(ARCH_AARCH64)
if (BUILD_SVE2_BITPERM)
set(GNUCC_ARCH ${SVE2_BITPERM_ARCH})
elseif (BUILD_SVE2)
set(GNUCC_ARCH ${SVE2_ARCH})
elseif (BUILD_SVE)
set(GNUCC_ARCH ${SVE_ARCH})
else ()
set(GNUCC_ARCH ${ARMV8_ARCH})
endif()
set(TUNE_FLAG generic)
elseif(ARCH_ARM32)
set(GNUCC_ARCH armv7a)
set(TUNE_FLAG generic)
else()
set(GNUCC_ARCH power9)
set(TUNE_FLAG power9)
endif()
endif()

93
cmake/cflags-arm.cmake Normal file
View File

@ -0,0 +1,93 @@
if (NOT FAT_RUNTIME)
if (BUILD_SVE2_BITPERM)
message (STATUS "SVE2_BITPERM implies SVE2, enabling BUILD_SVE2")
set(BUILD_SVE2 ON)
endif ()
if (BUILD_SVE2)
message (STATUS "SVE2 implies SVE, enabling BUILD_SVE")
set(BUILD_SVE ON)
endif ()
endif ()
if (CMAKE_COMPILER_IS_GNUCXX)
set(ARMV9BASE_MINVER "12")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS ARMV9BASE_MINVER)
set(SVE2_ARCH "armv8-a+sve2")
else()
set(SVE2_ARCH "armv9-a")
endif()
else()
set(SVE2_ARCH "armv9-a")
endif()
set(ARMV8_ARCH "armv8-a")
set(SVE_ARCH "${ARMV8_ARCH}+sve")
set(SVE2_BITPERM_ARCH "${SVE2_ARCH}+sve2-bitperm")
CHECK_INCLUDE_FILE_CXX(arm_neon.h HAVE_C_ARM_NEON_H)
if (BUILD_SVE OR BUILD_SVE2 OR BUILD_SVE2_BITPERM OR FAT_RUNTIME)
set(CMAKE_REQUIRED_FLAGS "-march=${SVE_ARCH}")
CHECK_INCLUDE_FILE_CXX(arm_sve.h HAVE_C_ARM_SVE_H)
if (NOT HAVE_C_ARM_SVE_H)
message(FATAL_ERROR "arm_sve.h is required to build for SVE.")
endif()
endif()
CHECK_C_SOURCE_COMPILES("#include <arm_neon.h>
int main() {
int32x4_t a = vdupq_n_s32(1);
(void)a;
}" HAVE_NEON)
if (BUILD_SVE2_BITPERM)
set(CMAKE_REQUIRED_FLAGS "-march=${SVE2_BITPERM_ARCH}")
CHECK_C_SOURCE_COMPILES("#include <arm_sve.h>
int main() {
svuint8_t a = svbext(svdup_u8(1), svdup_u8(2));
(void)a;
}" HAVE_SVE2_BITPERM)
endif()
if (BUILD_SVE2)
set(CMAKE_REQUIRED_FLAGS "-march=${SVE2_ARCH}")
CHECK_C_SOURCE_COMPILES("#include <arm_sve.h>
int main() {
svuint8_t a = svbsl(svdup_u8(1), svdup_u8(2), svdup_u8(3));
(void)a;
}" HAVE_SVE2)
endif()
if (BUILD_SVE)
set(CMAKE_REQUIRED_FLAGS "-march=${SVE_ARCH}")
CHECK_C_SOURCE_COMPILES("#include <arm_sve.h>
int main() {
svuint8_t a = svdup_u8(1);
(void)a;
}" HAVE_SVE)
endif ()
if (FAT_RUNTIME)
if (NOT HAVE_NEON)
message(FATAL_ERROR "NEON support required to build fat runtime")
endif ()
if (BUILD_SVE AND NOT HAVE_SVE)
message(FATAL_ERROR "SVE support required to build fat runtime")
endif ()
if (BUILD_SVE2 AND NOT HAVE_SVE2)
message(FATAL_ERROR "SVE2 support required to build fat runtime")
endif ()
if (BUILD_SVE2_BITPERM AND NOT HAVE_SVE2_BITPERM)
message(FATAL_ERROR "SVE2 support required to build fat runtime")
endif ()
else (NOT FAT_RUNTIME)
if (NOT BUILD_SVE)
message(STATUS "Building without SVE support")
endif ()
if (NOT BUILD_SVE2)
message(STATUS "Building without SVE2 support")
endif ()
if (NOT HAVE_NEON)
message(FATAL_ERROR "Neon/ASIMD support required for Arm support")
endif ()
endif ()

164
cmake/cflags-generic.cmake Normal file
View File

@ -0,0 +1,164 @@
# set compiler flags - more are tested and added later
set(EXTRA_C_FLAGS "${OPT_C_FLAG} -std=c17 -Wall -Wextra -Wshadow -Wcast-qual -fno-strict-aliasing")
set(EXTRA_CXX_FLAGS "${OPT_CXX_FLAG} -std=c++17 -Wall -Wextra -Wshadow -Wswitch -Wreturn-type -Wcast-qual -Wno-deprecated -Wnon-virtual-dtor -fno-strict-aliasing")
if (NOT CMAKE_COMPILER_IS_CLANG)
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -fno-new-ttp-matching")
endif()
if (NOT RELEASE_BUILD)
# -Werror is most useful during development, don't potentially break
# release builds
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Werror")
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Werror")
if (CMAKE_COMPILER_IS_CLANG)
if (CMAKE_C_COMPILER_VERSION VERSION_GREATER "13.0")
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-unused-but-set-variable")
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-unused-but-set-variable")
endif()
endif()
endif()
if (DISABLE_ASSERTS)
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -DNDEBUG")
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -DNDEBUG")
endif()
if(CMAKE_COMPILER_IS_GNUCC)
# spurious warnings?
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-array-bounds -Wno-maybe-uninitialized")
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-maybe-uninitialized")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -fabi-version=0")
endif ()
# don't complain about abi
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-abi")
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-abi")
endif()
if (NOT(ARCH_IA32 AND RELEASE_BUILD))
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -fno-omit-frame-pointer")
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -fno-omit-frame-pointer")
endif()
CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H)
CHECK_FUNCTION_EXISTS(posix_memalign HAVE_POSIX_MEMALIGN)
CHECK_FUNCTION_EXISTS(_aligned_malloc HAVE__ALIGNED_MALLOC)
# these end up in the config file
CHECK_C_COMPILER_FLAG(-fvisibility=hidden HAS_C_HIDDEN)
CHECK_CXX_COMPILER_FLAG(-fvisibility=hidden HAS_CXX_HIDDEN)
# are we using libc++
CHECK_CXX_SYMBOL_EXISTS(_LIBCPP_VERSION ciso646 HAVE_LIBCPP)
if (RELEASE_BUILD)
if (HAS_C_HIDDEN)
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -fvisibility=hidden")
endif()
if (HAS_CXX_HIDDEN)
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -fvisibility=hidden")
endif()
endif()
# testing a builtin takes a little more work
CHECK_C_SOURCE_COMPILES("void *aa_test(void *x) { return __builtin_assume_aligned(x, 16);}\nint main(void) { return 0; }" HAVE_CC_BUILTIN_ASSUME_ALIGNED)
CHECK_CXX_SOURCE_COMPILES("void *aa_test(void *x) { return __builtin_assume_aligned(x, 16);}\nint main(void) { return 0; }" HAVE_CXX_BUILTIN_ASSUME_ALIGNED)
# Clang does not use __builtin_constant_p() the same way as gcc
if (NOT CMAKE_COMPILER_IS_CLANG)
CHECK_C_SOURCE_COMPILES("int main(void) { __builtin_constant_p(0); }" HAVE__BUILTIN_CONSTANT_P)
endif()
set(C_FLAGS_TO_CHECK
# Variable length arrays are way bad, most especially at run time
"-Wvla"
# Pointer arith on void pointers is doing it wrong.
"-Wpointer-arith"
# Build our C code with -Wstrict-prototypes -Wmissing-prototypes
"-Wstrict-prototypes"
"-Wmissing-prototypes"
)
foreach (FLAG ${C_FLAGS_TO_CHECK})
# munge the name so it doesn't break things
string(REPLACE "-" "_" FNAME C_FLAG${FLAG})
CHECK_C_COMPILER_FLAG("${FLAG}" ${FNAME})
if (${FNAME})
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} ${FLAG}")
endif()
endforeach()
# self-assign should be thrown away, but clang whinges
CHECK_C_COMPILER_FLAG("-Wself-assign" CC_SELF_ASSIGN)
if (CC_SELF_ASSIGN)
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-self-assign")
endif()
CHECK_CXX_COMPILER_FLAG("-Wself-assign" CXX_SELF_ASSIGN)
if (CXX_SELF_ASSIGN)
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-self-assign")
endif()
# clang gets up in our face for going paren crazy with macros
CHECK_C_COMPILER_FLAG("-Wparentheses-equality" CC_PAREN_EQUALITY)
if (CC_PAREN_EQUALITY)
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-parentheses-equality")
endif()
# clang complains about unused const vars in our Ragel-generated code.
CHECK_CXX_COMPILER_FLAG("-Wunused-const-variable" CXX_UNUSED_CONST_VAR)
if (CXX_UNUSED_CONST_VAR)
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-unused-const-variable")
endif()
# clang-14 complains about unused-but-set variable.
CHECK_CXX_COMPILER_FLAG("-Wunused-but-set-variable" CXX_UNUSED_BUT_SET_VAR)
if (CXX_UNUSED_BUT_SET_VAR)
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-unused-but-set-variable")
endif()
# clang-14 complains about using bitwise operator instead of logical ones.
CHECK_CXX_COMPILER_FLAG("-Wbitwise-instead-of-logical" CXX_BITWISE_INSTEAD_OF_LOGICAL)
if (CXX_BITWISE_INSTEAD_OF_LOGICAL)
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-bitwise-instead-of-logical")
endif()
# clang-14 complains about using bitwise operator instead of logical ones.
CHECK_CXX_COMPILER_FLAG("-Wbitwise-instead-of-logical" CXX_BITWISE_INSTEAD_OF_LOGICAL)
if (CXX_BITWISE_INSTEAD_OF_LOGICAL)
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-bitwise-instead-of-logical")
endif()
CHECK_CXX_COMPILER_FLAG("-Wignored-attributes" CXX_IGNORED_ATTR)
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)
if (CXX_WEAK_VTABLES)
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wweak-vtables")
endif()
CHECK_CXX_COMPILER_FLAG("-Wmissing-declarations" CXX_MISSING_DECLARATIONS)
if (CXX_MISSING_DECLARATIONS)
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wmissing-declarations")
endif()
CHECK_CXX_COMPILER_FLAG("-Wunused-local-typedefs" CXX_UNUSED_LOCAL_TYPEDEFS)
CHECK_CXX_COMPILER_FLAG("-Wunused-variable" CXX_WUNUSED_VARIABLE)
# gcc 10 complains about this
CHECK_C_COMPILER_FLAG("-Wstringop-overflow" CC_STRINGOP_OVERFLOW)
CHECK_CXX_COMPILER_FLAG("-Wstringop-overflow" CXX_STRINGOP_OVERFLOW)
if(CC_STRINGOP_OVERFLOW OR CXX_STRINGOP_OVERFLOW)
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wno-stringop-overflow")
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-stringop-overflow")
endif()

View File

@ -0,0 +1,18 @@
CHECK_INCLUDE_FILE_CXX(altivec.h HAVE_C_PPC64EL_ALTIVEC_H)
if (HAVE_C_PPC64EL_ALTIVEC_H)
set (INTRIN_INC_H "altivec.h")
else()
message (FATAL_ERROR "No intrinsics header found for VSX")
endif ()
CHECK_C_SOURCE_COMPILES("#include <${INTRIN_INC_H}>
int main() {
vector int a = vec_splat_s32(1);
(void)a;
}" HAVE_VSX)
if (NOT HAVE_VSX)
message(FATAL_ERROR "VSX support required for Power support")
endif ()

133
cmake/cflags-x86.cmake Normal file
View File

@ -0,0 +1,133 @@
option(BUILD_AVX512 "Enabling support for AVX512" OFF)
option(BUILD_AVX512VBMI "Enabling support for AVX512VBMI" OFF)
set(SKYLAKE_FLAG "-march=skylake-avx512")
set(ICELAKE_FLAG "-march=icelake-server")
if (NOT FAT_RUNTIME)
if (BUILD_AVX512VBMI)
message (STATUS "AVX512VBMI implies AVX512, enabling BUILD_AVX512")
set(BUILD_AVX512 ON)
set(ARCH_C_FLAGS "${ICELAKE_FLAG}")
set(ARCH_CXX_FLAGS "${ICELAKE_FLAG}")
endif ()
if (BUILD_AVX512)
message (STATUS "AVX512 implies AVX2, enabling BUILD_AVX2")
set(BUILD_AVX2 ON)
set(ARCH_C_FLAGS "${SKYLAKE_FLAG}")
set(ARCH_CXX_FLAGS "${SKYLAKE_FLAG}")
endif ()
if (BUILD_AVX2)
message (STATUS "Enabling BUILD_AVX2")
set(ARCH_C_FLAGS "-mavx2")
set(ARCH_CXX_FLAGS "-mavx2")
else()
set(ARCH_C_FLAGS "-msse4.2")
set(ARCH_CXX_FLAGS "-msse4.2")
endif()
else()
set(ARCH_C_FLAGS "-msse4.2")
set(ARCH_CXX_FLAGS "-msse4.2")
endif()
set(CMAKE_REQUIRED_FLAGS "${ARCH_C_FLAGS}")
CHECK_INCLUDE_FILES(intrin.h HAVE_C_INTRIN_H)
CHECK_INCLUDE_FILE_CXX(intrin.h HAVE_CXX_INTRIN_H)
CHECK_INCLUDE_FILES(x86intrin.h HAVE_C_X86INTRIN_H)
CHECK_INCLUDE_FILE_CXX(x86intrin.h HAVE_CXX_X86INTRIN_H)
if (HAVE_C_X86INTRIN_H)
set (INTRIN_INC_H "x86intrin.h")
elseif (HAVE_C_INTRIN_H)
set (INTRIN_INC_H "intrin.h")
else()
message (FATAL_ERROR "No intrinsics header found for SSE/AVX2/AVX512")
endif ()
if (BUILD_AVX512)
CHECK_C_COMPILER_FLAG(${SKYLAKE_FLAG} HAS_ARCH_SKYLAKE)
if (NOT HAS_ARCH_SKYLAKE)
message (FATAL_ERROR "AVX512 not supported by compiler")
endif ()
endif ()
if (BUILD_AVX512VBMI)
CHECK_C_COMPILER_FLAG(${ICELAKE_FLAG} HAS_ARCH_ICELAKE)
if (NOT HAS_ARCH_ICELAKE)
message (FATAL_ERROR "AVX512VBMI not supported by compiler")
endif ()
endif ()
# ensure we have the minimum of SSE4.2 - call a SSE4.2 intrinsic
CHECK_C_SOURCE_COMPILES("#include <${INTRIN_INC_H}>
int main() {
__m128i a = _mm_set1_epi8(1);
(void)_mm_shuffle_epi8(a, a);
}" HAVE_SSE42)
# now look for AVX2
set(CMAKE_REQUIRED_FLAGS "-mavx2")
CHECK_C_SOURCE_COMPILES("#include <${INTRIN_INC_H}>
#if !defined(__AVX2__)
#error no avx2
#endif
int main(){
__m256i z = _mm256_setzero_si256();
(void)_mm256_xor_si256(z, z);
}" HAVE_AVX2)
# and now for AVX512
set(CMAKE_REQUIRED_FLAGS "${SKYLAKE_FLAG}")
CHECK_C_SOURCE_COMPILES("#include <${INTRIN_INC_H}>
#if !defined(__AVX512BW__)
#error no avx512bw
#endif
int main(){
__m512i z = _mm512_setzero_si512();
(void)_mm512_abs_epi8(z);
}" HAVE_AVX512)
# and now for AVX512VBMI
set(CMAKE_REQUIRED_FLAGS "${ICELAKE_FLAG}")
CHECK_C_SOURCE_COMPILES("#include <${INTRIN_INC_H}>
#if !defined(__AVX512VBMI__)
#error no avx512vbmi
#endif
int main(){
__m512i a = _mm512_set1_epi8(0xFF);
__m512i idx = _mm512_set_epi64(3ULL, 2ULL, 1ULL, 0ULL, 7ULL, 6ULL, 5ULL, 4ULL);
(void)_mm512_permutexvar_epi8(idx, a);
}" HAVE_AVX512VBMI)
if (FAT_RUNTIME)
if (NOT HAVE_SSE42)
message(FATAL_ERROR "SSE4.2 support required to build fat runtime")
endif ()
if (BUILD_AVX2 AND NOT HAVE_AVX2)
message(FATAL_ERROR "AVX2 support required to build fat runtime")
endif ()
if (BUILD_AVX512 AND NOT HAVE_AVX512)
message(FATAL_ERROR "AVX512 support requested but not supported")
endif ()
if (BUILD_AVX512VBMI AND NOT HAVE_AVX512VBMI)
message(FATAL_ERROR "AVX512VBMI support requested but not supported")
endif ()
else (NOT FAT_RUNTIME)
if (NOT BUILD_AVX2)
message(STATUS "Building without AVX2 support")
endif ()
if (NOT HAVE_AVX512)
message(STATUS "Building without AVX512 support")
endif ()
if (NOT HAVE_AVX512VBMI)
message(STATUS "Building without AVX512VBMI support")
endif ()
if (NOT HAVE_SSE42)
message(FATAL_ERROR "A minimum of SSE4.2 compiler support is required")
endif ()
endif ()

19
cmake/compiler.cmake Normal file
View File

@ -0,0 +1,19 @@
# determine compiler
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_COMPILER_IS_CLANG TRUE)
set(CLANGCXX_MINVER "5")
message(STATUS "clang++ version ${CMAKE_CXX_COMPILER_VERSION}")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS CLANGCXX_MINVER)
message(FATAL_ERROR "A minimum of clang++ ${CLANGCXX_MINVER} is required for C++17 support")
endif()
endif()
# compiler version checks TODO: test more compilers
if (CMAKE_COMPILER_IS_GNUCXX)
set(GNUCXX_MINVER "9")
message(STATUS "g++ version ${CMAKE_CXX_COMPILER_VERSION}")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS GNUCXX_MINVER)
message(FATAL_ERROR "A minimum of g++ ${GNUCXX_MINVER} is required for C++17 support")
endif()
endif()

36
cmake/osdetection.cmake Normal file
View File

@ -0,0 +1,36 @@
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(LINUX TRUE)
endif(CMAKE_SYSTEM_NAME MATCHES "Linux")
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
set(FREEBSD true)
endif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
option(FAT_RUNTIME "Build a library that supports multiple microarchitectures" OFF)
message("Checking Fat Runtime Requirements...")
if (FAT_RUNTIME AND NOT LINUX)
message(FATAL_ERROR "Fat runtime is only supported on Linux OS")
endif()
if (FAT_RUNTIME AND LINUX)
if (NOT (ARCH_IA32 OR ARCH_X86_64 OR ARCH_AARCH64))
message(FATAL_ERROR "Fat runtime is only supported on Intel and Aarch64 architectures")
else()
message(STATUS "Building Fat runtime for multiple microarchitectures")
message(STATUS "generator is ${CMAKE_GENERATOR}")
if (NOT (CMAKE_GENERATOR MATCHES "Unix Makefiles" OR
(CMAKE_VERSION VERSION_GREATER "3.0" AND CMAKE_GENERATOR MATCHES "Ninja")))
message (FATAL_ERROR "Building the fat runtime requires the Unix Makefiles generator, or Ninja with CMake v3.0 or higher")
else()
include (${CMAKE_MODULE_PATH}/attrib.cmake)
if (NOT HAS_C_ATTR_IFUNC)
message(FATAL_ERROR "Compiler does not support ifunc attribute, cannot build fat runtime")
endif()
endif()
endif()
if (NOT RELEASE_BUILD)
message(FATAL_ERROR "Fat runtime is only built on Release builds")
endif()
endif ()

View File

@ -1,24 +1,12 @@
# determine compiler
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_COMPILER_IS_CLANG TRUE)
endif()
# determine the target arch # determine the target arch
# really only interested in the preprocessor here
if (CROSS_COMPILE_AARCH64) CHECK_C_SOURCE_COMPILES("#if !(defined(__x86_64__) || defined(_M_X64))\n#error not 64bit\n#endif\nint main(void) { return 0; }" ARCH_X86_64)
set(ARCH_AARCH64 TRUE) CHECK_C_SOURCE_COMPILES("#if !(defined(__i386__) || defined(_M_IX86))\n#error not 32bit\n#endif\nint main(void) { return 0; }" ARCH_IA32)
CHECK_C_SOURCE_COMPILES("#if !defined(__ARM_ARCH_ISA_A64)\n#error not 64bit\n#endif\nint main(void) { return 0; }" ARCH_AARCH64)
CHECK_C_SOURCE_COMPILES("#if !defined(__ARM_ARCH_ISA_ARM)\n#error not 32bit\n#endif\nint main(void) { return 0; }" ARCH_ARM32)
CHECK_C_SOURCE_COMPILES("#if !defined(__PPC64__) && !(defined(__LITTLE_ENDIAN__) && defined(__VSX__))\n#error not ppc64el\n#endif\nint main(void) { return 0; }" ARCH_PPC64EL)
if (ARCH_X86_64 OR ARCH_AARCH64 OR ARCH_PPC64EL)
set(ARCH_64_BIT TRUE) set(ARCH_64_BIT TRUE)
message(STATUS "Cross compiling for aarch64")
else() else()
# really only interested in the preprocessor here set(ARCH_32_BIT TRUE)
CHECK_C_SOURCE_COMPILES("#if !(defined(__x86_64__) || defined(_M_X64))\n#error not 64bit\n#endif\nint main(void) { return 0; }" ARCH_X86_64)
CHECK_C_SOURCE_COMPILES("#if !(defined(__i386__) || defined(_M_IX86))\n#error not 32bit\n#endif\nint main(void) { return 0; }" ARCH_IA32)
CHECK_C_SOURCE_COMPILES("#if !defined(__ARM_ARCH_ISA_A64)\n#error not 64bit\n#endif\nint main(void) { return 0; }" ARCH_AARCH64)
CHECK_C_SOURCE_COMPILES("#if !defined(__ARM_ARCH_ISA_ARM)\n#error not 32bit\n#endif\nint main(void) { return 0; }" ARCH_ARM32)
CHECK_C_SOURCE_COMPILES("#if !defined(__PPC64__) && !(defined(__LITTLE_ENDIAN__) && defined(__VSX__))\n#error not ppc64el\n#endif\nint main(void) { return 0; }" ARCH_PPC64EL)
if (ARCH_X86_64 OR ARCH_AARCH64 OR ARCH_PPC64EL)
set(ARCH_64_BIT TRUE)
else()
set(ARCH_32_BIT TRUE)
endif()
endif() endif()

View File

@ -11,28 +11,14 @@ find_package(PkgConfig QUIET)
pkg_check_modules(SQLITE3 sqlite3) pkg_check_modules(SQLITE3 sqlite3)
endif() endif()
if (NOT SQLITE3_FOUND)
message(STATUS "looking for sqlite3 in source tree")
# look in the source tree
if (EXISTS "${PROJECT_SOURCE_DIR}/sqlite3/sqlite3.h" AND
EXISTS "${PROJECT_SOURCE_DIR}/sqlite3/sqlite3.c")
message(STATUS " found sqlite3 in source tree")
set(SQLITE3_FOUND TRUE)
set(SQLITE3_BUILD_SOURCE TRUE)
set(SQLITE3_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/sqlite3")
set(SQLITE3_LDFLAGS sqlite3_static)
else()
message(STATUS " no sqlite3 in source tree")
endif()
endif()
# now do version checks # now do version checks
if (SQLITE3_FOUND) if (SQLITE3_FOUND)
list(INSERT CMAKE_REQUIRED_INCLUDES 0 "${SQLITE3_INCLUDE_DIRS}") list(INSERT CMAKE_REQUIRED_INCLUDES 0 "${SQLITE3_INCLUDE_DIRS}")
CHECK_C_SOURCE_COMPILES("#include <sqlite3.h>\n#if SQLITE_VERSION_NUMBER >= 3008007 && SQLITE_VERSION_NUMBER < 3008010\n#error broken sqlite\n#endif\nint main() {return 0;}" SQLITE_VERSION_OK) if (SQLITE_VERSION LESS "3.8.10")
if (NOT SQLITE_VERSION_OK)
message(FATAL_ERROR "sqlite3 is broken from 3.8.7 to 3.8.10 - please find a working version") message(FATAL_ERROR "sqlite3 is broken from 3.8.7 to 3.8.10 - please find a working version")
endif() endif()
endif()
if (NOT SQLITE3_BUILD_SOURCE) if (NOT SQLITE3_BUILD_SOURCE)
set(_SAVED_FLAGS ${CMAKE_REQUIRED_FLAGS}) set(_SAVED_FLAGS ${CMAKE_REQUIRED_FLAGS})
list(INSERT CMAKE_REQUIRED_LIBRARIES 0 ${SQLITE3_LDFLAGS}) list(INSERT CMAKE_REQUIRED_LIBRARIES 0 ${SQLITE3_LDFLAGS})
@ -46,6 +32,5 @@ else()
set_target_properties(sqlite3_static PROPERTIES COMPILE_FLAGS "-Wno-error -Wno-extra -Wno-unused -Wno-cast-qual -DSQLITE_OMIT_LOAD_EXTENSION") set_target_properties(sqlite3_static PROPERTIES COMPILE_FLAGS "-Wno-error -Wno-extra -Wno-unused -Wno-cast-qual -DSQLITE_OMIT_LOAD_EXTENSION")
endif() endif()
endif() endif()
endif()
# that's enough about sqlite # that's enough about sqlite

View File

@ -117,6 +117,11 @@
RTYPE NAME(__VA_ARGS__) __attribute__((ifunc("resolve_" #NAME))) RTYPE NAME(__VA_ARGS__) __attribute__((ifunc("resolve_" #NAME)))
#endif #endif
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
CREATE_DISPATCH(hs_error_t, hs_scan, const hs_database_t *db, const char *data, CREATE_DISPATCH(hs_error_t, hs_scan, const hs_database_t *db, const char *data,
unsigned length, unsigned flags, hs_scratch_t *scratch, unsigned length, unsigned flags, hs_scratch_t *scratch,
match_event_handler onEvent, void *userCtx); match_event_handler onEvent, void *userCtx);
@ -185,3 +190,6 @@ CREATE_DISPATCH(hs_error_t, hs_reset_and_expand_stream, hs_stream_t *to_stream,
/** INTERNALS **/ /** INTERNALS **/
CREATE_DISPATCH(u32, Crc32c_ComputeBuf, u32 inCrc32, const void *buf, size_t bufLen); CREATE_DISPATCH(u32, Crc32c_ComputeBuf, u32 inCrc32, const void *buf, size_t bufLen);
#pragma GCC diagnostic pop
#pragma GCC diagnostic pop

View File

@ -98,7 +98,7 @@ public:
const FDREngineDescription &eng_in, const FDREngineDescription &eng_in,
bool make_small_in, const Grey &grey_in) bool make_small_in, const Grey &grey_in)
: eng(eng_in), grey(grey_in), tab(eng_in.getTabSizeBytes()), : eng(eng_in), grey(grey_in), tab(eng_in.getTabSizeBytes()),
lits(move(lits_in)), bucketToLits(move(bucketToLits_in)), lits(std::move(lits_in)), bucketToLits(std::move(bucketToLits_in)),
make_small(make_small_in) {} make_small(make_small_in) {}
bytecode_ptr<FDR> build(); bytecode_ptr<FDR> build();
@ -504,7 +504,7 @@ map<BucketIndex, vector<LiteralIndex>> assignStringsToBuckets(
map<BucketIndex, vector<LiteralIndex>> bucketToLits; map<BucketIndex, vector<LiteralIndex>> bucketToLits;
size_t bucketCnt = buckets.size(); size_t bucketCnt = buckets.size();
for (size_t i = 0; i < bucketCnt; i++) { for (size_t i = 0; i < bucketCnt; i++) {
bucketToLits.emplace(bucketCnt - i - 1, move(buckets[i])); bucketToLits.emplace(bucketCnt - i - 1, std::move(buckets[i]));
} }
return bucketToLits; return bucketToLits;
@ -867,7 +867,7 @@ unique_ptr<HWLMProto> fdrBuildProtoInternal(u8 engType,
auto bucketToLits = assignStringsToBuckets(lits, *des); auto bucketToLits = assignStringsToBuckets(lits, *des);
addIncludedInfo(lits, des->getNumBuckets(), bucketToLits); addIncludedInfo(lits, des->getNumBuckets(), bucketToLits);
auto proto = auto proto =
std::make_unique<HWLMProto>(engType, move(des), lits, bucketToLits, std::make_unique<HWLMProto>(engType, std::move(des), lits, bucketToLits,
make_small); make_small);
return proto; return proto;
} }

View File

@ -309,7 +309,7 @@ setupFullConfs(const vector<hwlmLiteral> &lits,
DEBUG_PRINTF("b %d sz %zu\n", b, vl.size()); DEBUG_PRINTF("b %d sz %zu\n", b, vl.size());
auto fc = getFDRConfirm(vl, make_small); auto fc = getFDRConfirm(vl, make_small);
totalConfirmSize += fc.size(); totalConfirmSize += fc.size();
bc2Conf.emplace(b, move(fc)); bc2Conf.emplace(b, std::move(fc));
} }
} }

View File

@ -88,7 +88,7 @@ public:
const TeddyEngineDescription &eng_in, bool make_small_in, const TeddyEngineDescription &eng_in, bool make_small_in,
const Grey &grey_in) const Grey &grey_in)
: eng(eng_in), grey(grey_in), lits(lits_in), : eng(eng_in), grey(grey_in), lits(lits_in),
bucketToLits(move(bucketToLits_in)), make_small(make_small_in) {} bucketToLits(std::move(bucketToLits_in)), make_small(make_small_in) {}
bytecode_ptr<FDR> build(); bytecode_ptr<FDR> build();
}; };
@ -676,7 +676,7 @@ unique_ptr<HWLMProto> teddyBuildProtoHinted(
return nullptr; return nullptr;
} }
return std::make_unique<HWLMProto>(engType, move(des), lits, return std::make_unique<HWLMProto>(engType, std::move(des), lits,
bucketToLits, make_small); bucketToLits, make_small);
} }

View File

@ -39,12 +39,7 @@
* the individual component headers for documentation. * the individual component headers for documentation.
*/ */
/* The current Hyperscan version information. */ #include "hs_version.h"
#define HS_MAJOR 5
#define HS_MINOR 4
#define HS_PATCH 9
#include "hs_compile.h" #include "hs_compile.h"
#include "hs_runtime.h" #include "hs_runtime.h"

View File

@ -36,5 +36,9 @@
#define HS_VERSION_32BIT ((@HS_MAJOR_VERSION@ << 24) | (@HS_MINOR_VERSION@ << 16) | (@HS_PATCH_VERSION@ << 8) | 0) #define HS_VERSION_32BIT ((@HS_MAJOR_VERSION@ << 24) | (@HS_MINOR_VERSION@ << 16) | (@HS_PATCH_VERSION@ << 8) | 0)
#define HS_MAJOR @HS_MAJOR_VERSION@
#define HS_MINOR @HS_MINOR_VERSION@
#define HS_PATCH @HS_PATCH_VERSION@
#endif /* HS_VERSION_H_C6428FAF8E3713 */ #endif /* HS_VERSION_H_C6428FAF8E3713 */

View File

@ -57,24 +57,24 @@ using namespace std;
namespace ue2 { namespace ue2 {
HWLMProto::HWLMProto(u8 engType_in, vector<hwlmLiteral> lits_in) HWLMProto::HWLMProto(u8 engType_in, vector<hwlmLiteral> lits_in)
: engType(engType_in), lits(move(lits_in)) {} : engType(engType_in), lits(std::move(lits_in)) {}
HWLMProto::HWLMProto(u8 engType_in, HWLMProto::HWLMProto(u8 engType_in,
unique_ptr<FDREngineDescription> eng_in, unique_ptr<FDREngineDescription> eng_in,
vector<hwlmLiteral> lits_in, vector<hwlmLiteral> lits_in,
map<u32, vector<u32>> bucketToLits_in, map<u32, vector<u32>> bucketToLits_in,
bool make_small_in) bool make_small_in)
: engType(engType_in), fdrEng(move(eng_in)), lits(move(lits_in)), : engType(engType_in), fdrEng(std::move(eng_in)), lits(std::move(lits_in)),
bucketToLits(move(bucketToLits_in)), make_small(make_small_in) {} bucketToLits(std::move(bucketToLits_in)), make_small(make_small_in) {}
HWLMProto::HWLMProto(u8 engType_in, HWLMProto::HWLMProto(u8 engType_in,
unique_ptr<TeddyEngineDescription> eng_in, unique_ptr<TeddyEngineDescription> eng_in,
vector<hwlmLiteral> lits_in, vector<hwlmLiteral> lits_in,
map<u32, vector<u32>> bucketToLits_in, map<u32, vector<u32>> bucketToLits_in,
bool make_small_in) bool make_small_in)
: engType(engType_in), teddyEng(move(eng_in)), : engType(engType_in), teddyEng(std::move(eng_in)),
lits(move(lits_in)), lits(std::move(lits_in)),
bucketToLits(move(bucketToLits_in)), make_small(make_small_in) {} bucketToLits(std::move(bucketToLits_in)), make_small(make_small_in) {}
HWLMProto::~HWLMProto() {} HWLMProto::~HWLMProto() {}
@ -132,14 +132,14 @@ bytecode_ptr<HWLM> hwlmBuild(const HWLMProto &proto, const CompileContext &cc,
if (noodle) { if (noodle) {
engSize = noodle.size(); engSize = noodle.size();
} }
eng = move(noodle); eng = std::move(noodle);
} else { } else {
DEBUG_PRINTF("building a new deal\n"); DEBUG_PRINTF("building a new deal\n");
auto fdr = fdrBuildTable(proto, cc.grey); auto fdr = fdrBuildTable(proto, cc.grey);
if (fdr) { if (fdr) {
engSize = fdr.size(); engSize = fdr.size();
} }
eng = move(fdr); eng = std::move(fdr);
} }
if (!eng) { if (!eng) {

View File

@ -130,14 +130,14 @@ void extend(const raw_dfa &rdfa, const vector<CharReach> &rev_map,
} else { } else {
path pp = append(p, CharReach(), p.dest); path pp = append(p, CharReach(), p.dest);
all[p.dest].emplace_back(pp); all[p.dest].emplace_back(pp);
out.emplace_back(move(pp)); out.emplace_back(std::move(pp));
} }
} }
if (!s.reports_eod.empty()) { if (!s.reports_eod.empty()) {
path pp = append(p, CharReach(), p.dest); path pp = append(p, CharReach(), p.dest);
all[p.dest].emplace_back(pp); all[p.dest].emplace_back(pp);
out.emplace_back(move(pp)); out.emplace_back(std::move(pp));
} }
flat_map<u32, CharReach> dest; flat_map<u32, CharReach> dest;
@ -157,7 +157,7 @@ void extend(const raw_dfa &rdfa, const vector<CharReach> &rev_map,
DEBUG_PRINTF("----good: [%s] -> %u\n", DEBUG_PRINTF("----good: [%s] -> %u\n",
describeClasses(pp.reach).c_str(), pp.dest); describeClasses(pp.reach).c_str(), pp.dest);
all[e.first].emplace_back(pp); all[e.first].emplace_back(pp);
out.emplace_back(move(pp)); out.emplace_back(std::move(pp));
} }
} }
@ -174,7 +174,7 @@ vector<vector<CharReach>> generate_paths(const raw_dfa &rdfa,
extend(rdfa, rev_map, p, all, next_gen); extend(rdfa, rev_map, p, all, next_gen);
} }
paths = move(next_gen); paths = std::move(next_gen);
} }
dump_paths(paths); dump_paths(paths);

View File

@ -1299,7 +1299,7 @@ unique_ptr<raw_report_info> gough_build_strat::gatherReports(
*arbReport = MO_INVALID_IDX; *arbReport = MO_INVALID_IDX;
assert(!ri->rl.empty()); /* all components should be able to generate assert(!ri->rl.empty()); /* all components should be able to generate
reports */ reports */
return move(ri); return std::move(ri);
} }
u32 raw_gough_report_info_impl::getReportListSize() const { u32 raw_gough_report_info_impl::getReportListSize() const {

View File

@ -1026,7 +1026,7 @@ u32 addReports(const flat_set<ReportID> &r, vector<ReportID> &reports,
u32 offset = verify_u32(reports.size()); u32 offset = verify_u32(reports.size());
insert(&reports, reports.end(), my_reports); insert(&reports, reports.end(), my_reports);
reports_cache.emplace(move(my_reports), offset); reports_cache.emplace(std::move(my_reports), offset);
return offset; return offset;
} }
@ -1064,7 +1064,7 @@ void buildAcceptsList(const build_info &args, ReportListCache &reports_cache,
a.reports = addReports(h[v].reports, reports, reports_cache); a.reports = addReports(h[v].reports, reports, reports_cache);
} }
a.squash = addSquashMask(args, v, squash); a.squash = addSquashMask(args, v, squash);
accepts.emplace_back(move(a)); accepts.emplace_back(std::move(a));
} }
} }
@ -1819,7 +1819,7 @@ struct Factory {
*streamState += streamStateLen; *streamState += streamStateLen;
*scratchStateSize += sizeof(RepeatControl); *scratchStateSize += sizeof(RepeatControl);
out.emplace_back(move(info)); out.emplace_back(std::move(info));
} }
} }

View File

@ -462,7 +462,7 @@ unique_ptr<raw_report_info> mcclellan_build_strat::gatherReports(
*isSingleReport = 0; *isSingleReport = 0;
} }
return move(ri); return std::move(ri);
} }
u32 raw_report_info_impl::getReportListSize() const { u32 raw_report_info_impl::getReportListSize() const {

View File

@ -66,10 +66,6 @@ enum NFAEngineType {
LBR_NFA_DOT, /**< magic pseudo nfa */ LBR_NFA_DOT, /**< magic pseudo nfa */
LBR_NFA_VERM, /**< magic pseudo nfa */ LBR_NFA_VERM, /**< magic pseudo nfa */
LBR_NFA_NVERM, /**< magic pseudo nfa */ LBR_NFA_NVERM, /**< magic pseudo nfa */
#ifdef HAVE_SVE2
LBR_NFA_VERM16, /**< magic pseudo nfa */
LBR_NFA_NVERM16, /**< magic pseudo nfa */
#endif // HAVE_SVE2
LBR_NFA_SHUF, /**< magic pseudo nfa */ LBR_NFA_SHUF, /**< magic pseudo nfa */
LBR_NFA_TRUF, /**< magic pseudo nfa */ LBR_NFA_TRUF, /**< magic pseudo nfa */
CASTLE_NFA, /**< magic pseudo nfa */ CASTLE_NFA, /**< magic pseudo nfa */
@ -81,6 +77,10 @@ enum NFAEngineType {
SHENG_NFA_64, /**< magic pseudo nfa */ SHENG_NFA_64, /**< magic pseudo nfa */
MCSHENG_64_NFA_8, /**< magic pseudo nfa */ MCSHENG_64_NFA_8, /**< magic pseudo nfa */
MCSHENG_64_NFA_16, /**< magic pseudo nfa */ MCSHENG_64_NFA_16, /**< magic pseudo nfa */
#ifdef HAVE_SVE2
LBR_NFA_VERM16, /**< magic pseudo nfa */
LBR_NFA_NVERM16, /**< magic pseudo nfa */
#endif // HAVE_SVE2
/** \brief bogus NFA - not used */ /** \brief bogus NFA - not used */
INVALID_NFA INVALID_NFA
}; };

View File

@ -319,7 +319,7 @@ void mergeDfas(vector<unique_ptr<raw_dfa>> &dfas, size_t max_states,
queue<unique_ptr<raw_dfa>> q; queue<unique_ptr<raw_dfa>> q;
for (auto &dfa : dfas) { for (auto &dfa : dfas) {
q.push(move(dfa)); q.push(std::move(dfa));
} }
// All DFAs are now on the queue, so we'll clear the vector and use it for // All DFAs are now on the queue, so we'll clear the vector and use it for
@ -328,30 +328,30 @@ void mergeDfas(vector<unique_ptr<raw_dfa>> &dfas, size_t max_states,
while (q.size() > 1) { while (q.size() > 1) {
// Attempt to merge the two front elements of the queue. // Attempt to merge the two front elements of the queue.
unique_ptr<raw_dfa> d1 = move(q.front()); unique_ptr<raw_dfa> d1 = std::move(q.front());
q.pop(); q.pop();
unique_ptr<raw_dfa> d2 = move(q.front()); unique_ptr<raw_dfa> d2 = std::move(q.front());
q.pop(); q.pop();
auto rdfa = mergeTwoDfas(d1.get(), d2.get(), max_states, rm, grey); auto rdfa = mergeTwoDfas(d1.get(), d2.get(), max_states, rm, grey);
if (rdfa) { if (rdfa) {
q.push(move(rdfa)); q.push(std::move(rdfa));
} else { } else {
DEBUG_PRINTF("failed to merge\n"); DEBUG_PRINTF("failed to merge\n");
// Put the larger of the two DFAs on the output list, retain the // Put the larger of the two DFAs on the output list, retain the
// smaller one on the queue for further merge attempts. // smaller one on the queue for further merge attempts.
if (d2->states.size() > d1->states.size()) { if (d2->states.size() > d1->states.size()) {
dfas.emplace_back(move(d2)); dfas.emplace_back(std::move(d2));
q.push(move(d1)); q.push(std::move(d1));
} else { } else {
dfas.emplace_back(move(d1)); dfas.emplace_back(std::move(d1));
q.push(move(d2)); q.push(std::move(d2));
} }
} }
} }
while (!q.empty()) { while (!q.empty()) {
dfas.emplace_back(move(q.front())); dfas.emplace_back(std::move(q.front()));
q.pop(); q.pop();
} }

View File

@ -270,7 +270,7 @@ unique_ptr<raw_report_info> sheng_build_strat::gatherReports(
*isSingleReport = 0; *isSingleReport = 0;
} }
return move(ri); return std::move(ri);
} }
u32 sheng_build_strat::max_allowed_offset_accel() const { u32 sheng_build_strat::max_allowed_offset_accel() const {

View File

@ -162,7 +162,7 @@ BuiltExpression NFABuilderImpl::getGraph() {
throw CompileError("Pattern too large."); throw CompileError("Pattern too large.");
} }
return { expr, move(graph) }; return { expr, std::move(graph) };
} }
void NFABuilderImpl::setNodeReportID(Position pos, int offsetAdjust) { void NFABuilderImpl::setNodeReportID(Position pos, int offsetAdjust) {

View File

@ -369,7 +369,7 @@ void splitIntoComponents(unique_ptr<NGHolder> g,
pruneUseless(*gc); pruneUseless(*gc);
DEBUG_PRINTF("component %zu has %zu vertices\n", comps.size(), DEBUG_PRINTF("component %zu has %zu vertices\n", comps.size(),
num_vertices(*gc)); num_vertices(*gc));
comps.emplace_back(move(gc)); comps.emplace_back(std::move(gc));
} }
// Another component to handle the direct shell-to-shell edges. // Another component to handle the direct shell-to-shell edges.
@ -385,7 +385,7 @@ void splitIntoComponents(unique_ptr<NGHolder> g,
pruneUseless(*gc); pruneUseless(*gc);
DEBUG_PRINTF("shell edge component %zu has %zu vertices\n", DEBUG_PRINTF("shell edge component %zu has %zu vertices\n",
comps.size(), num_vertices(*gc)); comps.size(), num_vertices(*gc));
comps.emplace_back(move(gc)); comps.emplace_back(std::move(gc));
*shell_comp = true; *shell_comp = true;
} }

View File

@ -349,7 +349,7 @@ vector<VertexInfoSet> partitionGraph(vector<unique_ptr<VertexInfo>> &infos,
unsigned eq_class = classes.size(); unsigned eq_class = classes.size();
vi->equivalence_class = eq_class; vi->equivalence_class = eq_class;
classes.push_back({vi.get()}); classes.push_back({vi.get()});
classinfomap.emplace(move(ci), eq_class); classinfomap.emplace(std::move(ci), eq_class);
} else { } else {
// vertex is added to an existing class. // vertex is added to an existing class.
unsigned eq_class = ii->second; unsigned eq_class = ii->second;
@ -441,7 +441,7 @@ void equivalence(vector<VertexInfoSet> &classes, WorkQueue &work_queue,
classes[cur_class].erase(vi); classes[cur_class].erase(vi);
new_class_vertices.insert(vi); new_class_vertices.insert(vi);
} }
classes.emplace_back(move(new_class_vertices)); classes.emplace_back(std::move(new_class_vertices));
if (contains(tmi->first, cur_class)) { if (contains(tmi->first, cur_class)) {
reval_queue.push(new_class); reval_queue.push(new_class);

View File

@ -254,7 +254,7 @@ void findBestInternal(vector<vector<CharReach>>::const_iterator pb,
DEBUG_PRINTF("worse\n"); DEBUG_PRINTF("worse\n");
continue; continue;
} }
priority_path.emplace_back(move(as)); priority_path.emplace_back(std::move(as));
} }
sort(priority_path.begin(), priority_path.end()); sort(priority_path.begin(), priority_path.end());
@ -422,7 +422,7 @@ void findDoubleBest(vector<vector<CharReach> >::const_iterator pb,
DEBUG_PRINTF("worse\n"); DEBUG_PRINTF("worse\n");
continue; continue;
} }
priority_path.emplace_back(move(as)); priority_path.emplace_back(std::move(as));
} }
sort(priority_path.begin(), priority_path.end()); sort(priority_path.begin(), priority_path.end());
@ -569,7 +569,7 @@ AccelScheme findBestAccelScheme(vector<vector<CharReach>> paths,
DAccelScheme da = findBestDoubleAccelScheme(paths, terminating); DAccelScheme da = findBestDoubleAccelScheme(paths, terminating);
if (da.double_byte.size() <= DOUBLE_SHUFTI_LIMIT) { if (da.double_byte.size() <= DOUBLE_SHUFTI_LIMIT) {
rv.double_byte = std::move(da.double_byte); rv.double_byte = std::move(da.double_byte);
rv.double_cr = move(da.double_cr); rv.double_cr = std::move(da.double_cr);
rv.double_offset = da.double_offset; rv.double_offset = da.double_offset;
} }
} }

View File

@ -67,7 +67,7 @@ namespace {
struct LitGraphVertexProps { struct LitGraphVertexProps {
LitGraphVertexProps() = default; LitGraphVertexProps() = default;
explicit LitGraphVertexProps(ue2_literal::elem c_in) : c(move(c_in)) {} explicit LitGraphVertexProps(ue2_literal::elem c_in) : c(std::move(c_in)) {}
ue2_literal::elem c; // string element (char + bool) ue2_literal::elem c; // string element (char + bool)
size_t index = 0; // managed by ue2_graph size_t index = 0; // managed by ue2_graph
}; };

View File

@ -237,7 +237,7 @@ bool handleDecoratedLiterals(RoseBuild &rose, const NGHolder &g,
DEBUG_PRINTF("failed validation\n"); DEBUG_PRINTF("failed validation\n");
return false; return false;
} }
masks.emplace_back(move(pm)); masks.emplace_back(std::move(pm));
} }
for (const auto &pm : masks) { for (const auto &pm : masks) {

View File

@ -100,7 +100,7 @@ void checkAndAddExitCandidate(const AcyclicGraph &g,
if (!open.empty()) { if (!open.empty()) {
DEBUG_PRINTF("exit %zu\n", g[v].index); DEBUG_PRINTF("exit %zu\n", g[v].index);
exits.emplace_back(move(v_exit)); exits.emplace_back(std::move(v_exit));
} }
} }
@ -210,7 +210,7 @@ void buildInitialCandidate(const AcyclicGraph &g,
if (it != ite) { if (it != ite) {
enters.erase(*it); enters.erase(*it);
open_jumps = move(enters); open_jumps = std::move(enters);
DEBUG_PRINTF("oj size = %zu\n", open_jumps.size()); DEBUG_PRINTF("oj size = %zu\n", open_jumps.size());
++it; ++it;
} else { } else {

View File

@ -1733,7 +1733,7 @@ void clearProperInEdges(NGHolder &g, const NFAVertex sink) {
namespace { namespace {
struct SomRevNfa { struct SomRevNfa {
SomRevNfa(NFAVertex s, ReportID r, bytecode_ptr<NFA> n) SomRevNfa(NFAVertex s, ReportID r, bytecode_ptr<NFA> n)
: sink(s), report(r), nfa(move(n)) {} : sink(s), report(r), nfa(std::move(n)) {}
NFAVertex sink; NFAVertex sink;
ReportID report; ReportID report;
bytecode_ptr<NFA> nfa; bytecode_ptr<NFA> nfa;
@ -1799,7 +1799,7 @@ bool makeSomRevNfa(vector<SomRevNfa> &som_nfas, const NGHolder &g,
return false; return false;
} }
som_nfas.emplace_back(sink, report, move(nfa)); som_nfas.emplace_back(sink, report, std::move(nfa));
return true; return true;
} }
@ -1839,7 +1839,7 @@ bool doSomRevNfa(NG &ng, NGHolder &g, const CompileContext &cc) {
assert(som_nfa.nfa); assert(som_nfa.nfa);
// Transfer ownership of the NFA to the SOM slot manager. // Transfer ownership of the NFA to the SOM slot manager.
u32 comp_id = ng.ssm.addRevNfa(move(som_nfa.nfa), maxWidth); u32 comp_id = ng.ssm.addRevNfa(std::move(som_nfa.nfa), maxWidth);
// Replace this report on 'g' with a SOM_REV_NFA report pointing at our // Replace this report on 'g' with a SOM_REV_NFA report pointing at our
// new component. // new component.
@ -1872,7 +1872,7 @@ u32 doSomRevNfaPrefix(NG &ng, const ExpressionInfo &expr, NGHolder &g,
max(cc.grey.maxHistoryAvailable, ng.maxSomRevHistoryAvailable)); max(cc.grey.maxHistoryAvailable, ng.maxSomRevHistoryAvailable));
} }
return ng.ssm.addRevNfa(move(nfa), maxWidth); return ng.ssm.addRevNfa(std::move(nfa), maxWidth);
} }
static static

View File

@ -394,7 +394,7 @@ void getSimpleRoseLiterals(const NGHolder &g, bool seeking_anchored,
lits->reserve(lit_info.size()); lits->reserve(lit_info.size());
for (auto &m : lit_info) { for (auto &m : lit_info) {
lits->emplace_back(move(m.second)); lits->emplace_back(std::move(m.second));
} }
DEBUG_PRINTF("%zu candidate literal sets\n", lits->size()); DEBUG_PRINTF("%zu candidate literal sets\n", lits->size());
} }
@ -707,11 +707,11 @@ unique_ptr<VertLitInfo> findBestSplit(const NGHolder &g,
auto cmp = LitComparator(g, seeking_anchored, seeking_transient, auto cmp = LitComparator(g, seeking_anchored, seeking_transient,
last_chance); last_chance);
unique_ptr<VertLitInfo> best = move(lits.back()); unique_ptr<VertLitInfo> best = std::move(lits.back());
lits.pop_back(); lits.pop_back();
while (!lits.empty()) { while (!lits.empty()) {
if (cmp(best, lits.back())) { if (cmp(best, lits.back())) {
best = move(lits.back()); best = std::move(lits.back());
} }
lits.pop_back(); lits.pop_back();
} }
@ -1621,7 +1621,7 @@ void removeRedundantLiteralsFromPrefixes(RoseInGraph &g,
if (delay && delay != MO_INVALID_IDX) { if (delay && delay != MO_INVALID_IDX) {
DEBUG_PRINTF("setting delay %u on lhs %p\n", delay, h.get()); DEBUG_PRINTF("setting delay %u on lhs %p\n", delay, h.get());
g[e].graph = move(h); g[e].graph = std::move(h);
g[e].graph_lag = delay; g[e].graph_lag = delay;
} }
} }

View File

@ -103,7 +103,7 @@ void ComponentAlternation::accept(ConstComponentVisitor &v) const {
} }
void ComponentAlternation::append(unique_ptr<Component> component) { void ComponentAlternation::append(unique_ptr<Component> component) {
children.emplace_back(move(component)); children.emplace_back(std::move(component));
} }
vector<PositionInfo> ComponentAlternation::first() const { vector<PositionInfo> ComponentAlternation::first() const {

View File

@ -50,7 +50,7 @@ ComponentCondReference::ComponentCondReference(const string &name)
: kind(CONDITION_NAME), ref_id(0), ref_name(name), hasBothBranches(false) {} : kind(CONDITION_NAME), ref_id(0), ref_name(name), hasBothBranches(false) {}
ComponentCondReference::ComponentCondReference(unique_ptr<Component> c) ComponentCondReference::ComponentCondReference(unique_ptr<Component> c)
: kind(CONDITION_ASSERTION), ref_id(0), assertion(move(c)), : kind(CONDITION_ASSERTION), ref_id(0), assertion(std::move(c)),
hasBothBranches(false) {} hasBothBranches(false) {}
ComponentCondReference::~ComponentCondReference() {} ComponentCondReference::~ComponentCondReference() {}

View File

@ -60,7 +60,7 @@ static constexpr u32 MAX_POSITIONS_EXPANDED = 500000; // arbitrarily huge
* extent is effectively zero. */ * extent is effectively zero. */
ComponentRepeat::ComponentRepeat(unique_ptr<Component> sub_comp_in, u32 min, ComponentRepeat::ComponentRepeat(unique_ptr<Component> sub_comp_in, u32 min,
u32 max, enum RepeatType t) u32 max, enum RepeatType t)
: type(t), sub_comp(move(sub_comp_in)), m_min(min), m_max(max), : type(t), sub_comp(std::move(sub_comp_in)), m_min(min), m_max(max),
posFirst(GlushkovBuildState::POS_UNINITIALIZED), posFirst(GlushkovBuildState::POS_UNINITIALIZED),
posLast(GlushkovBuildState::POS_UNINITIALIZED) { posLast(GlushkovBuildState::POS_UNINITIALIZED) {
assert(sub_comp); assert(sub_comp);
@ -361,7 +361,7 @@ void ComponentRepeat::postSubNotePositionHook() {
unique_ptr<ComponentRepeat> makeComponentRepeat(unique_ptr<Component> sub_comp, unique_ptr<ComponentRepeat> makeComponentRepeat(unique_ptr<Component> sub_comp,
u32 min, u32 max, u32 min, u32 max,
ComponentRepeat::RepeatType t) { ComponentRepeat::RepeatType t) {
return std::make_unique<ComponentRepeat>(move(sub_comp), min, max, t); return std::make_unique<ComponentRepeat>(std::move(sub_comp), min, max, t);
} }
} // namespace ue2 } // namespace ue2

View File

@ -116,7 +116,7 @@ void ComponentSequence::accept(ConstComponentVisitor &v) const {
} }
void ComponentSequence::addComponent(unique_ptr<Component> comp) { void ComponentSequence::addComponent(unique_ptr<Component> comp) {
children.emplace_back(move(comp)); children.emplace_back(std::move(comp));
} }
bool ComponentSequence::addRepeat(u32 min, u32 max, bool ComponentSequence::addRepeat(u32 min, u32 max,
@ -131,7 +131,7 @@ bool ComponentSequence::addRepeat(u32 min, u32 max,
return false; return false;
} }
children.back() = makeComponentRepeat(move(children.back()), min, max, children.back() = makeComponentRepeat(std::move(children.back()), min, max,
type); type);
assert(children.back()); assert(children.back());
return true; return true;
@ -144,14 +144,14 @@ void ComponentSequence::addAlternation() {
auto seq = std::make_unique<ComponentSequence>(); auto seq = std::make_unique<ComponentSequence>();
seq->children.swap(children); seq->children.swap(children);
alternation->append(move(seq)); alternation->append(std::move(seq));
} }
void ComponentSequence::finalize() { void ComponentSequence::finalize() {
if (alternation) { if (alternation) {
addAlternation(); addAlternation();
assert(children.empty()); assert(children.empty());
children.emplace_back(move(alternation)); children.emplace_back(std::move(alternation));
alternation = nullptr; alternation = nullptr;
} }
} }

View File

@ -163,7 +163,7 @@ ComponentSequence *enterSequence(ComponentSequence *parent,
assert(child); assert(child);
ComponentSequence *seq = child.get(); ComponentSequence *seq = child.get();
parent->addComponent(move(child)); parent->addComponent(std::move(child));
return seq; return seq;
} }
@ -175,7 +175,7 @@ void addLiteral(ComponentSequence *currentSeq, char c, const ParseMode &mode) {
assert(cc); assert(cc);
cc->add(c); cc->add(c);
cc->finalize(); cc->finalize();
currentSeq->addComponent(move(cc)); currentSeq->addComponent(std::move(cc));
} else { } else {
currentSeq->addComponent(getLiteralComponentClass(c, mode.caseless)); currentSeq->addComponent(getLiteralComponentClass(c, mode.caseless));
} }
@ -190,7 +190,7 @@ void addEscaped(ComponentSequence *currentSeq, unichar accum,
assert(cc); assert(cc);
cc->add(accum); cc->add(accum);
cc->finalize(); cc->finalize();
currentSeq->addComponent(move(cc)); currentSeq->addComponent(std::move(cc));
} else { } else {
if (accum > 255) { if (accum > 255) {
throw LocatedParseError(err_msg); throw LocatedParseError(err_msg);
@ -330,7 +330,7 @@ unichar readUtf8CodePoint4c(const char *s) {
PUSH_SEQUENCE; PUSH_SEQUENCE;
auto seq = std::make_unique<ComponentSequence>(); auto seq = std::make_unique<ComponentSequence>();
seq->setCaptureIndex(groupIndex++); seq->setCaptureIndex(groupIndex++);
currentSeq = enterSequence(currentSeq, move(seq)); currentSeq = enterSequence(currentSeq, std::move(seq));
} }
# enter a NAMED CAPTURING group ( e.g. (?'<hatstand>blah) ) # enter a NAMED CAPTURING group ( e.g. (?'<hatstand>blah) )
@ -347,7 +347,7 @@ unichar readUtf8CodePoint4c(const char *s) {
auto seq = std::make_unique<ComponentSequence>(); auto seq = std::make_unique<ComponentSequence>();
seq->setCaptureIndex(groupIndex++); seq->setCaptureIndex(groupIndex++);
seq->setCaptureName(label); seq->setCaptureName(label);
currentSeq = enterSequence(currentSeq, move(seq)); currentSeq = enterSequence(currentSeq, std::move(seq));
} }
# enter a NON-CAPTURING group where we're modifying flags # enter a NON-CAPTURING group where we're modifying flags
@ -724,7 +724,7 @@ unichar readUtf8CodePoint4c(const char *s) {
([^^] ${ fhold; fcall readUCP; }) ([^^] ${ fhold; fcall readUCP; })
'}' ${ if (!inCharClass) { // not inside [..] '}' ${ if (!inCharClass) { // not inside [..]
currentCls->finalize(); currentCls->finalize();
currentSeq->addComponent(move(currentCls)); currentSeq->addComponent(std::move(currentCls));
} }
fret; fret;
}) })
@ -735,7 +735,7 @@ unichar readUtf8CodePoint4c(const char *s) {
currentCls->add(CLASS_UCP_C, negated); currentCls->add(CLASS_UCP_C, negated);
if (!inCharClass) { if (!inCharClass) {
currentCls->finalize(); currentCls->finalize();
currentSeq->addComponent(move(currentCls)); currentSeq->addComponent(std::move(currentCls));
} }
fret; fret;
}; };
@ -743,7 +743,7 @@ unichar readUtf8CodePoint4c(const char *s) {
currentCls->add(CLASS_UCP_L, negated); currentCls->add(CLASS_UCP_L, negated);
if (!inCharClass) { if (!inCharClass) {
currentCls->finalize(); currentCls->finalize();
currentSeq->addComponent(move(currentCls)); currentSeq->addComponent(std::move(currentCls));
} }
fret; fret;
}; };
@ -751,7 +751,7 @@ unichar readUtf8CodePoint4c(const char *s) {
currentCls->add(CLASS_UCP_M, negated); currentCls->add(CLASS_UCP_M, negated);
if (!inCharClass) { if (!inCharClass) {
currentCls->finalize(); currentCls->finalize();
currentSeq->addComponent(move(currentCls)); currentSeq->addComponent(std::move(currentCls));
} }
fret; fret;
}; };
@ -759,7 +759,7 @@ unichar readUtf8CodePoint4c(const char *s) {
currentCls->add(CLASS_UCP_N, negated); currentCls->add(CLASS_UCP_N, negated);
if (!inCharClass) { if (!inCharClass) {
currentCls->finalize(); currentCls->finalize();
currentSeq->addComponent(move(currentCls)); currentSeq->addComponent(std::move(currentCls));
} }
fret; fret;
}; };
@ -767,7 +767,7 @@ unichar readUtf8CodePoint4c(const char *s) {
currentCls->add(CLASS_UCP_P, negated); currentCls->add(CLASS_UCP_P, negated);
if (!inCharClass) { if (!inCharClass) {
currentCls->finalize(); currentCls->finalize();
currentSeq->addComponent(move(currentCls)); currentSeq->addComponent(std::move(currentCls));
} }
fret; fret;
}; };
@ -775,7 +775,7 @@ unichar readUtf8CodePoint4c(const char *s) {
currentCls->add(CLASS_UCP_S, negated); currentCls->add(CLASS_UCP_S, negated);
if (!inCharClass) { if (!inCharClass) {
currentCls->finalize(); currentCls->finalize();
currentSeq->addComponent(move(currentCls)); currentSeq->addComponent(std::move(currentCls));
} }
fret; fret;
}; };
@ -783,7 +783,7 @@ unichar readUtf8CodePoint4c(const char *s) {
currentCls->add(CLASS_UCP_Z, negated); currentCls->add(CLASS_UCP_Z, negated);
if (!inCharClass) { if (!inCharClass) {
currentCls->finalize(); currentCls->finalize();
currentSeq->addComponent(move(currentCls)); currentSeq->addComponent(std::move(currentCls));
} }
fret; fret;
}; };
@ -1106,7 +1106,7 @@ unichar readUtf8CodePoint4c(const char *s) {
']' => { ']' => {
currentCls->finalize(); currentCls->finalize();
currentSeq->addComponent(move(currentCls)); currentSeq->addComponent(std::move(currentCls));
inCharClass = false; inCharClass = false;
fgoto main; fgoto main;
}; };
@ -1163,7 +1163,7 @@ unichar readUtf8CodePoint4c(const char *s) {
auto cc = getComponentClass(mode); auto cc = getComponentClass(mode);
cc->add(readUtf8CodePoint2c(ts)); cc->add(readUtf8CodePoint2c(ts));
cc->finalize(); cc->finalize();
currentSeq->addComponent(move(cc)); currentSeq->addComponent(std::move(cc));
}; };
utf8_3c when is_utf8 => { utf8_3c when is_utf8 => {
@ -1172,7 +1172,7 @@ unichar readUtf8CodePoint4c(const char *s) {
auto cc = getComponentClass(mode); auto cc = getComponentClass(mode);
cc->add(readUtf8CodePoint3c(ts)); cc->add(readUtf8CodePoint3c(ts));
cc->finalize(); cc->finalize();
currentSeq->addComponent(move(cc)); currentSeq->addComponent(std::move(cc));
}; };
utf8_4c when is_utf8 => { utf8_4c when is_utf8 => {
@ -1181,7 +1181,7 @@ unichar readUtf8CodePoint4c(const char *s) {
auto cc = getComponentClass(mode); auto cc = getComponentClass(mode);
cc->add(readUtf8CodePoint4c(ts)); cc->add(readUtf8CodePoint4c(ts));
cc->finalize(); cc->finalize();
currentSeq->addComponent(move(cc)); currentSeq->addComponent(std::move(cc));
}; };
hi_byte when is_utf8 => { hi_byte when is_utf8 => {
@ -1618,52 +1618,52 @@ unichar readUtf8CodePoint4c(const char *s) {
# Word character # Word character
'\\w' => { '\\w' => {
auto cc = generateComponent(CLASS_WORD, false, mode); auto cc = generateComponent(CLASS_WORD, false, mode);
currentSeq->addComponent(move(cc)); currentSeq->addComponent(std::move(cc));
}; };
# Non word character # Non word character
'\\W' => { '\\W' => {
auto cc = generateComponent(CLASS_WORD, true, mode); auto cc = generateComponent(CLASS_WORD, true, mode);
currentSeq->addComponent(move(cc)); currentSeq->addComponent(std::move(cc));
}; };
# Whitespace character # Whitespace character
'\\s' => { '\\s' => {
auto cc = generateComponent(CLASS_SPACE, false, mode); auto cc = generateComponent(CLASS_SPACE, false, mode);
currentSeq->addComponent(move(cc)); currentSeq->addComponent(std::move(cc));
}; };
# Non whitespace character # Non whitespace character
'\\S' => { '\\S' => {
auto cc = generateComponent(CLASS_SPACE, true, mode); auto cc = generateComponent(CLASS_SPACE, true, mode);
currentSeq->addComponent(move(cc)); currentSeq->addComponent(std::move(cc));
}; };
# Digit character # Digit character
'\\d' => { '\\d' => {
auto cc = generateComponent(CLASS_DIGIT, false, mode); auto cc = generateComponent(CLASS_DIGIT, false, mode);
currentSeq->addComponent(move(cc)); currentSeq->addComponent(std::move(cc));
}; };
# Non digit character # Non digit character
'\\D' => { '\\D' => {
auto cc = generateComponent(CLASS_DIGIT, true, mode); auto cc = generateComponent(CLASS_DIGIT, true, mode);
currentSeq->addComponent(move(cc)); currentSeq->addComponent(std::move(cc));
}; };
# Horizontal whitespace # Horizontal whitespace
'\\h' => { '\\h' => {
auto cc = generateComponent(CLASS_HORZ, false, mode); auto cc = generateComponent(CLASS_HORZ, false, mode);
currentSeq->addComponent(move(cc)); currentSeq->addComponent(std::move(cc));
}; };
# Not horizontal whitespace # Not horizontal whitespace
'\\H' => { '\\H' => {
auto cc = generateComponent(CLASS_HORZ, true, mode); auto cc = generateComponent(CLASS_HORZ, true, mode);
currentSeq->addComponent(move(cc)); currentSeq->addComponent(std::move(cc));
}; };
# Vertical whitespace # Vertical whitespace
'\\v' => { '\\v' => {
auto cc = generateComponent(CLASS_VERT, false, mode); auto cc = generateComponent(CLASS_VERT, false, mode);
currentSeq->addComponent(move(cc)); currentSeq->addComponent(std::move(cc));
}; };
# Not vertical whitespace # Not vertical whitespace
'\\V' => { '\\V' => {
auto cc = generateComponent(CLASS_VERT, true, mode); auto cc = generateComponent(CLASS_VERT, true, mode);
currentSeq->addComponent(move(cc)); currentSeq->addComponent(std::move(cc));
}; };
'\\p{' => { '\\p{' => {
@ -1787,7 +1787,7 @@ unichar readUtf8CodePoint4c(const char *s) {
ComponentAssertion *a_seq = a.get(); ComponentAssertion *a_seq = a.get();
PUSH_SEQUENCE; PUSH_SEQUENCE;
currentSeq = enterSequence(currentSeq, currentSeq = enterSequence(currentSeq,
std::make_unique<ComponentCondReference>(move(a))); std::make_unique<ComponentCondReference>(std::move(a)));
PUSH_SEQUENCE; PUSH_SEQUENCE;
currentSeq = a_seq; currentSeq = a_seq;
}; };
@ -1798,7 +1798,7 @@ unichar readUtf8CodePoint4c(const char *s) {
ComponentAssertion *a_seq = a.get(); ComponentAssertion *a_seq = a.get();
PUSH_SEQUENCE; PUSH_SEQUENCE;
currentSeq = enterSequence(currentSeq, currentSeq = enterSequence(currentSeq,
std::make_unique<ComponentCondReference>(move(a))); std::make_unique<ComponentCondReference>(std::move(a)));
PUSH_SEQUENCE; PUSH_SEQUENCE;
currentSeq = a_seq; currentSeq = a_seq;
}; };
@ -1809,7 +1809,7 @@ unichar readUtf8CodePoint4c(const char *s) {
ComponentAssertion *a_seq = a.get(); ComponentAssertion *a_seq = a.get();
PUSH_SEQUENCE; PUSH_SEQUENCE;
currentSeq = enterSequence(currentSeq, currentSeq = enterSequence(currentSeq,
std::make_unique<ComponentCondReference>(move(a))); std::make_unique<ComponentCondReference>(std::move(a)));
PUSH_SEQUENCE; PUSH_SEQUENCE;
currentSeq = a_seq; currentSeq = a_seq;
}; };
@ -1820,7 +1820,7 @@ unichar readUtf8CodePoint4c(const char *s) {
ComponentAssertion *a_seq = a.get(); ComponentAssertion *a_seq = a.get();
PUSH_SEQUENCE; PUSH_SEQUENCE;
currentSeq = enterSequence(currentSeq, currentSeq = enterSequence(currentSeq,
std::make_unique<ComponentCondReference>(move(a))); std::make_unique<ComponentCondReference>(std::move(a)));
PUSH_SEQUENCE; PUSH_SEQUENCE;
currentSeq = a_seq; currentSeq = a_seq;
}; };
@ -1861,7 +1861,7 @@ unichar readUtf8CodePoint4c(const char *s) {
auto cc = getComponentClass(mode); auto cc = getComponentClass(mode);
cc->add(readUtf8CodePoint2c(ts)); cc->add(readUtf8CodePoint2c(ts));
cc->finalize(); cc->finalize();
currentSeq->addComponent(move(cc)); currentSeq->addComponent(std::move(cc));
}; };
utf8_3c when is_utf8 => { utf8_3c when is_utf8 => {
@ -1870,7 +1870,7 @@ unichar readUtf8CodePoint4c(const char *s) {
auto cc = getComponentClass(mode); auto cc = getComponentClass(mode);
cc->add(readUtf8CodePoint3c(ts)); cc->add(readUtf8CodePoint3c(ts));
cc->finalize(); cc->finalize();
currentSeq->addComponent(move(cc)); currentSeq->addComponent(std::move(cc));
}; };
utf8_4c when is_utf8 => { utf8_4c when is_utf8 => {
@ -1879,7 +1879,7 @@ unichar readUtf8CodePoint4c(const char *s) {
auto cc = getComponentClass(mode); auto cc = getComponentClass(mode);
cc->add(readUtf8CodePoint4c(ts)); cc->add(readUtf8CodePoint4c(ts));
cc->finalize(); cc->finalize();
currentSeq->addComponent(move(cc)); currentSeq->addComponent(std::move(cc));
}; };
hi_byte when is_utf8 => { hi_byte when is_utf8 => {
@ -2024,7 +2024,7 @@ unique_ptr<Component> parse(const char *ptr, ParseMode &globalMode) {
// Ensure that all references are valid. // Ensure that all references are valid.
checkReferences(*rootSeq, groupIndex, groupNames); checkReferences(*rootSeq, groupIndex, groupNames);
return move(rootSeq); return std::move(rootSeq);
} catch (LocatedParseError &error) { } catch (LocatedParseError &error) {
if (ts >= ptr && ts <= pe) { if (ts >= ptr && ts <= pe) {
error.locate(ts - ptr); error.locate(ts - ptr);

View File

@ -1780,7 +1780,7 @@ bool RoseBuildImpl::addOutfix(const NGHolder &h) {
} }
if (rdfa) { if (rdfa) {
outfixes.emplace_back(OutfixInfo(move(rdfa))); outfixes.emplace_back(OutfixInfo(std::move(rdfa)));
} else { } else {
outfixes.emplace_back(OutfixInfo(cloneHolder(h))); outfixes.emplace_back(OutfixInfo(cloneHolder(h)));
} }

View File

@ -144,9 +144,9 @@ void mergeAnchoredDfas(vector<unique_ptr<raw_dfa>> &dfas,
for (auto &rdfa : dfas) { for (auto &rdfa : dfas) {
u32 start_size = mcclellanStartReachSize(rdfa.get()); u32 start_size = mcclellanStartReachSize(rdfa.get());
if (start_size <= MAX_SMALL_START_REACH) { if (start_size <= MAX_SMALL_START_REACH) {
small_starts.emplace_back(move(rdfa)); small_starts.emplace_back(std::move(rdfa));
} else { } else {
big_starts.emplace_back(move(rdfa)); big_starts.emplace_back(std::move(rdfa));
} }
} }
dfas.clear(); dfas.clear();
@ -158,10 +158,10 @@ void mergeAnchoredDfas(vector<unique_ptr<raw_dfa>> &dfas,
// Rehome our groups into one vector. // Rehome our groups into one vector.
for (auto &rdfa : small_starts) { for (auto &rdfa : small_starts) {
dfas.emplace_back(move(rdfa)); dfas.emplace_back(std::move(rdfa));
} }
for (auto &rdfa : big_starts) { for (auto &rdfa : big_starts) {
dfas.emplace_back(move(rdfa)); dfas.emplace_back(std::move(rdfa));
} }
// Final test: if we've built two DFAs here that are small enough, we can // Final test: if we've built two DFAs here that are small enough, we can
@ -685,7 +685,7 @@ int finalise_out(RoseBuildImpl &build, const NGHolder &h,
if (check_dupe(*out_dfa, build.anchored_nfas[hash], remap)) { if (check_dupe(*out_dfa, build.anchored_nfas[hash], remap)) {
return ANCHORED_REMAP; return ANCHORED_REMAP;
} }
build.anchored_nfas[hash].emplace_back(move(out_dfa)); build.anchored_nfas[hash].emplace_back(std::move(out_dfa));
return ANCHORED_SUCCESS; return ANCHORED_SUCCESS;
} }
@ -700,7 +700,7 @@ int addAutomaton(RoseBuildImpl &build, const NGHolder &h, ReportID *remap) {
auto out_dfa = std::make_unique<raw_dfa>(NFA_OUTFIX_RAW); auto out_dfa = std::make_unique<raw_dfa>(NFA_OUTFIX_RAW);
if (determinise(autom, out_dfa->states, MAX_DFA_STATES)) { if (determinise(autom, out_dfa->states, MAX_DFA_STATES)) {
return finalise_out(build, h, autom, move(out_dfa), remap); return finalise_out(build, h, autom, std::move(out_dfa), remap);
} }
DEBUG_PRINTF("determinise failed\n"); DEBUG_PRINTF("determinise failed\n");
@ -767,7 +767,7 @@ void buildSimpleDfas(const RoseBuildImpl &build, const vector<u32> &frag_map,
rdfa->start_floating = DEAD_STATE; rdfa->start_floating = DEAD_STATE;
rdfa->alpha_size = autom.alphasize; rdfa->alpha_size = autom.alphasize;
rdfa->alpha_remap = autom.alpha; rdfa->alpha_remap = autom.alpha;
anchored_dfas->emplace_back(move(rdfa)); anchored_dfas->emplace_back(std::move(rdfa));
} }
} }
@ -784,7 +784,7 @@ vector<unique_ptr<raw_dfa>> getAnchoredDfas(RoseBuildImpl &build,
// DFAs that already exist as raw_dfas. // DFAs that already exist as raw_dfas.
for (auto &anch_dfas : build.anchored_nfas) { for (auto &anch_dfas : build.anchored_nfas) {
for (auto &rdfa : anch_dfas.second) { for (auto &rdfa : anch_dfas.second) {
dfas.emplace_back(move(rdfa)); dfas.emplace_back(std::move(rdfa));
} }
} }
build.anchored_nfas.clear(); build.anchored_nfas.clear();
@ -834,7 +834,7 @@ size_t buildNfas(vector<raw_dfa> &anchored_dfas,
assert(nfa->length); assert(nfa->length);
total_size += ROUNDUP_CL(sizeof(anchored_matcher_info) + nfa->length); total_size += ROUNDUP_CL(sizeof(anchored_matcher_info) + nfa->length);
nfas->emplace_back(move(nfa)); nfas->emplace_back(std::move(nfa));
} }
// We no longer need to keep the raw_dfa structures around. // We no longer need to keep the raw_dfa structures around.
@ -861,7 +861,7 @@ vector<raw_dfa> buildAnchoredDfas(RoseBuildImpl &build,
dfas.reserve(anch_dfas.size()); dfas.reserve(anch_dfas.size());
for (auto &rdfa : anch_dfas) { for (auto &rdfa : anch_dfas) {
assert(rdfa); assert(rdfa);
dfas.emplace_back(move(*rdfa)); dfas.emplace_back(std::move(*rdfa));
} }
return dfas; return dfas;
} }

View File

@ -701,9 +701,9 @@ buildSuffix(const ReportManager &rm, const SomSlotManager &ssm,
auto d = getDfa(*rdfa, false, cc, rm); auto d = getDfa(*rdfa, false, cc, rm);
assert(d); assert(d);
if (cc.grey.roseMcClellanSuffix != 2) { if (cc.grey.roseMcClellanSuffix != 2) {
n = pickImpl(move(d), move(n), fast_nfa); n = pickImpl(std::move(d), std::move(n), fast_nfa);
} else { } else {
n = move(d); n = std::move(d);
} }
assert(n); assert(n);
@ -853,7 +853,7 @@ bytecode_ptr<NFA> makeLeftNfa(const RoseBuildImpl &tbi, left_id &left,
if (rdfa) { if (rdfa) {
auto d = getDfa(*rdfa, is_transient, cc, rm); auto d = getDfa(*rdfa, is_transient, cc, rm);
assert(d); assert(d);
n = pickImpl(move(d), move(n), fast_nfa); n = pickImpl(std::move(d), std::move(n), fast_nfa);
} }
} }
@ -1422,12 +1422,12 @@ void buildExclusiveInfixes(RoseBuildImpl &build, build_context &bc,
setLeftNfaProperties(*n, leftfix); setLeftNfaProperties(*n, leftfix);
ExclusiveSubengine engine; ExclusiveSubengine engine;
engine.nfa = move(n); engine.nfa = std::move(n);
engine.vertices = verts; engine.vertices = verts;
info.subengines.emplace_back(move(engine)); info.subengines.emplace_back(std::move(engine));
} }
info.queue = qif.get_queue(); info.queue = qif.get_queue();
exclusive_info.emplace_back(move(info)); exclusive_info.emplace_back(std::move(info));
} }
updateExclusiveInfixProperties(build, exclusive_info, bc.leftfix_info, updateExclusiveInfixProperties(build, exclusive_info, bc.leftfix_info,
no_retrigger_queues); no_retrigger_queues);
@ -1649,7 +1649,7 @@ public:
if (rdfa) { if (rdfa) {
auto d = getDfa(*rdfa, false, cc, rm); auto d = getDfa(*rdfa, false, cc, rm);
if (d) { if (d) {
n = pickImpl(move(d), move(n), fast_nfa); n = pickImpl(std::move(d), std::move(n), fast_nfa);
} }
} }
} }
@ -1864,15 +1864,15 @@ void buildExclusiveSuffixes(RoseBuildImpl &build, build_context &bc,
setSuffixProperties(*n, s, build.rm); setSuffixProperties(*n, s, build.rm);
ExclusiveSubengine engine; ExclusiveSubengine engine;
engine.nfa = move(n); engine.nfa = std::move(n);
engine.vertices = verts; engine.vertices = verts;
info.subengines.emplace_back(move(engine)); info.subengines.emplace_back(std::move(engine));
const auto &reports = all_reports(s); const auto &reports = all_reports(s);
info.reports.insert(reports.begin(), reports.end()); info.reports.insert(reports.begin(), reports.end());
} }
info.queue = qif.get_queue(); info.queue = qif.get_queue();
exclusive_info.emplace_back(move(info)); exclusive_info.emplace_back(std::move(info));
} }
updateExclusiveSuffixProperties(build, exclusive_info, updateExclusiveSuffixProperties(build, exclusive_info,
no_retrigger_queues); no_retrigger_queues);
@ -2416,7 +2416,7 @@ u32 writeProgram(build_context &bc, RoseProgram &&program) {
u32 offset = bc.engine_blob.add(prog_bytecode); u32 offset = bc.engine_blob.add(prog_bytecode);
DEBUG_PRINTF("prog len %zu written at offset %u\n", prog_bytecode.size(), DEBUG_PRINTF("prog len %zu written at offset %u\n", prog_bytecode.size(),
offset); offset);
bc.program_cache.emplace(move(program), offset); bc.program_cache.emplace(std::move(program), offset);
return offset; return offset;
} }
@ -2581,13 +2581,13 @@ void makeBoundaryPrograms(const RoseBuildImpl &build, build_context &bc,
DEBUG_PRINTF("report ^$: %zu\n", dboundary.report_at_0_eod_full.size()); DEBUG_PRINTF("report ^$: %zu\n", dboundary.report_at_0_eod_full.size());
auto eod_prog = makeBoundaryProgram(build, boundary.report_at_eod); auto eod_prog = makeBoundaryProgram(build, boundary.report_at_eod);
out.reportEodOffset = writeProgram(bc, move(eod_prog)); out.reportEodOffset = writeProgram(bc, std::move(eod_prog));
auto zero_prog = makeBoundaryProgram(build, boundary.report_at_0); auto zero_prog = makeBoundaryProgram(build, boundary.report_at_0);
out.reportZeroOffset = writeProgram(bc, move(zero_prog)); out.reportZeroOffset = writeProgram(bc, std::move(zero_prog));
auto zeod_prog = makeBoundaryProgram(build, dboundary.report_at_0_eod_full); auto zeod_prog = makeBoundaryProgram(build, dboundary.report_at_0_eod_full);
out.reportZeroEodOffset = writeProgram(bc, move(zeod_prog)); out.reportZeroEodOffset = writeProgram(bc, std::move(zeod_prog));
} }
static static
@ -2752,10 +2752,10 @@ RoseProgram makeFragmentProgram(const RoseBuildImpl &build, build_context &bc,
for (const auto &lit_id : lit_ids) { for (const auto &lit_id : lit_ids) {
auto prog = makeLiteralProgram(build, bc, prog_build, lit_id, auto prog = makeLiteralProgram(build, bc, prog_build, lit_id,
lit_edge_map, false); lit_edge_map, false);
blocks.emplace_back(move(prog)); blocks.emplace_back(std::move(prog));
} }
return assembleProgramBlocks(move(blocks)); return assembleProgramBlocks(std::move(blocks));
} }
/** /**
@ -2865,7 +2865,7 @@ vector<LitFragment> groupByFragment(const RoseBuildImpl &build) {
auto &fi = m.second; auto &fi = m.second;
DEBUG_PRINTF("frag %s -> ids: %s\n", dumpString(m.first.s).c_str(), DEBUG_PRINTF("frag %s -> ids: %s\n", dumpString(m.first.s).c_str(),
as_string_list(fi.lit_ids).c_str()); as_string_list(fi.lit_ids).c_str());
fragments.emplace_back(frag_id, lit.s, fi.groups, move(fi.lit_ids)); fragments.emplace_back(frag_id, lit.s, fi.groups, std::move(fi.lit_ids));
frag_id++; frag_id++;
assert(frag_id == fragments.size()); assert(frag_id == fragments.size());
} }
@ -2981,7 +2981,7 @@ void buildFragmentPrograms(const RoseBuildImpl &build,
child_offset); child_offset);
addIncludedJumpProgram(lit_prog, child_offset, pfrag.squash); addIncludedJumpProgram(lit_prog, child_offset, pfrag.squash);
} }
pfrag.lit_program_offset = writeProgram(bc, move(lit_prog)); pfrag.lit_program_offset = writeProgram(bc, std::move(lit_prog));
// We only do delayed rebuild in streaming mode. // We only do delayed rebuild in streaming mode.
if (!build.cc.streaming) { if (!build.cc.streaming) {
@ -3001,7 +3001,7 @@ void buildFragmentPrograms(const RoseBuildImpl &build,
addIncludedJumpProgram(rebuild_prog, child_offset, addIncludedJumpProgram(rebuild_prog, child_offset,
pfrag.delay_squash); pfrag.delay_squash);
} }
pfrag.delay_program_offset = writeProgram(bc, move(rebuild_prog)); pfrag.delay_program_offset = writeProgram(bc, std::move(rebuild_prog));
} }
} }
@ -3090,7 +3090,7 @@ pair<u32, u32> writeDelayPrograms(const RoseBuildImpl &build,
auto prog = makeLiteralProgram(build, bc, prog_build, auto prog = makeLiteralProgram(build, bc, prog_build,
delayed_lit_id, lit_edge_map, delayed_lit_id, lit_edge_map,
false); false);
u32 offset = writeProgram(bc, move(prog)); u32 offset = writeProgram(bc, std::move(prog));
u32 delay_id; u32 delay_id;
auto it = cache.find(offset); auto it = cache.find(offset);
@ -3150,7 +3150,7 @@ pair<u32, u32> writeAnchoredPrograms(const RoseBuildImpl &build,
auto prog = makeLiteralProgram(build, bc, prog_build, lit_id, auto prog = makeLiteralProgram(build, bc, prog_build, lit_id,
lit_edge_map, true); lit_edge_map, true);
u32 offset = writeProgram(bc, move(prog)); u32 offset = writeProgram(bc, std::move(prog));
DEBUG_PRINTF("lit_id=%u -> anch prog at %u\n", lit_id, offset); DEBUG_PRINTF("lit_id=%u -> anch prog at %u\n", lit_id, offset);
u32 anch_id; u32 anch_id;
@ -3210,7 +3210,7 @@ pair<u32, u32> buildReportPrograms(const RoseBuildImpl &build,
for (ReportID id : reports) { for (ReportID id : reports) {
auto program = makeReportProgram(build, bc.needs_mpv_catchup, id); auto program = makeReportProgram(build, bc.needs_mpv_catchup, id);
u32 offset = writeProgram(bc, move(program)); u32 offset = writeProgram(bc, std::move(program));
programs.emplace_back(offset); programs.emplace_back(offset);
build.rm.setProgramOffset(id, offset); build.rm.setProgramOffset(id, offset);
DEBUG_PRINTF("program for report %u @ %u (%zu instructions)\n", id, DEBUG_PRINTF("program for report %u @ %u (%zu instructions)\n", id,
@ -3326,7 +3326,7 @@ void addEodEventProgram(const RoseBuildImpl &build, build_context &bc,
bc.roleStateIndices, prog_build, bc.roleStateIndices, prog_build,
build.eod_event_literal_id, edge_list, build.eod_event_literal_id, edge_list,
false); false);
program.add_block(move(block)); program.add_block(std::move(block));
} }
static static
@ -3715,7 +3715,7 @@ bytecode_ptr<RoseEngine> RoseBuildImpl::buildFinalEngine(u32 minWidth) {
drproto.get(), eproto.get(), sbproto.get()); drproto.get(), eproto.get(), sbproto.get());
auto eod_prog = makeEodProgram(*this, bc, prog_build, eodNfaIterOffset); auto eod_prog = makeEodProgram(*this, bc, prog_build, eodNfaIterOffset);
proto.eodProgramOffset = writeProgram(bc, move(eod_prog)); proto.eodProgramOffset = writeProgram(bc, std::move(eod_prog));
size_t longLitStreamStateRequired = 0; size_t longLitStreamStateRequired = 0;
proto.longLitTableOffset proto.longLitTableOffset
@ -3734,11 +3734,11 @@ bytecode_ptr<RoseEngine> RoseBuildImpl::buildFinalEngine(u32 minWidth) {
writeLogicalInfo(rm, bc.engine_blob, proto); writeLogicalInfo(rm, bc.engine_blob, proto);
auto flushComb_prog = makeFlushCombProgram(proto); auto flushComb_prog = makeFlushCombProgram(proto);
proto.flushCombProgramOffset = writeProgram(bc, move(flushComb_prog)); proto.flushCombProgramOffset = writeProgram(bc, std::move(flushComb_prog));
auto lastFlushComb_prog = makeLastFlushCombProgram(proto); auto lastFlushComb_prog = makeLastFlushCombProgram(proto);
proto.lastFlushCombProgramOffset = proto.lastFlushCombProgramOffset =
writeProgram(bc, move(lastFlushComb_prog)); writeProgram(bc, std::move(lastFlushComb_prog));
// Build anchored matcher. // Build anchored matcher.
auto atable = buildAnchoredMatcher(*this, fragments, anchored_dfas); auto atable = buildAnchoredMatcher(*this, fragments, anchored_dfas);
@ -3882,7 +3882,7 @@ bytecode_ptr<RoseEngine> RoseBuildImpl::buildFinalEngine(u32 minWidth) {
bc.engine_blob.write_bytes(engine.get()); bc.engine_blob.write_bytes(engine.get());
// Add a small write engine if appropriate. // Add a small write engine if appropriate.
engine = addSmallWriteEngine(*this, bc.resources, move(engine)); engine = addSmallWriteEngine(*this, bc.resources, std::move(engine));
DEBUG_PRINTF("rose done %p\n", engine.get()); DEBUG_PRINTF("rose done %p\n", engine.get());

View File

@ -1782,7 +1782,7 @@ bytecode_ptr<RoseEngine> RoseBuildImpl::buildRose(u32 minWidth) {
/* transfer mpv outfix to main queue */ /* transfer mpv outfix to main queue */
if (mpv_outfix) { if (mpv_outfix) {
outfixes.emplace_back(move(*mpv_outfix)); outfixes.emplace_back(std::move(*mpv_outfix));
mpv_outfix = nullptr; mpv_outfix = nullptr;
} }

View File

@ -212,7 +212,7 @@ void convertFloodProneSuffix(RoseBuildImpl &tbi, RoseVertex v, u32 lit_id,
// Apply the NFA. // Apply the NFA.
assert(!g[v].suffix); assert(!g[v].suffix);
g[v].suffix.graph = move(h); g[v].suffix.graph = std::move(h);
g[v].reports.clear(); g[v].reports.clear();
// Swap v's literal for a shorter one. // Swap v's literal for a shorter one.

View File

@ -464,7 +464,7 @@ void findFloodReach(const RoseBuildImpl &tbi, const RoseVertex v,
namespace { namespace {
struct LookProto { struct LookProto {
LookProto(s32 offset_in, CharReach reach_in) LookProto(s32 offset_in, CharReach reach_in)
: offset(offset_in), reach(move(reach_in)) {} : offset(offset_in), reach(std::move(reach_in)) {}
s32 offset; s32 offset;
CharReach reach; CharReach reach;
}; };

View File

@ -738,7 +738,7 @@ void addFragmentLiteral(const RoseBuildImpl &build, MatcherProto &mp,
const auto &groups = f.groups; const auto &groups = f.groups;
mp.lits.emplace_back(move(s_final), nocase, noruns, f.fragment_id, mp.lits.emplace_back(std::move(s_final), nocase, noruns, f.fragment_id,
groups, msk, cmp); groups, msk, cmp);
} }
@ -936,7 +936,7 @@ buildFloatingMatcherProto(const RoseBuildImpl &build,
throw CompileError("Unable to generate literal matcher proto."); throw CompileError("Unable to generate literal matcher proto.");
} }
return std::make_unique<LitProto>(move(proto), mp.accel_lits); return std::make_unique<LitProto>(std::move(proto), mp.accel_lits);
} }
unique_ptr<LitProto> unique_ptr<LitProto>
@ -964,7 +964,7 @@ buildDelayRebuildMatcherProto(const RoseBuildImpl &build,
throw CompileError("Unable to generate literal matcher proto."); throw CompileError("Unable to generate literal matcher proto.");
} }
return std::make_unique<LitProto>(move(proto), mp.accel_lits); return std::make_unique<LitProto>(std::move(proto), mp.accel_lits);
} }
unique_ptr<LitProto> unique_ptr<LitProto>
@ -1021,7 +1021,7 @@ buildSmallBlockMatcherProto(const RoseBuildImpl &build,
throw CompileError("Unable to generate literal matcher proto."); throw CompileError("Unable to generate literal matcher proto.");
} }
return std::make_unique<LitProto>(move(proto), mp.accel_lits); return std::make_unique<LitProto>(std::move(proto), mp.accel_lits);
} }
unique_ptr<LitProto> unique_ptr<LitProto>
@ -1046,7 +1046,7 @@ buildEodAnchoredMatcherProto(const RoseBuildImpl &build,
throw CompileError("Unable to generate literal matcher proto."); throw CompileError("Unable to generate literal matcher proto.");
} }
return std::make_unique<LitProto>(move(proto), mp.accel_lits); return std::make_unique<LitProto>(std::move(proto), mp.accel_lits);
} }
} // namespace ue2 } // namespace ue2

View File

@ -1442,7 +1442,7 @@ void mergeLeftfixesVariableLag(RoseBuildImpl &build) {
vector<vector<left_id>> chunks; vector<vector<left_id>> chunks;
for (auto &raw_group : engine_groups | map_values) { for (auto &raw_group : engine_groups | map_values) {
chunk(move(raw_group), &chunks, MERGE_GROUP_SIZE_MAX); chunk(std::move(raw_group), &chunks, MERGE_GROUP_SIZE_MAX);
} }
engine_groups.clear(); engine_groups.clear();
@ -1511,7 +1511,7 @@ namespace {
struct DedupeLeftKey { struct DedupeLeftKey {
DedupeLeftKey(const RoseBuildImpl &build, DedupeLeftKey(const RoseBuildImpl &build,
flat_set<pair<size_t, u32>> preds_in, const left_id &left) flat_set<pair<size_t, u32>> preds_in, const left_id &left)
: left_hash(hashLeftfix(left)), preds(move(preds_in)), : left_hash(hashLeftfix(left)), preds(std::move(preds_in)),
transient(contains(build.transient, left)) { transient(contains(build.transient, left)) {
} }
@ -1599,7 +1599,7 @@ void dedupeLeftfixesVariableLag(RoseBuildImpl &build) {
continue; continue;
} }
} }
engine_groups[DedupeLeftKey(build, move(preds), left)].emplace_back(left); engine_groups[DedupeLeftKey(build, std::move(preds), left)].emplace_back(left);
} }
/* We don't bother chunking as we expect deduping to be successful if the /* We don't bother chunking as we expect deduping to be successful if the
@ -2048,7 +2048,7 @@ void mergeCastleLeftfixes(RoseBuildImpl &build) {
vector<vector<left_id>> chunks; vector<vector<left_id>> chunks;
for (auto &raw_group : by_reach | map_values) { for (auto &raw_group : by_reach | map_values) {
chunk(move(raw_group), &chunks, MERGE_CASTLE_GROUP_SIZE_MAX); chunk(std::move(raw_group), &chunks, MERGE_CASTLE_GROUP_SIZE_MAX);
} }
by_reach.clear(); by_reach.clear();
@ -2429,7 +2429,7 @@ void pairwiseDfaMerge(vector<RawDfa *> &dfas,
RawDfa *dfa_ptr = rdfa.get(); RawDfa *dfa_ptr = rdfa.get();
dfa_mapping[dfa_ptr] = dfa_mapping[*it]; dfa_mapping[dfa_ptr] = dfa_mapping[*it];
dfa_mapping.erase(*it); dfa_mapping.erase(*it);
winner.proto = move(rdfa); winner.proto = std::move(rdfa);
mergeOutfixInfo(winner, victim); mergeOutfixInfo(winner, victim);
@ -2546,7 +2546,7 @@ void mergeOutfixCombo(RoseBuildImpl &tbi, const ReportManager &rm,
// Transform this outfix into a DFA and add it to the merge set. // Transform this outfix into a DFA and add it to the merge set.
dfa_mapping[rdfa.get()] = it - tbi.outfixes.begin(); dfa_mapping[rdfa.get()] = it - tbi.outfixes.begin();
dfas.emplace_back(rdfa.get()); dfas.emplace_back(rdfa.get());
outfix.proto = move(rdfa); outfix.proto = std::move(rdfa);
new_dfas++; new_dfas++;
} }
} }

View File

@ -135,7 +135,7 @@ RoseProgram::iterator RoseProgram::insert(RoseProgram::iterator it,
assert(it != end()); assert(it != end());
assert(prog.back()->code() == ROSE_INSTR_END); assert(prog.back()->code() == ROSE_INSTR_END);
return prog.insert(it, move(ri)); return prog.insert(it, std::move(ri));
} }
RoseProgram::iterator RoseProgram::insert(RoseProgram::iterator it, RoseProgram::iterator RoseProgram::insert(RoseProgram::iterator it,
@ -183,7 +183,7 @@ void RoseProgram::add_before_end(RoseProgram &&block) {
return; return;
} }
insert(prev(prog.end()), move(block)); insert(prev(prog.end()), std::move(block));
} }
void RoseProgram::add_block(RoseProgram &&block) { void RoseProgram::add_block(RoseProgram &&block) {
@ -209,7 +209,7 @@ void RoseProgram::replace(Iter it, std::unique_ptr<RoseInstruction> ri) {
assert(!prog.empty()); assert(!prog.empty());
const RoseInstruction *old_ptr = it->get(); const RoseInstruction *old_ptr = it->get();
*it = move(ri); *it = std::move(ri);
update_targets(prog.begin(), prog.end(), old_ptr, it->get()); update_targets(prog.begin(), prog.end(), old_ptr, it->get());
} }
@ -307,19 +307,19 @@ void addEnginesEodProgram(u32 eodNfaIterOffset, RoseProgram &program) {
RoseProgram block; RoseProgram block;
block.add_before_end(std::make_unique<RoseInstrEnginesEod>(eodNfaIterOffset)); block.add_before_end(std::make_unique<RoseInstrEnginesEod>(eodNfaIterOffset));
program.add_block(move(block)); program.add_block(std::move(block));
} }
void addSuffixesEodProgram(RoseProgram &program) { void addSuffixesEodProgram(RoseProgram &program) {
RoseProgram block; RoseProgram block;
block.add_before_end(std::make_unique<RoseInstrSuffixesEod>()); block.add_before_end(std::make_unique<RoseInstrSuffixesEod>());
program.add_block(move(block)); program.add_block(std::move(block));
} }
void addMatcherEodProgram(RoseProgram &program) { void addMatcherEodProgram(RoseProgram &program) {
RoseProgram block; RoseProgram block;
block.add_before_end(std::make_unique<RoseInstrMatcherEod>()); block.add_before_end(std::make_unique<RoseInstrMatcherEod>());
program.add_block(move(block)); program.add_block(std::move(block));
} }
void addFlushCombinationProgram(RoseProgram &program) { void addFlushCombinationProgram(RoseProgram &program) {
@ -359,7 +359,7 @@ void makeRoleCheckLeftfix(const RoseBuildImpl &build,
build.g[v].left.leftfix_report, build.g[v].left.leftfix_report,
end_inst); end_inst);
} }
program.add_before_end(move(ri)); program.add_before_end(std::move(ri));
} }
static static
@ -394,7 +394,7 @@ void makeAnchoredLiteralDelay(const RoseBuildImpl &build,
const auto *end_inst = program.end_instruction(); const auto *end_inst = program.end_instruction();
auto ri = std::make_unique<RoseInstrAnchoredDelay>(groups, anch_id, end_inst); auto ri = std::make_unique<RoseInstrAnchoredDelay>(groups, anch_id, end_inst);
program.add_before_end(move(ri)); program.add_before_end(std::move(ri));
} }
static static
@ -404,7 +404,7 @@ void makeDedupe(const ReportManager &rm, const Report &report,
auto ri = auto ri =
std::make_unique<RoseInstrDedupe>(report.quashSom, rm.getDkey(report), std::make_unique<RoseInstrDedupe>(report.quashSom, rm.getDkey(report),
report.offsetAdjust, end_inst); report.offsetAdjust, end_inst);
program.add_before_end(move(ri)); program.add_before_end(std::move(ri));
} }
static static
@ -414,7 +414,7 @@ void makeDedupeSom(const ReportManager &rm, const Report &report,
auto ri = std::make_unique<RoseInstrDedupeSom>(report.quashSom, auto ri = std::make_unique<RoseInstrDedupeSom>(report.quashSom,
rm.getDkey(report), rm.getDkey(report),
report.offsetAdjust, end_inst); report.offsetAdjust, end_inst);
program.add_before_end(move(ri)); program.add_before_end(std::move(ri));
} }
static static
@ -522,11 +522,11 @@ void addLogicalSetRequired(const Report &report, ReportManager &rm,
// set matching status of current lkey // set matching status of current lkey
auto risl = std::make_unique<RoseInstrSetLogical>(report.lkey, auto risl = std::make_unique<RoseInstrSetLogical>(report.lkey,
report.offsetAdjust); report.offsetAdjust);
program.add_before_end(move(risl)); program.add_before_end(std::move(risl));
// set current lkey's corresponding ckeys active, pending to check // set current lkey's corresponding ckeys active, pending to check
for (auto ckey : rm.getRelateCKeys(report.lkey)) { for (auto ckey : rm.getRelateCKeys(report.lkey)) {
auto risc = std::make_unique<RoseInstrSetCombination>(ckey); auto risc = std::make_unique<RoseInstrSetCombination>(ckey);
program.add_before_end(move(risc)); program.add_before_end(std::move(risc));
} }
} }
@ -543,14 +543,14 @@ void makeReport(const RoseBuildImpl &build, const ReportID id,
if (report.minOffset > 0 || report.maxOffset < MAX_OFFSET) { if (report.minOffset > 0 || report.maxOffset < MAX_OFFSET) {
auto ri = std::make_unique<RoseInstrCheckBounds>(report.minOffset, auto ri = std::make_unique<RoseInstrCheckBounds>(report.minOffset,
report.maxOffset, end_inst); report.maxOffset, end_inst);
report_block.add_before_end(move(ri)); report_block.add_before_end(std::move(ri));
} }
// If this report has an exhaustion key, we can check it in the program // If this report has an exhaustion key, we can check it in the program
// rather than waiting until we're in the callback adaptor. // rather than waiting until we're in the callback adaptor.
if (report.ekey != INVALID_EKEY) { if (report.ekey != INVALID_EKEY) {
auto ri = std::make_unique<RoseInstrCheckExhausted>(report.ekey, end_inst); auto ri = std::make_unique<RoseInstrCheckExhausted>(report.ekey, end_inst);
report_block.add_before_end(move(ri)); report_block.add_before_end(std::move(ri));
} }
// External SOM reports that aren't passthrough need their SOM value // External SOM reports that aren't passthrough need their SOM value
@ -559,7 +559,7 @@ void makeReport(const RoseBuildImpl &build, const ReportID id,
report.type != EXTERNAL_CALLBACK_SOM_PASS) { report.type != EXTERNAL_CALLBACK_SOM_PASS) {
auto ri = std::make_unique<RoseInstrSomFromReport>(); auto ri = std::make_unique<RoseInstrSomFromReport>();
writeSomOperation(report, &ri->som); writeSomOperation(report, &ri->som);
report_block.add_before_end(move(ri)); report_block.add_before_end(std::move(ri));
} }
// Min length constraint. // Min length constraint.
@ -567,7 +567,7 @@ void makeReport(const RoseBuildImpl &build, const ReportID id,
assert(build.hasSom); assert(build.hasSom);
auto ri = std::make_unique<RoseInstrCheckMinLength>( auto ri = std::make_unique<RoseInstrCheckMinLength>(
report.offsetAdjust, report.minLength, end_inst); report.offsetAdjust, report.minLength, end_inst);
report_block.add_before_end(move(ri)); report_block.add_before_end(std::move(ri));
} }
if (report.quashSom) { if (report.quashSom) {
@ -650,11 +650,11 @@ void makeReport(const RoseBuildImpl &build, const ReportID id,
if (has_som) { if (has_som) {
auto ri = std::make_unique<RoseInstrReportSomAware>(); auto ri = std::make_unique<RoseInstrReportSomAware>();
writeSomOperation(report, &ri->som); writeSomOperation(report, &ri->som);
report_block.add_before_end(move(ri)); report_block.add_before_end(std::move(ri));
} else { } else {
auto ri = std::make_unique<RoseInstrReportSomInt>(); auto ri = std::make_unique<RoseInstrReportSomInt>();
writeSomOperation(report, &ri->som); writeSomOperation(report, &ri->som);
report_block.add_before_end(move(ri)); report_block.add_before_end(std::move(ri));
} }
break; break;
case INTERNAL_ROSE_CHAIN: { case INTERNAL_ROSE_CHAIN: {
@ -715,7 +715,7 @@ void makeReport(const RoseBuildImpl &build, const ReportID id,
throw CompileError("Unable to generate bytecode."); throw CompileError("Unable to generate bytecode.");
} }
program.add_block(move(report_block)); program.add_block(std::move(report_block));
} }
static static
@ -745,7 +745,7 @@ void makeRoleReports(const RoseBuildImpl &build,
for (ReportID id : g[v].reports) { for (ReportID id : g[v].reports) {
makeReport(build, id, report_som, report_block); makeReport(build, id, report_som, report_block);
} }
program.add_before_end(move(report_block)); program.add_before_end(std::move(report_block));
} }
static static
@ -816,7 +816,7 @@ void makeCheckLiteralInstruction(const rose_literal_id &lit,
ri = std::make_unique<RoseInstrCheckMedLit>(lit.s.get_string(), ri = std::make_unique<RoseInstrCheckMedLit>(lit.s.get_string(),
end_inst); end_inst);
} }
program.add_before_end(move(ri)); program.add_before_end(std::move(ri));
return; return;
} }
@ -834,7 +834,7 @@ void makeCheckLiteralInstruction(const rose_literal_id &lit,
} else { } else {
ri = std::make_unique<RoseInstrCheckLongLit>(lit.s.get_string(), end_inst); ri = std::make_unique<RoseInstrCheckLongLit>(lit.s.get_string(), end_inst);
} }
program.add_before_end(move(ri)); program.add_before_end(std::move(ri));
} }
static static
@ -850,7 +850,7 @@ void makeRoleCheckNotHandled(ProgramBuild &prog_build, RoseVertex v,
const auto *end_inst = program.end_instruction(); const auto *end_inst = program.end_instruction();
auto ri = std::make_unique<RoseInstrCheckNotHandled>(handled_key, end_inst); auto ri = std::make_unique<RoseInstrCheckNotHandled>(handled_key, end_inst);
program.add_before_end(move(ri)); program.add_before_end(std::move(ri));
} }
static static
@ -979,7 +979,7 @@ bool makeRoleByte(const vector<LookEntry> &look, RoseProgram &program) {
const auto *end_inst = program.end_instruction(); const auto *end_inst = program.end_instruction();
auto ri = std::make_unique<RoseInstrCheckByte>(andmask_u8, cmpmask_u8, flip, auto ri = std::make_unique<RoseInstrCheckByte>(andmask_u8, cmpmask_u8, flip,
checkbyte_offset, end_inst); checkbyte_offset, end_inst);
program.add_before_end(move(ri)); program.add_before_end(std::move(ri));
return true; return true;
} }
return false; return false;
@ -1011,7 +1011,7 @@ bool makeRoleMask(const vector<LookEntry> &look, RoseProgram &program) {
const auto *end_inst = program.end_instruction(); const auto *end_inst = program.end_instruction();
auto ri = std::make_unique<RoseInstrCheckMask>(and_mask, cmp_mask, neg_mask, auto ri = std::make_unique<RoseInstrCheckMask>(and_mask, cmp_mask, neg_mask,
base_offset, end_inst); base_offset, end_inst);
program.add_before_end(move(ri)); program.add_before_end(std::move(ri));
return true; return true;
} }
return false; return false;
@ -1066,7 +1066,7 @@ bool makeRoleMask32(const vector<LookEntry> &look,
const auto *end_inst = program.end_instruction(); const auto *end_inst = program.end_instruction();
auto ri = std::make_unique<RoseInstrCheckMask32>(and_mask, cmp_mask, neg_mask, auto ri = std::make_unique<RoseInstrCheckMask32>(and_mask, cmp_mask, neg_mask,
base_offset, end_inst); base_offset, end_inst);
program.add_before_end(move(ri)); program.add_before_end(std::move(ri));
return true; return true;
} }
@ -1109,7 +1109,7 @@ bool makeRoleMask64(const vector<LookEntry> &look,
const auto *end_inst = program.end_instruction(); const auto *end_inst = program.end_instruction();
auto ri = std::make_unique<RoseInstrCheckMask64>(and_mask, cmp_mask, neg_mask, auto ri = std::make_unique<RoseInstrCheckMask64>(and_mask, cmp_mask, neg_mask,
base_offset, end_inst); base_offset, end_inst);
program.add_before_end(move(ri)); program.add_before_end(std::move(ri));
return true; return true;
} }
@ -1474,7 +1474,7 @@ bool makeRoleShufti(const vector<LookEntry> &look, RoseProgram &program,
} }
} }
assert(ri); assert(ri);
program.add_before_end(move(ri)); program.add_before_end(std::move(ri));
return true; return true;
} }
@ -1497,7 +1497,7 @@ void makeLookaroundInstruction(const vector<LookEntry> &look,
const CharReach &reach = look.begin()->reach; const CharReach &reach = look.begin()->reach;
auto ri = std::make_unique<RoseInstrCheckSingleLookaround>(offset, reach, auto ri = std::make_unique<RoseInstrCheckSingleLookaround>(offset, reach,
program.end_instruction()); program.end_instruction());
program.add_before_end(move(ri)); program.add_before_end(std::move(ri));
return; return;
} }
@ -1519,7 +1519,7 @@ void makeLookaroundInstruction(const vector<LookEntry> &look,
auto ri = std::make_unique<RoseInstrCheckLookaround>(look, auto ri = std::make_unique<RoseInstrCheckLookaround>(look,
program.end_instruction()); program.end_instruction());
program.add_before_end(move(ri)); program.add_before_end(std::move(ri));
} }
static static
@ -1774,7 +1774,7 @@ bool makeRoleMultipathShufti(const vector<vector<LookEntry>> &multi_look,
auto ri = std::make_unique<RoseInstrCheckMultipathShufti16x8> auto ri = std::make_unique<RoseInstrCheckMultipathShufti16x8>
(nib_mask, bucket_select_lo, data_select_mask, hi_bits_mask, (nib_mask, bucket_select_lo, data_select_mask, hi_bits_mask,
lo_bits_mask, neg_mask, base_offset, last_start, end_inst); lo_bits_mask, neg_mask, base_offset, last_start, end_inst);
program.add_before_end(move(ri)); program.add_before_end(std::move(ri));
} else if (multi_len == 32) { } else if (multi_len == 32) {
neg_mask &= 0xffffffff; neg_mask &= 0xffffffff;
assert(!(hi_bits_mask & ~0xffffffffULL)); assert(!(hi_bits_mask & ~0xffffffffULL));
@ -1784,20 +1784,20 @@ bool makeRoleMultipathShufti(const vector<vector<LookEntry>> &multi_look,
(hi_mask, lo_mask, bucket_select_lo, data_select_mask, (hi_mask, lo_mask, bucket_select_lo, data_select_mask,
hi_bits_mask, lo_bits_mask, neg_mask, base_offset, hi_bits_mask, lo_bits_mask, neg_mask, base_offset,
last_start, end_inst); last_start, end_inst);
program.add_before_end(move(ri)); program.add_before_end(std::move(ri));
} else { } else {
auto ri = std::make_unique<RoseInstrCheckMultipathShufti32x16> auto ri = std::make_unique<RoseInstrCheckMultipathShufti32x16>
(hi_mask, lo_mask, bucket_select_hi, bucket_select_lo, (hi_mask, lo_mask, bucket_select_hi, bucket_select_lo,
data_select_mask, hi_bits_mask, lo_bits_mask, neg_mask, data_select_mask, hi_bits_mask, lo_bits_mask, neg_mask,
base_offset, last_start, end_inst); base_offset, last_start, end_inst);
program.add_before_end(move(ri)); program.add_before_end(std::move(ri));
} }
} else { } else {
auto ri = std::make_unique<RoseInstrCheckMultipathShufti64> auto ri = std::make_unique<RoseInstrCheckMultipathShufti64>
(hi_mask, lo_mask, bucket_select_lo, data_select_mask, (hi_mask, lo_mask, bucket_select_lo, data_select_mask,
hi_bits_mask, lo_bits_mask, neg_mask, base_offset, hi_bits_mask, lo_bits_mask, neg_mask, base_offset,
last_start, end_inst); last_start, end_inst);
program.add_before_end(move(ri)); program.add_before_end(std::move(ri));
} }
return true; return true;
} }
@ -1865,10 +1865,10 @@ void makeRoleMultipathLookaround(const vector<vector<LookEntry>> &multi_look,
ordered_look.emplace_back(multi_entry); ordered_look.emplace_back(multi_entry);
} }
auto ri = std::make_unique<RoseInstrMultipathLookaround>(move(ordered_look), auto ri = std::make_unique<RoseInstrMultipathLookaround>(std::move(ordered_look),
last_start, start_mask, last_start, start_mask,
program.end_instruction()); program.end_instruction());
program.add_before_end(move(ri)); program.add_before_end(std::move(ri));
} }
static static
@ -1893,7 +1893,7 @@ void makeRoleLookaround(const RoseBuildImpl &build,
vector<LookEntry> look; vector<LookEntry> look;
vector<LookEntry> look_more; vector<LookEntry> look_more;
if (!looks.empty()) { if (!looks.empty()) {
look = move(looks.front()); look = std::move(looks.front());
} }
findLookaroundMasks(build, v, look_more); findLookaroundMasks(build, v, look_more);
mergeLookaround(look, look_more); mergeLookaround(look, look_more);
@ -2001,7 +2001,7 @@ void makeRoleInfixTriggers(const RoseBuildImpl &build,
triggers.emplace_back(g[e].rose_cancel_prev_top, lbi.queue, top); triggers.emplace_back(g[e].rose_cancel_prev_top, lbi.queue, top);
} }
addInfixTriggerInstructions(move(triggers), program); addInfixTriggerInstructions(std::move(triggers), program);
} }
@ -2063,7 +2063,7 @@ void makeRoleEagerEodReports(const RoseBuildImpl &build,
RoseProgram block; RoseProgram block;
makeRoleReports(build, leftfix_info, needs_catchup, makeRoleReports(build, leftfix_info, needs_catchup,
target(e, build.g), block); target(e, build.g), block);
eod_program.add_block(move(block)); eod_program.add_block(std::move(block));
} }
} }
@ -2077,7 +2077,7 @@ void makeRoleEagerEodReports(const RoseBuildImpl &build,
addCheckOnlyEodInstruction(program); addCheckOnlyEodInstruction(program);
} }
program.add_before_end(move(eod_program)); program.add_before_end(std::move(eod_program));
} }
/** Makes a program for a role/vertex given a specific pred/in_edge. */ /** Makes a program for a role/vertex given a specific pred/in_edge. */
@ -2124,33 +2124,33 @@ RoseProgram makeRoleProgram(const RoseBuildImpl &build,
RoseProgram reports_block; RoseProgram reports_block;
makeRoleReports(build, leftfix_info, prog_build.needs_catchup, v, makeRoleReports(build, leftfix_info, prog_build.needs_catchup, v,
reports_block); reports_block);
effects_block.add_block(move(reports_block)); effects_block.add_block(std::move(reports_block));
RoseProgram infix_block; RoseProgram infix_block;
makeRoleInfixTriggers(build, leftfix_info, engine_info_by_queue, v, makeRoleInfixTriggers(build, leftfix_info, engine_info_by_queue, v,
infix_block); infix_block);
effects_block.add_block(move(infix_block)); effects_block.add_block(std::move(infix_block));
// Note: SET_GROUPS instruction must be after infix triggers, as an infix // Note: SET_GROUPS instruction must be after infix triggers, as an infix
// going dead may switch off groups. // going dead may switch off groups.
RoseProgram groups_block; RoseProgram groups_block;
makeRoleGroups(build.g, prog_build, v, groups_block); makeRoleGroups(build.g, prog_build, v, groups_block);
effects_block.add_block(move(groups_block)); effects_block.add_block(std::move(groups_block));
RoseProgram suffix_block; RoseProgram suffix_block;
makeRoleSuffix(build, suffixes, engine_info_by_queue, v, suffix_block); makeRoleSuffix(build, suffixes, engine_info_by_queue, v, suffix_block);
effects_block.add_block(move(suffix_block)); effects_block.add_block(std::move(suffix_block));
RoseProgram state_block; RoseProgram state_block;
makeRoleSetState(roleStateIndices, v, state_block); makeRoleSetState(roleStateIndices, v, state_block);
effects_block.add_block(move(state_block)); effects_block.add_block(std::move(state_block));
// Note: EOD eager reports may generate a CHECK_ONLY_EOD instruction (if // Note: EOD eager reports may generate a CHECK_ONLY_EOD instruction (if
// the program doesn't have one already). // the program doesn't have one already).
RoseProgram eod_block; RoseProgram eod_block;
makeRoleEagerEodReports(build, leftfix_info, prog_build.needs_catchup, v, makeRoleEagerEodReports(build, leftfix_info, prog_build.needs_catchup, v,
eod_block); eod_block);
effects_block.add_block(move(eod_block)); effects_block.add_block(std::move(eod_block));
/* a 'ghost role' may do nothing if we know that its groups are already set /* a 'ghost role' may do nothing if we know that its groups are already set
* - in this case we can avoid producing a program at all. */ * - in this case we can avoid producing a program at all. */
@ -2158,7 +2158,7 @@ RoseProgram makeRoleProgram(const RoseBuildImpl &build,
return {}; return {};
} }
program.add_before_end(move(effects_block)); program.add_before_end(std::move(effects_block));
return program; return program;
} }
@ -2204,7 +2204,7 @@ RoseProgram assembleProgramBlocks(vector<RoseProgram> &&blocks_in) {
continue; continue;
} }
blocks.emplace_back(move(block)); blocks.emplace_back(std::move(block));
seen.emplace(blocks.back()); seen.emplace(blocks.back());
} }
@ -2219,10 +2219,10 @@ RoseProgram assembleProgramBlocks(vector<RoseProgram> &&blocks_in) {
if (!prog.empty() && reads_work_done_flag(block)) { if (!prog.empty() && reads_work_done_flag(block)) {
RoseProgram clear_block; RoseProgram clear_block;
clear_block.add_before_end(std::make_unique<RoseInstrClearWorkDone>()); clear_block.add_before_end(std::make_unique<RoseInstrClearWorkDone>());
prog.add_block(move(clear_block)); prog.add_block(std::move(clear_block));
} }
prog.add_block(move(block)); prog.add_block(std::move(block));
} }
return prog; return prog;
@ -2265,7 +2265,7 @@ RoseProgram makeLiteralProgram(const RoseBuildImpl &build,
engine_info_by_queue, roleStateIndices, engine_info_by_queue, roleStateIndices,
prog_build, e); prog_build, e);
if (!role_prog.empty()) { if (!role_prog.empty()) {
pred_blocks[pred_state].add_block(move(role_prog)); pred_blocks[pred_state].add_block(std::move(role_prog));
} }
} }
@ -2284,7 +2284,7 @@ RoseProgram makeLiteralProgram(const RoseBuildImpl &build,
auto role_prog = makeRoleProgram(build, leftfix_info, suffixes, auto role_prog = makeRoleProgram(build, leftfix_info, suffixes,
engine_info_by_queue, roleStateIndices, engine_info_by_queue, roleStateIndices,
prog_build, e); prog_build, e);
role_programs.add_block(move(role_prog)); role_programs.add_block(std::move(role_prog));
} }
if (lit_id == build.eod_event_literal_id) { if (lit_id == build.eod_event_literal_id) {
@ -2299,8 +2299,8 @@ RoseProgram makeLiteralProgram(const RoseBuildImpl &build,
// Literal may squash groups. // Literal may squash groups.
makeGroupSquashInstruction(build, lit_id, unconditional_block); makeGroupSquashInstruction(build, lit_id, unconditional_block);
role_programs.add_block(move(unconditional_block)); role_programs.add_block(std::move(unconditional_block));
lit_program.add_before_end(move(role_programs)); lit_program.add_before_end(std::move(role_programs));
return lit_program; return lit_program;
} }
@ -2331,10 +2331,10 @@ RoseProgram makeDelayRebuildProgram(const RoseBuildImpl &build,
makePushDelayedInstructions(build.literals, prog_build, makePushDelayedInstructions(build.literals, prog_build,
build.literal_info.at(lit_id).delayed_ids, build.literal_info.at(lit_id).delayed_ids,
prog); prog);
blocks.emplace_back(move(prog)); blocks.emplace_back(std::move(prog));
} }
return assembleProgramBlocks(move(blocks)); return assembleProgramBlocks(std::move(blocks));
} }
RoseProgram makeEodAnchorProgram(const RoseBuildImpl &build, RoseProgram makeEodAnchorProgram(const RoseBuildImpl &build,
@ -2361,7 +2361,7 @@ RoseProgram makeEodAnchorProgram(const RoseBuildImpl &build,
for (const auto &id : g[v].reports) { for (const auto &id : g[v].reports) {
makeReport(build, id, has_som, report_block); makeReport(build, id, has_som, report_block);
} }
program.add_before_end(move(report_block)); program.add_before_end(std::move(report_block));
return program; return program;
} }
@ -2413,7 +2413,7 @@ void addIncludedJumpProgram(RoseProgram &program, u32 child_offset,
RoseProgram block; RoseProgram block;
block.add_before_end(std::make_unique<RoseInstrIncludedJump>(child_offset, block.add_before_end(std::make_unique<RoseInstrIncludedJump>(child_offset,
squash)); squash));
program.add_block(move(block)); program.add_block(std::move(block));
} }
static static
@ -2423,7 +2423,7 @@ void addPredBlockSingle(u32 pred_state, RoseProgram &pred_block,
const auto *end_inst = pred_block.end_instruction(); const auto *end_inst = pred_block.end_instruction();
pred_block.insert(begin(pred_block), pred_block.insert(begin(pred_block),
std::make_unique<RoseInstrCheckState>(pred_state, end_inst)); std::make_unique<RoseInstrCheckState>(pred_state, end_inst));
program.add_block(move(pred_block)); program.add_block(std::move(pred_block));
} }
static static
@ -2438,7 +2438,7 @@ void addPredBlocksAny(map<u32, RoseProgram> &pred_blocks, u32 num_states,
const RoseInstruction *end_inst = sparse_program.end_instruction(); const RoseInstruction *end_inst = sparse_program.end_instruction();
auto ri = std::make_unique<RoseInstrSparseIterAny>(num_states, keys, end_inst); auto ri = std::make_unique<RoseInstrSparseIterAny>(num_states, keys, end_inst);
sparse_program.add_before_end(move(ri)); sparse_program.add_before_end(std::move(ri));
RoseProgram &block = pred_blocks.begin()->second; RoseProgram &block = pred_blocks.begin()->second;
@ -2446,8 +2446,8 @@ void addPredBlocksAny(map<u32, RoseProgram> &pred_blocks, u32 num_states,
* blocks are being collapsed together */ * blocks are being collapsed together */
stripCheckHandledInstruction(block); stripCheckHandledInstruction(block);
sparse_program.add_before_end(move(block)); sparse_program.add_before_end(std::move(block));
program.add_block(move(sparse_program)); program.add_block(std::move(sparse_program));
} }
static static
@ -2462,14 +2462,14 @@ void addPredBlocksMulti(map<u32, RoseProgram> &pred_blocks,
// BEGIN instruction. // BEGIN instruction.
auto ri_begin = std::make_unique<RoseInstrSparseIterBegin>(num_states, end_inst); auto ri_begin = std::make_unique<RoseInstrSparseIterBegin>(num_states, end_inst);
RoseInstrSparseIterBegin *begin_inst = ri_begin.get(); RoseInstrSparseIterBegin *begin_inst = ri_begin.get();
sparse_program.add_before_end(move(ri_begin)); sparse_program.add_before_end(std::move(ri_begin));
// NEXT instructions, one per pred program. // NEXT instructions, one per pred program.
u32 prev_key = pred_blocks.begin()->first; u32 prev_key = pred_blocks.begin()->first;
for (auto it = next(begin(pred_blocks)); it != end(pred_blocks); ++it) { for (auto it = next(begin(pred_blocks)); it != end(pred_blocks); ++it) {
auto ri = std::make_unique<RoseInstrSparseIterNext>(prev_key, begin_inst, auto ri = std::make_unique<RoseInstrSparseIterNext>(prev_key, begin_inst,
end_inst); end_inst);
sparse_program.add_before_end(move(ri)); sparse_program.add_before_end(std::move(ri));
prev_key = it->first; prev_key = it->first;
} }
@ -2483,7 +2483,7 @@ void addPredBlocksMulti(map<u32, RoseProgram> &pred_blocks,
assert(dynamic_cast<const RoseInstrSparseIterBegin *>(out_it->get()) || assert(dynamic_cast<const RoseInstrSparseIterBegin *>(out_it->get()) ||
dynamic_cast<const RoseInstrSparseIterNext *>(out_it->get())); dynamic_cast<const RoseInstrSparseIterNext *>(out_it->get()));
out_it = sparse_program.insert(++out_it, move(flat_prog)); out_it = sparse_program.insert(++out_it, std::move(flat_prog));
// Jump table target for this key is the beginning of the block we just // Jump table target for this key is the beginning of the block we just
// spliced in. // spliced in.
@ -2495,9 +2495,9 @@ void addPredBlocksMulti(map<u32, RoseProgram> &pred_blocks,
} }
// Write the jump table back into the SPARSE_ITER_BEGIN instruction. // Write the jump table back into the SPARSE_ITER_BEGIN instruction.
begin_inst->jump_table = move(jump_table); begin_inst->jump_table = std::move(jump_table);
program.add_block(move(sparse_program)); program.add_block(std::move(sparse_program));
} }
void addPredBlocks(map<u32, RoseProgram> &pred_blocks, u32 num_states, void addPredBlocks(map<u32, RoseProgram> &pred_blocks, u32 num_states,

View File

@ -242,7 +242,7 @@ u32 SomSlotManager::numSomSlots() const {
u32 SomSlotManager::addRevNfa(bytecode_ptr<NFA> nfa, u32 maxWidth) { u32 SomSlotManager::addRevNfa(bytecode_ptr<NFA> nfa, u32 maxWidth) {
u32 rv = verify_u32(rev_nfas.size()); u32 rv = verify_u32(rev_nfas.size());
rev_nfas.emplace_back(move(nfa)); rev_nfas.emplace_back(std::move(nfa));
// A rev nfa commits us to having enough history around to handle its // A rev nfa commits us to having enough history around to handle its
// max width. // max width.

View File

@ -41,5 +41,17 @@
#define VECTORSIZE 16 #define VECTORSIZE 16
#endif #endif
#if defined(__ARM_FEATURE_SVE)
#define HAVE_SVE
#endif
#if defined(__ARM_FEATURE_SVE2)
#define HAVE_SVE2
#endif
#if defined(__ARM_FEATURE_SVE2_BITPERM)
#define HAVE_SVE2_BITPERM
#endif
#endif // UTIL_ARCH_ARM_H_ #endif // UTIL_ARCH_ARM_H_

View File

@ -32,6 +32,11 @@
#if defined(__linux__) #if defined(__linux__)
#include <sys/auxv.h> #include <sys/auxv.h>
/* This is to help fix https://github.com/envoyproxy/envoy/pull/29881
*/
#if !defined(HWCAP2_SVE2)
#include <asm/hwcap.h>
#endif
#endif #endif
#include "ue2common.h" #include "ue2common.h"

View File

@ -0,0 +1,41 @@
/*
* Copyright (c) 2015-2017, Intel Corporation
* Copyright (c) 2020-2023, VectorCamp PC
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "util/arch/common/cpuid_flags.h"
#include "ue2common.h"
#include "hs_compile.h" // for HS_MODE_ flags
#include "util/arch.h"
u64a cpuid_flags(void) {
return 0;
}
u32 cpuid_tune(void) {
return HS_TUNE_FAMILY_GENERIC;
}

View File

@ -43,6 +43,11 @@
#include <string.h> // for memcpy #include <string.h> // for memcpy
#if defined(__clang__) && (__clang_major__ == 15)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecate-lax-vec-conv-all"
#endif // defined(__clang__) && (__clang_major__ == 15)
typedef __vector unsigned long long int uint64x2_t; typedef __vector unsigned long long int uint64x2_t;
typedef __vector signed long long int int64x2_t; typedef __vector signed long long int int64x2_t;
typedef __vector unsigned int uint32x4_t; typedef __vector unsigned int uint32x4_t;
@ -124,8 +129,8 @@ static really_really_inline
m128 rshift_m128(m128 a, unsigned b) { m128 rshift_m128(m128 a, unsigned b) {
if (b == 0) return a; if (b == 0) return a;
m128 sl = (m128) vec_splats((uint8_t) b << 3); m128 sl = (m128) vec_splats((uint8_t) b << 3);
m128 result = (m128) vec_sro((uint8x16_t) a, (uint8x16_t) sl); uint8x16_t result = vec_sro((uint8x16_t) a, (uint8x16_t) sl);
return result; return (m128) result;
} }
static really_really_inline static really_really_inline
@ -420,4 +425,8 @@ m128 set2x64(u64a hi, u64a lo) {
return (m128) v; return (m128) v;
} }
#if defined(__clang__) && (__clang_major__ == 15)
#pragma clang diagnostic pop
#endif // defined(__clang__) && (__clang_major__ == 15)
#endif // ARCH_PPC64EL_SIMD_UTILS_H #endif // ARCH_PPC64EL_SIMD_UTILS_H

View File

@ -74,7 +74,7 @@ vector<u32> findCliqueGroup(CliqueGraph &cg) {
// Get the vertex to start from // Get the vertex to start from
vector<u32> clique; vector<u32> clique;
while (!gStack.empty()) { while (!gStack.empty()) {
vector<u32> g = move(gStack.top()); vector<u32> g = std::move(gStack.top());
gStack.pop(); gStack.pop();
// Choose a vertex from the graph // Choose a vertex from the graph

View File

@ -158,18 +158,25 @@ really_inline SuperVector<16>::SuperVector(uint32_t const other)
u.u32x4[0] = vec_splats(static_cast<uint32_t>(other)); u.u32x4[0] = vec_splats(static_cast<uint32_t>(other));
} }
#if defined(__clang__) && (__clang_major__ >= 15)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecate-lax-vec-conv-all"
#endif // defined(__clang__) && (__clang_major__ == 15)
template<> template<>
template<> template<>
really_inline SuperVector<16>::SuperVector(int64_t const other) really_inline SuperVector<16>::SuperVector(int64_t const other)
{ {
u.s64x2[0] = (int64x2_t) vec_splats(static_cast<ulong64_t>(other)); u.s64x2[0] = reinterpret_cast<int64x2_t>(vec_splats(static_cast<ulong64_t>(other)));
} }
#if defined(__clang__) && (__clang_major__ >= 15)
#pragma clang diagnostic pop
#endif // defined(__clang__) && (__clang_major__ == 15)
template<> template<>
template<> template<>
really_inline SuperVector<16>::SuperVector(uint64_t const other) really_inline SuperVector<16>::SuperVector(uint64_t const other)
{ {
u.u64x2[0] = (uint64x2_t) vec_splats(static_cast<ulong64_t>(other)); u.u64x2[0] = reinterpret_cast<uint64x2_t>(vec_splats(static_cast<ulong64_t>(other)));
} }
// Constants // Constants
@ -266,6 +273,10 @@ really_inline SuperVector<16> SuperVector<16>::eq(SuperVector<16> const &b) cons
return (*this == b); return (*this == b);
} }
#if defined(__clang__) && (__clang_major__ >= 15)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecate-lax-vec-conv-all"
#endif // defined(__clang__) && (__clang_major__ == 15)
template <> template <>
really_inline typename SuperVector<16>::comparemask_type really_inline typename SuperVector<16>::comparemask_type
SuperVector<16>::comparemask(void) const { SuperVector<16>::comparemask(void) const {
@ -273,9 +284,12 @@ SuperVector<16>::comparemask(void) const {
uint8x16_t bitmask = vec_gb(u.u8x16[0]); uint8x16_t bitmask = vec_gb(u.u8x16[0]);
bitmask = (uint8x16_t) vec_perm(vec_splat_u8(0), bitmask, perm); bitmask = (uint8x16_t) vec_perm(vec_splat_u8(0), bitmask, perm);
u32 ALIGN_ATTR(16) movemask; u32 ALIGN_ATTR(16) movemask;
vec_ste((uint32x4_t) bitmask, 0, &movemask); vec_ste(reinterpret_cast<uint32x4_t>(bitmask), 0, &movemask);
return movemask; return movemask;
} }
#if defined(__clang__) && (__clang_major__ >= 15)
#pragma clang diagnostic pop
#endif // defined(__clang__) && (__clang_major__ == 15)
template <> template <>
really_inline typename SuperVector<16>::comparemask_type really_inline typename SuperVector<16>::comparemask_type

View File

@ -1145,7 +1145,7 @@ really_inline SuperVector<32> SuperVector<32>::loadu_maskz(void const *ptr, uint
template<> template<>
really_inline SuperVector<32> SuperVector<32>::alignr(SuperVector<32> &other, int8_t offset) really_inline SuperVector<32> SuperVector<32>::alignr(SuperVector<32> &other, int8_t offset)
{ {
#if defined(HAVE__BUILTIN_CONSTANT_P) #if defined(HAVE__BUILTIN_CONSTANT_P) && !(defined(__GNUC__) && (__GNUC__ == 13))
if (__builtin_constant_p(offset)) { if (__builtin_constant_p(offset)) {
if (offset == 16) { if (offset == 16) {
return *this; return *this;

View File

@ -174,7 +174,7 @@ unique_ptr<EngineStream> EngineHyperscan::streamOpen(EngineContext &ectx,
return nullptr; return nullptr;
} }
stream->sn = streamId; stream->sn = streamId;
return move(stream); return std::move(stream);
} }
void EngineHyperscan::streamClose(unique_ptr<EngineStream> stream, void EngineHyperscan::streamClose(unique_ptr<EngineStream> stream,

View File

@ -111,7 +111,7 @@ public:
thread_barrier &tb_in, thread_func_t function_in, thread_barrier &tb_in, thread_func_t function_in,
vector<DataBlock> corpus_data_in) vector<DataBlock> corpus_data_in)
: num(num_in), results(repeats), engine(db_in), : num(num_in), results(repeats), engine(db_in),
enginectx(db_in.makeContext()), corpus_data(move(corpus_data_in)), enginectx(db_in.makeContext()), corpus_data(std::move(corpus_data_in)),
tb(tb_in), function(function_in) {} tb(tb_in), function(function_in) {}
// Start the thread. // Start the thread.
@ -219,7 +219,7 @@ void usage(const char *error) {
/** Wraps up a name and the set of signature IDs it refers to. */ /** Wraps up a name and the set of signature IDs it refers to. */
struct BenchmarkSigs { struct BenchmarkSigs {
BenchmarkSigs(string name_in, SignatureSet sigs_in) BenchmarkSigs(string name_in, SignatureSet sigs_in)
: name(move(name_in)), sigs(move(sigs_in)) {} : name(std::move(name_in)), sigs(std::move(sigs_in)) {}
string name; string name;
SignatureSet sigs; SignatureSet sigs;
}; };
@ -457,7 +457,7 @@ void processArgs(int argc, char *argv[], vector<BenchmarkSigs> &sigSets,
for (const auto &file : sigFiles) { for (const auto &file : sigFiles) {
SignatureSet sigs; SignatureSet sigs;
loadSignatureList(file, sigs); loadSignatureList(file, sigs);
sigSets.emplace_back(file, move(sigs)); sigSets.emplace_back(file, std::move(sigs));
} }
useLiteralApi = (bool)literalFlag; useLiteralApi = (bool)literalFlag;
@ -590,7 +590,7 @@ void benchStreamingInternal(ThreadContext *ctx, vector<StreamInfo> &streams,
// if this was the last block in the stream, close the stream handle // if this was the last block in the stream, close the stream handle
if (b.id == stream.last_block_id) { if (b.id == stream.last_block_id) {
e.streamClose(move(stream.eng_handle), r); e.streamClose(std::move(stream.eng_handle), r);
stream.eng_handle = nullptr; stream.eng_handle = nullptr;
} }
} }
@ -963,7 +963,7 @@ void runBenchmark(const Engine &db,
printf("Unable to start processing thread %u\n", i); printf("Unable to start processing thread %u\n", i);
exit(1); exit(1);
} }
threads.push_back(move(t)); threads.push_back(std::move(t));
} }
// Reap threads. // Reap threads.
@ -1011,7 +1011,7 @@ int HS_CDECL main(int argc, char *argv[]) {
for (auto i : exprMapTemplate | map_keys) { for (auto i : exprMapTemplate | map_keys) {
sigs.push_back(i); sigs.push_back(i);
} }
sigSets.emplace_back(exprPath, move(sigs)); sigSets.emplace_back(exprPath, std::move(sigs));
} }
// read in and process our corpus // read in and process our corpus

View File

@ -17,7 +17,7 @@ CHECK_FUNCTION_EXISTS(sigaction HAVE_SIGACTION)
CHECK_FUNCTION_EXISTS(setrlimit HAVE_SETRLIMIT) CHECK_FUNCTION_EXISTS(setrlimit HAVE_SETRLIMIT)
set_source_files_properties( set_source_files_properties(
${CMAKE_CURRENT_BINARY_DIR}/ColliderCorporaParser.cpp ColliderCorporaParser.cpp
PROPERTIES PROPERTIES
COMPILE_FLAGS "${RAGEL_C_FLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}") COMPILE_FLAGS "${RAGEL_C_FLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}")

View File

@ -133,7 +133,7 @@ void CNGInfo::compile() {
auto pl = std::make_unique<ParsedLogical>(); auto pl = std::make_unique<ParsedLogical>();
pl->parseLogicalCombination(id, re.c_str(), ~0U, 0, ~0ULL); pl->parseLogicalCombination(id, re.c_str(), ~0U, 0, ~0ULL);
pl->logicalKeyRenumber(); pl->logicalKeyRenumber();
cng = make_unique<CompiledNG>(move(pl)); cng = make_unique<CompiledNG>(std::move(pl));
return; return;
} }
@ -192,7 +192,7 @@ void CNGInfo::compile() {
} }
} }
cng = make_unique<CompiledNG>(move(g), move(rm)); cng = make_unique<CompiledNG>(std::move(g), std::move(rm));
} catch (CompileError &e) { } catch (CompileError &e) {
throw NGCompileFailure(e.reason); throw NGCompileFailure(e.reason);
} catch (NGUnsupportedFailure &e) { } catch (NGUnsupportedFailure &e) {

View File

@ -107,7 +107,7 @@ void NfaGeneratedCorpora::generate(unsigned id, vector<Corpus> &data) {
a_subid = it.first; a_subid = it.first;
vector<Corpus> sub_data; vector<Corpus> sub_data;
generate(a_subid, sub_data); generate(a_subid, sub_data);
m_data.emplace(a_subid, move(sub_data)); m_data.emplace(a_subid, std::move(sub_data));
} }
assert(!m_data.empty()); assert(!m_data.empty());
size_t num_corpus = m_data[a_subid].size(); size_t num_corpus = m_data[a_subid].size();

View File

@ -1079,7 +1079,7 @@ shared_ptr<BaseDB> UltimateTruth::compile(const set<unsigned> &ids,
} }
} }
return move(db); return std::move(db);
} }
bool UltimateTruth::allocScratch(shared_ptr<const BaseDB> db) { bool UltimateTruth::allocScratch(shared_ptr<const BaseDB> db) {

View File

@ -1188,7 +1188,7 @@ struct CorpusGenUnit {
CorpusGenUnit(unique_ptr<CNGInfo> cngi_in, unique_ptr<CompiledPcre> pcre_in, CorpusGenUnit(unique_ptr<CNGInfo> cngi_in, unique_ptr<CompiledPcre> pcre_in,
shared_ptr<DatabaseProxy> ue2_in, unsigned expr_id, shared_ptr<DatabaseProxy> ue2_in, unsigned expr_id,
bool multi_in, bool utf8_in) bool multi_in, bool utf8_in)
: cngi(move(cngi_in)), pcre(move(pcre_in)), ue2(ue2_in), id(expr_id), : cngi(std::move(cngi_in)), pcre(std::move(pcre_in)), ue2(ue2_in), id(expr_id),
multi(multi_in), utf8(utf8_in) {} multi(multi_in), utf8(utf8_in) {}
unique_ptr<CNGInfo> cngi; unique_ptr<CNGInfo> cngi;
@ -1220,7 +1220,7 @@ public:
} }
addCorporaToQueue(out, testq, c->id, *corpora, summary, addCorporaToQueue(out, testq, c->id, *corpora, summary,
move(c->pcre), move(c->cngi), c->ue2, c->multi, std::move(c->pcre), std::move(c->cngi), c->ue2, c->multi,
c->utf8); c->utf8);
count++; count++;
@ -1434,7 +1434,7 @@ unique_ptr<CorpusGenUnit> makeCorpusGenUnit(unsigned id, TestSummary &summary,
// Caller may already have set the UTF-8 property (in multi cases) // Caller may already have set the UTF-8 property (in multi cases)
utf8 |= cpcre ? cpcre->utf8 : cngi->utf8; utf8 |= cpcre ? cpcre->utf8 : cngi->utf8;
return std::make_unique<CorpusGenUnit>(move(cngi), move(cpcre), ue2, id, return std::make_unique<CorpusGenUnit>(std::move(cngi), std::move(cpcre), ue2, id,
multi, utf8); multi, utf8);
} }
@ -1489,7 +1489,7 @@ void buildSingle(BoundedQueue<CorpusGenUnit> &corpq, TestSummary &summary,
auto u = makeCorpusGenUnit(id, summary, ground, graph, ultimate, ue2, auto u = makeCorpusGenUnit(id, summary, ground, graph, ultimate, ue2,
multi, utf8); multi, utf8);
if (u) { if (u) {
corpq.push(move(u)); corpq.push(std::move(u));
} }
} }
} }
@ -1547,7 +1547,7 @@ void buildBanded(BoundedQueue<CorpusGenUnit> &corpq, TestSummary &summary,
auto u = makeCorpusGenUnit(id, summary, ground, graph, ultimate, auto u = makeCorpusGenUnit(id, summary, ground, graph, ultimate,
ue2, multi, utf8); ue2, multi, utf8);
if (u) { if (u) {
corpq.push(move(u)); corpq.push(std::move(u));
} }
} }
} }
@ -1587,7 +1587,7 @@ void buildMulti(BoundedQueue<CorpusGenUnit> &corpq, TestSummary &summary,
auto u = makeCorpusGenUnit(id, summary, ground, graph, ultimate, ue2, auto u = makeCorpusGenUnit(id, summary, ground, graph, ultimate, ue2,
multi, utf8); multi, utf8);
if (u) { if (u) {
corpq.push(move(u)); corpq.push(std::move(u));
} }
} }
} }
@ -1607,7 +1607,7 @@ void generateTests(CorporaSource &corpora_src, const ExpressionMap &exprMap,
for (size_t i = 0; i < numGeneratorThreads; i++) { for (size_t i = 0; i < numGeneratorThreads; i++) {
auto c = make_unique<CorpusGenThread>(i, testq, corpq, corpora_src); auto c = make_unique<CorpusGenThread>(i, testq, corpq, corpora_src);
c->start(); c->start();
generators.push_back(move(c)); generators.push_back(std::move(c));
} }
if (g_ue2CompileAll && multicompile_bands) { if (g_ue2CompileAll && multicompile_bands) {
@ -1830,11 +1830,11 @@ unique_ptr<CorporaSource> buildCorpora(const vector<string> &corporaFiles,
exit_with_fail(); exit_with_fail();
} }
} }
return move(c); /* move allows unique_ptr<CorporaSource> conversion */ return std::move(c); /* move allows unique_ptr<CorporaSource> conversion */
} else { } else {
auto c = std::make_unique<NfaGeneratedCorpora>( auto c = std::make_unique<NfaGeneratedCorpora>(
exprMap, corpus_gen_prop, force_utf8, force_prefilter); exprMap, corpus_gen_prop, force_utf8, force_prefilter);
return move(c); return std::move(c);
} }
} }
@ -1883,7 +1883,7 @@ bool runTests(CorporaSource &corpora_source, const ExpressionMap &exprMap,
for (size_t i = 0; i < numScannerThreads; i++) { for (size_t i = 0; i < numScannerThreads; i++) {
auto s = std::make_unique<ScanThread>(i, testq, exprMap, plat, grey); auto s = std::make_unique<ScanThread>(i, testq, exprMap, plat, grey);
s->start(); s->start();
scanners.push_back(move(s)); scanners.push_back(std::move(s));
} }
generateTests(corpora_source, exprMap, summary, plat, grey, testq); generateTests(corpora_source, exprMap, summary, plat, grey, testq);

View File

@ -56,14 +56,9 @@ set(unit_hyperscan_SOURCES
hyperscan/test_util.h hyperscan/test_util.h
) )
add_executable(unit-hyperscan ${unit_hyperscan_SOURCES}) add_executable(unit-hyperscan ${unit_hyperscan_SOURCES})
if (BUILD_STATIC_AND_SHARED OR BUILD_SHARED_LIBS)
target_link_libraries(unit-hyperscan hs_shared expressionutil)
else()
target_link_libraries(unit-hyperscan hs expressionutil) target_link_libraries(unit-hyperscan hs expressionutil)
endif()
if (NOT FAT_RUNTIME AND BUILD_STATIC_LIBS)
if (NOT FAT_RUNTIME )
set(unit_internal_SOURCES set(unit_internal_SOURCES
${gtest_SOURCES} ${gtest_SOURCES}
internal/bitfield.cpp internal/bitfield.cpp
@ -133,7 +128,7 @@ endif(NOT RELEASE_BUILD)
add_executable(unit-internal ${unit_internal_SOURCES}) add_executable(unit-internal ${unit_internal_SOURCES})
set_target_properties(unit-internal PROPERTIES COMPILE_FLAGS "${HS_CXX_FLAGS}") set_target_properties(unit-internal PROPERTIES COMPILE_FLAGS "${HS_CXX_FLAGS}")
target_link_libraries(unit-internal hs corpusomatic) target_link_libraries(unit-internal hs corpusomatic)
endif(NOT FAT_RUNTIME) endif (NOT FAT_RUNTIME AND BUILD_STATIC_LIBS)
if (BUILD_CHIMERA) if (BUILD_CHIMERA)
# enable Chimera unit tests # enable Chimera unit tests

View File

@ -280,7 +280,11 @@ TEST_P(BadPattern, Stream) {
static static
vector<BadPatternParam> getBadPatterns() { vector<BadPatternParam> getBadPatterns() {
#ifdef NDEBUG
string filename = "unit/hyperscan/bad_patterns.txt"; string filename = "unit/hyperscan/bad_patterns.txt";
#else
string filename = "unit/hyperscan/bad_patterns_fast.txt";
#endif
ifstream f; ifstream f;
f.open(filename.c_str(), ifstream::in); f.open(filename.c_str(), ifstream::in);

View File

@ -0,0 +1,159 @@
1:/\c空/ #\c must be followed by an ASCII character at index 0.
2:/\c/ #\c must be followed by an ASCII character at index 0.
3:/[\c空]/ #\c must be followed by an ASCII character at index 1.
4:/[\c]/ #Unterminated character class starting at index 0.
5:/\c空/8 #\c must be followed by an ASCII character at index 0.
6:/<([^>+i)>.*?</\1>/sP #Unterminated character class starting at index 2.
6:/[foo/ #Unterminated character class starting at index 0.
7:/[\p{X}]/8 #Unknown property at index 4.
8:/[\p{^X}]/8 #Unknown property at index 5.
9:/[\p{L]/8 #Malformed property at index 0.
10:/[\p{^L]/8 #Malformed property at index 0.
11:/[\P{L]/8 #Malformed property at index 0.
12:/[\P{^L]/8 #Malformed property at index 0.
13:/\p/8 #Malformed property at index 0.
14:/\P/8 #Malformed property at index 0.
15:/\p{/8 #Malformed property at index 0.
16:/\P{/8 #Malformed property at index 0.
17:/\p{^/8 #Malformed property at index 0.
18:/\P{^/8 #Malformed property at index 0.
19:/[\p/8 #Malformed property at index 1.
20:/[\P/8 #Malformed property at index 1.
21:/[\p{/8 #Malformed property at index 0.
22:/[\P{/8 #Malformed property at index 0.
23:/[\p{^/8 #Malformed property at index 0.
24:/[\P{^/8 #Malformed property at index 0.
25:/\pl/8 #Unknown property at index 2.
26:/\p{any}/8 #Unknown property at index 3.
27:/\p{greek}/8 #Unknown property at index 3.
28:/\b/8W #\b unsupported in UCP mode at index 0.
29:/(*UCP)\b/8 #\b unsupported in UCP mode at index 6.
30:/\B/8W #\B unsupported in UCP mode at index 0.
31:/\B/W #\B unsupported in UCP mode at index 0.
32:/foo(?{print "Hello world\n";})bar/ #Embedded code is not supported at index 3.
33:/the (\S+)(?{ $color = $^N }) (\S+)(?{ $animal = $^N })/i #Embedded code is not supported at index 9.
35:/\X/8 #\X unsupported at index 0.
36:/\B+/ #Invalid repeat at index 2.
37:/\B?/ #Invalid repeat at index 2.
38:/\B*/ #Invalid repeat at index 2.
39:/\B{0,6}/ #Invalid repeat at index 2.
40:/\b+/ #Invalid repeat at index 2.
41:/\b?/ #Invalid repeat at index 2.
42:/\b*/ #Invalid repeat at index 2.
43:/\b{0,6}/ #Invalid repeat at index 2.
44:/[.ch.]/ #Unsupported POSIX collating element at index 0.
45:/[=ch=]/ #Unsupported POSIX collating element at index 0.
46:/[:digit:]/ #POSIX named classes are only supported inside a class at index 0.
47:/[[.ch.]]/ #Unsupported POSIX collating element at index 1.
48:/[[=ch=]]/ #Unsupported POSIX collating element at index 1.
49:/foo(?m)?bar/ #Invalid repeat at index 7.
50:/.(?)+/ #Invalid repeat at index 4.
51:/(abc)\2/P #Invalid back reference to expression 2.
52:/\x{100000000}/ #Value in \x{...} sequence is too large at index 0.
53:/^foo/{min_offset=5} #Expression is anchored and cannot satisfy min_offset=5 as it can only produce matches of length 3 bytes at most.
54:/foobar/{min_length=20} #Expression has min_length=20 but can only produce matches of length 6 bytes at most.
55:/foobar/{max_offset=3} #Expression has max_offset=3 but requires 6 bytes to match.
56:/mkdzo(x|u)(\b)kd/{max_offset=29} #Pattern can never match.
57:/[^\x00-\xff]/ #Pattern can never match.
58:/[^\x00-\xff]foo/ #Pattern can never match.
59:/^\Bfoo/ #Pattern can never match.
60:/^\B\Bfoo/ #Pattern can never match.
61:/can't_match\b\B/ #Pattern can never match.
62:/\b\Bcan't_match/ #Pattern can never match.
63:/^\b$/m #Pattern can never match.
64:/^\b\Z/m #Pattern can never match.
65:/^\b\z/m #Pattern can never match.
66:/\A\b$/m #Pattern can never match.
67:/\A\b\Z/m #Pattern can never match.
68:/\A\b\z/m #Pattern can never match.
69:/^[^\x00-\xff]foo/ #Pattern can never match.
70:/foo[^\x00-\xff]/ #Pattern can never match.
71:/foo[^\x00-\xff]$/ #Pattern can never match.
72:/\Bd\B/i{min_length=2,min_offset=4,max_offset=54} #Expression has min_length=2 but can only produce matches of length 1 bytes at most.
74:/(((.|aaa)aaaaaa.aaa){14,19}a((a|a{5,6}|aa){3,11}|aa.|a){2}){40}\Z/smL #Pattern is too large.
75:/\B/s8{min_length=1} #Expression has min_length=1 but can only produce matches of length 0 bytes at most.
76:/(f|d|(\b)|i|a\Z)/mHV8{min_length=2,min_offset=9,max_offset=14} #Expression has min_length=2 but can only produce matches of length 1 bytes at most.
77:/(f|e|d{19,}|h\Z|^j|\Aa)/smi{min_length=7,min_offset=8,max_offset=18} #Extended parameter constraints can not be satisfied for any match from this expression.
78:/(i{13,}|i\Z)/s{min_length=3,max_offset=5} #Extended parameter constraints can not be satisfied for any match from this expression.
79:/(?P<dupename>foo).*(?P<dupename>bar)/ #Two named subpatterns use the name 'dupename' at index 19.
80:/_W{0,3}bazr_W{0,3}(ac[_a-z]{22}a)?e_W{0,3}bazr[_a-z](ac[a-z]{4}c{14}[a-z]{5})?e_W{0,3}bazr[_a-z](e|ac[_a-z]{4}c{16}([_a-z]|[a-p]W|[o-z]WW){3}([_a-z]|WWW))_W{0,3}bazr([_a-z]|[a-p]WW?|[o-z]WWW)a(foobar|c([a-z]W{0,3})bc([a-z]W{0,3})c{14}([_a-z]W{0,3}){6})((fooaa|[_a-z]W{0,3})bazr[_a-z]W{0,5}a(foobar|c([_a-z]|[a-z]W{1,3})bc([_a-z]|[o-z]W{1,5})c{14}([_a-f]|[A-Z0]W|~WW|;WWW){6})){40}(fooaa|_)bazr[_a-z]/sL #Pattern is too large.
81:/[..]/ #Unsupported POSIX collating element at index 0.
82:/[==]/ #Unsupported POSIX collating element at index 0.
83:/[.\].]/ #Unsupported POSIX collating element at index 0.
84:/[=\]=]/ #Unsupported POSIX collating element at index 0.
85:/A(?!)+Z/ #Invalid repeat at index 5.
86:/\X/ #\X unsupported at index 0.
88:/[A-\d]/ #Invalid range in character class at index 3.
89:/[A-[:digit:]]/ #Invalid range in character class at index 3.
90:/B[--[:digit:]--]+/ #Invalid range in character class at index 4.
91:/a\owibble/ #Value in \o{...} sequence is non-octal or missing braces at index 1.
92:/a\o{wibble/ #Value in \o{...} sequence is non-octal or missing braces at index 1.
93:/a\o{777}/ #Value in \o{...} sequence is too large at index 1.
94:/(*UTF16)foo/ #Unsupported control verb (*UTF16) at index 0.
95:/(*BSR_UNICODE)abc/ #Unsupported control verb (*BSR_UNICODE) at index 0.
96:/a+(*SKIP)b/ #Unknown control verb (*SKIP) at index 2.
97:/foo(*/ #Invalid repeat at index 4.
98:/[:\]:]/ #POSIX named classes are only supported inside a class at index 0.
99:/[[:[:]/ #Invalid POSIX named class at index 1.
100:/abc(?(1)def|ghi)/P #Invalid conditional reference to expression 1.
101:/abc(?(<blah>)def|ghi)/P #Invalid conditional reference to label 'blah'.
102:/(?(DEFINE)foo|bar)/P #DEFINE conditional group with more than one branch at index 17.
103:/(?<1name>group)/ #Group name cannot begin with a digit at index 0.
104:/abc((def)?(?(R)bar))+/P #Pattern recursion not supported at index 10.
105:/abc((def)?(?(R2)bar))+/P #Pattern recursion not supported at index 10.
106:/abc((def)(?(R&label)bar))+/P #Pattern recursion not supported at index 9.
107:/\o{4200000}/8 #Value in \o{...} sequence is too large at index 0.
108:/\o{19}/ #Value in \o{...} sequence is non-octal or missing braces at index 0.
109:/\o{/ #Value in \o{...} sequence is non-octal or missing braces at index 0.
110:/\o{1/ #Value in \o{...} sequence is non-octal or missing braces at index 0.
111:/\x{0x110000}/8 #Value in \x{...} sequence is non-hex or missing } at index 0.
112:/\cÀ/ #\c must be followed by an ASCII character at index 0.
113:/[\cÀ]/ #\c must be followed by an ASCII character at index 1.
114:/[\o{4200000}]/8 #Value in \o{...} sequence is too large at index 1.
115:/[\x{0x110000}]/8 #Value in \x{...} sequence is non-hex or missing } at index 1.
116:/[\o{70]/ #Value in \o{...} sequence is non-octal or missing braces at index 1.
117:/[\x{ff]/ #Value in \x{...} sequence is non-hex or missing } at index 1.
118:/foo/{min_offset=10,max_offset=9} #In hs_expr_ext, min_offset must be less than or equal to max_offset.
120:/foo/{min_length=10,max_offset=9} #In hs_expr_ext, min_length must be less than or equal to max_offset.
122:/ÀÀ/8 #Expression is not valid UTF-8.
123:/hello \6 world/P #Invalid back reference to expression 6.
124:/hello \6 world|dog/P #Invalid back reference to expression 6.
125:/[~-\V]/8 #Invalid range in character class at index 3.
126:/(*UTF8)ÀÀ/ #Expression is not valid UTF-8.
127:/^fo?ob{ro|nax_off\Qt=10omnax+8Wnah/ñññññññññññññññññññññññññññ0}l.{1,60}Car*k|npanomnax+8Wnah/8 #Expression is not valid UTF-8.
128:/(*UTF8)^fo?ob{ro|nax_off\Qt=10omnax+8Wnah/ñññññññññññññññññññññññññññ0}l.{1,60}Car*k|npanomnax+8Wnah/ #Expression is not valid UTF-8.
129:/bignum \1111111111111111111/ #Number is too big at index 7.
130:/foo|&{5555555,}/ #Bounded repeat is too large.
131:/[a[..]]/ #Unsupported POSIX collating element at index 2.
132:/[a[==]]/ #Unsupported POSIX collating element at index 2.
133:/[a[.\].]]/ #Unsupported POSIX collating element at index 2.
134:/[a[=\]=]]/ #Unsupported POSIX collating element at index 2.
135:/[^\D\d]/8W #Pattern can never match.
136:/(*LIMIT_MATCH=1000)foobar/ #Unsupported control verb (*LIMIT_MATCH=1000) at index 0.
137:/(*UTF32)foobar/ #Unsupported control verb (*UTF32) at index 0.
138:/(*UNKNOWNVERB)foobar/ #Unknown control verb (*UNKNOWNVERB) at index 0.
139:/foo(*UTF8)bar/ #(*UTF8) must be at start of expression, encountered at index 5.
140:/(?i)(*UTF8)foobar/ #(*UTF8) must be at start of expression, encountered at index 6.
141:/(*@&/ #Unknown control verb at index 2.
142:/abcd/si{edit_distance=4} #Approximate matching patterns that reduce to vacuous patterns are disallowed.
143:/foobar|hatstand/sL{edit_distance=6} #Approximate matching patterns that reduce to vacuous patterns are disallowed.
144:/abc\b/{edit_distance=1} #Zero-width assertions are disallowed for approximate matching.
145:/abc/8{edit_distance=1} #UTF-8 is disallowed for approximate matching.
146:/(*UTF8)abc/{edit_distance=1} #UTF-8 is disallowed for approximate matching.
147:/\b\BMYBt/s{edit_distance=1} #Pattern can never match.
148:/\QÀ\Eaaaa/8 #Expression is not valid UTF-8.
149:/[\QÀ\Eaaaa]/8 #Expression is not valid UTF-8.
150:/abcd/{edit_distance=1,hamming_distance=1} #In hs_expr_ext, cannot have both edit distance and Hamming distance.
151:/141 | abc/C #Unknown character at index 6.
152:/141 & | 142/C #Not enough operand at index 6.
153:/141 142 & 143/C #Not enough operator at index 13.
154:/141 !142/C #Not enough operator at index 8.
155:/141 & 142 |/C #Not enough operand at index 11.
156:/)141 & 142 /C #Not enough left parentheses at index 0.
157:/(141 & (142|!143) |144/C #Not enough right parentheses at index 22.
158:/141 & (142|!143) )| 144/C #Not enough left parentheses at index 17.
159:/1234567890 & (142|!143 )/C #Expression id too large at index 10.
160:/141 & (142|!143 )|/C #Not enough operand at index 18.
161:/141/C #No logical operation.
162:/119 & 121/C #Unknown sub-expression id.
163:/166 & 167/C #Unknown sub-expression id.

View File

@ -157,7 +157,11 @@ TEST_P(HyperscanScanGigabytesMatch, StreamingMatch) {
// gb is the number of gigabytes to scan between pre-block and post-block // gb is the number of gigabytes to scan between pre-block and post-block
// run over 1,2,4,8 gb // run over 1,2,4,8 gb
#ifdef NDEBUG
for (unsigned long long gb = 1; gb <= 8; gb *= 2) { for (unsigned long long gb = 1; gb <= 8; gb *= 2) {
#else
for (unsigned long long gb = 1; gb <= 2; gb *= 2) {
#endif
SCOPED_TRACE(gb); SCOPED_TRACE(gb);
hs_stream_t *stream = nullptr; hs_stream_t *stream = nullptr;
@ -261,12 +265,12 @@ TEST_P(HyperscanScanGigabytesMatch, BlockMatch) {
1*1024, 1*1024,
#ifdef BIG_BLOCKS #ifdef BIG_BLOCKS
4*1024, 32*1024, 128*1024, 512*1024, 4*1024, 32*1024, 128*1024, 512*1024,
#ifdef NDEBUG
// gigabytes // gigabytes
1024*1024, 1024*1024,
#ifdef ARCH_X86_64
// big cases for big beefy machines // big cases for big beefy machines
2048*1024, 3072*1024 2048*1024, 3072*1024
#endif // ARCH_X86_64 #endif // NDEBUG
#endif // BIG_BLOCKS #endif // BIG_BLOCKS
}; };
@ -1333,6 +1337,7 @@ TEST(regression, UE_2425) {
hs_free_database(db); hs_free_database(db);
} }
#ifdef NDEBUG
TEST(regression, UE_2485) { TEST(regression, UE_2485) {
const char regex[] = "(?:(.EeEa|((a{2}BD[bc]Bd[eae]|[DCd]|c|ebCa|d)){7,21})(E{5,}A{4,}[Cc].cc{3,6}|eCec|e+CaBEd|[Bb])){10}DB(a|[AAda])..A?DE?E"; const char regex[] = "(?:(.EeEa|((a{2}BD[bc]Bd[eae]|[DCd]|c|ebCa|d)){7,21})(E{5,}A{4,}[Cc].cc{3,6}|eCec|e+CaBEd|[Bb])){10}DB(a|[AAda])..A?DE?E";
unsigned flags = HS_FLAG_DOTALL | HS_FLAG_CASELESS | HS_FLAG_UTF8 | unsigned flags = HS_FLAG_DOTALL | HS_FLAG_CASELESS | HS_FLAG_UTF8 |
@ -1348,6 +1353,7 @@ TEST(regression, UE_2485) {
ASSERT_NE(nullptr, db); ASSERT_NE(nullptr, db);
hs_free_database(db); hs_free_database(db);
} }
#endif
TEST(regression, UE_2452) { TEST(regression, UE_2452) {
const char regex[] = "/ab.b[bca]{2,}ca((?:c|(abc(?sxmi-xm)){10,14}|c|b|[abcb])){4,23}acbcbb*ba((?:(a|.{4,}|.|[acba])){3,16}a)+"; const char regex[] = "/ab.b[bca]{2,}ca((?:c|(abc(?sxmi-xm)){10,14}|c|b|[abcb])){4,23}acbcbb*ba((?:(a|.{4,}|.|[acba])){3,16}a)+";
@ -1364,6 +1370,7 @@ TEST(regression, UE_2452) {
hs_free_database(db); hs_free_database(db);
} }
#ifdef NDEBUG
TEST(regression, UE_2595) { TEST(regression, UE_2595) {
const char regex[] = "(?:(?:acAa|c[EAA]aEb|((?:CC[bdd].cE((?x-msix)BE){32}(?:\\B)){16,19}CdD.E(E|E|B)){3,6}|E(a|d|.)(?:(?xs-isxm)|b|.|C))){17,}"; const char regex[] = "(?:(?:acAa|c[EAA]aEb|((?:CC[bdd].cE((?x-msix)BE){32}(?:\\B)){16,19}CdD.E(E|E|B)){3,6}|E(a|d|.)(?:(?xs-isxm)|b|.|C))){17,}";
unsigned flags = HS_FLAG_MULTILINE | HS_FLAG_CASELESS | unsigned flags = HS_FLAG_MULTILINE | HS_FLAG_CASELESS |
@ -1378,6 +1385,7 @@ TEST(regression, UE_2595) {
ASSERT_NE(nullptr, db); ASSERT_NE(nullptr, db);
hs_free_database(db); hs_free_database(db);
} }
#endif
TEST(regression, UE_2762) { TEST(regression, UE_2762) {
const vector<pattern> patterns = { const vector<pattern> patterns = {

View File

@ -235,7 +235,11 @@ static const unsigned test_modes[] = {HS_MODE_BLOCK, HS_MODE_STREAM,
static const unsigned test_flags[] = {0, HS_FLAG_SINGLEMATCH, static const unsigned test_flags[] = {0, HS_FLAG_SINGLEMATCH,
HS_FLAG_SOM_LEFTMOST}; HS_FLAG_SOM_LEFTMOST};
#ifdef NDEBUG
static const unsigned test_sizes[] = {1, 10, 100, 500, 10000}; static const unsigned test_sizes[] = {1, 10, 100, 500, 10000};
#else
static const unsigned test_sizes[] = {1, 10, 100, 500};
#endif
static const pair<unsigned, unsigned> test_bounds[] = {{3u, 10u}, {10u, 100u}}; static const pair<unsigned, unsigned> test_bounds[] = {{3u, 10u}, {10u, 100u}};

View File

@ -363,9 +363,11 @@ static const unsigned validModes[] = {
// Mode bits for switching off various architecture features // Mode bits for switching off various architecture features
static const unsigned long long featureMask[] = { static const unsigned long long featureMask[] = {
~0ULL, /* native */ ~0ULL, /* native */
#if defined(ARCH_IA32) || defined(ARCH_X86_64)
~(HS_CPU_FEATURES_AVX2 | HS_CPU_FEATURES_AVX512 | HS_CPU_FEATURES_AVX512VBMI), /* no avx2 */ ~(HS_CPU_FEATURES_AVX2 | HS_CPU_FEATURES_AVX512 | HS_CPU_FEATURES_AVX512VBMI), /* no avx2 */
~(HS_CPU_FEATURES_AVX512 | HS_CPU_FEATURES_AVX512VBMI), /* no avx512 */ ~(HS_CPU_FEATURES_AVX512 | HS_CPU_FEATURES_AVX512VBMI), /* no avx512 */
~HS_CPU_FEATURES_AVX512VBMI, /* no avx512vbmi */ ~HS_CPU_FEATURES_AVX512VBMI, /* no avx512vbmi */
#endif
}; };
INSTANTIATE_TEST_CASE_P(Single, INSTANTIATE_TEST_CASE_P(Single,

View File

@ -1327,16 +1327,19 @@ static const MultiBitTestParam multibitTests[] = {
{ 1024, 1 }, { 1024, 1 },
{ 1025, 1 }, { 1025, 1 },
{ 2099, 1 }, { 2099, 1 },
#ifdef NDEBUG
{ 10000, 1 }, { 10000, 1 },
{ 32768, 1 }, { 32768, 1 },
{ 32769, 1 }, { 32769, 1 },
{ 200000, 1 }, { 200000, 1 },
#endif
// Larger cases, bigger strides. // Larger cases, bigger strides.
{ 1U << 18, 3701 }, { 1U << 18, 3701 },
{ 1U << 19, 3701 }, { 1U << 19, 3701 },
{ 1U << 20, 3701 }, { 1U << 20, 3701 },
{ 1U << 21, 3701 }, { 1U << 21, 3701 },
#ifdef NDEBUG
{ 1U << 22, 3701 }, { 1U << 22, 3701 },
{ 1U << 23, 3701 }, { 1U << 23, 3701 },
{ 1U << 24, 3701 }, { 1U << 24, 3701 },
@ -1347,6 +1350,7 @@ static const MultiBitTestParam multibitTests[] = {
{ 1U << 29, 24413 }, { 1U << 29, 24413 },
{ 1U << 30, 50377 }, { 1U << 30, 50377 },
{ 1U << 31, 104729 }, { 1U << 31, 104729 },
#endif
}; };
INSTANTIATE_TEST_CASE_P(MultiBit, MultiBitTest, ValuesIn(multibitTests)); INSTANTIATE_TEST_CASE_P(MultiBit, MultiBitTest, ValuesIn(multibitTests));

View File

@ -165,10 +165,12 @@ TEST(MultiBitComp, CompCompsizeSparse) {
257, 257,
4097, 4097,
(1U << 18) + 1, (1U << 18) + 1,
#ifdef NDEBUG
(1U << 24) + 1, (1U << 24) + 1,
(1U << 30) + 1 (1U << 30) + 1
#endif
}; };
for (u32 i = 0; i < 5; i++) { for (u32 i = 0; i < sizeof(test_set)/sizeof(u32); i++) {
u32 test_size = test_set[i]; u32 test_size = test_set[i];
mmbit_holder ba(test_size); mmbit_holder ba(test_size);
@ -225,10 +227,12 @@ TEST(MultiBitComp, CompCompsizeDense) {
257, 257,
4097, 4097,
(1U << 18) + 1, (1U << 18) + 1,
#ifdef NDEBUG
(1U << 24) + 1, (1U << 24) + 1,
(1U << 30) + 1 (1U << 30) + 1
#endif
}; };
for (u32 i = 0; i < 5; i++) { for (u32 i = 0; i < sizeof(test_set)/sizeof(u32); i++) {
u32 test_size = test_set[i]; u32 test_size = test_set[i];
mmbit_holder ba(test_size); mmbit_holder ba(test_size);
@ -760,16 +764,19 @@ static const MultiBitCompTestParam multibitCompTests[] = {
{ 1025, 1 }, { 1025, 1 },
{ 2099, 1 }, // 4097 = 64 ^ 2 + 1 { 2099, 1 }, // 4097 = 64 ^ 2 + 1
{ 4097, 1 }, { 4097, 1 },
#ifdef NDEBUG
{ 10000, 1 }, { 10000, 1 },
{ 32768, 1 }, { 32768, 1 },
{ 32769, 1 }, { 32769, 1 },
{ 200000, 1 }, { 200000, 1 },
{ 262145, 1 }, // 262145 = 64 * 3 + 1 { 262145, 1 }, // 262145 = 64 * 3 + 1
#endif
// Larger cases, bigger strides. // Larger cases, bigger strides.
{ 1U << 19, 3701 }, { 1U << 19, 3701 },
{ 1U << 20, 3701 }, { 1U << 20, 3701 },
{ 1U << 21, 3701 }, { 1U << 21, 3701 },
#ifdef NDEBUG
{ 1U << 22, 3701 }, { 1U << 22, 3701 },
{ 1U << 23, 3701 }, { 1U << 23, 3701 },
{ 1U << 24, 3701 }, { 1U << 24, 3701 },
@ -780,6 +787,7 @@ static const MultiBitCompTestParam multibitCompTests[] = {
{ 1U << 29, 24413 }, { 1U << 29, 24413 },
{ 1U << 30, 50377 }, { 1U << 30, 50377 },
{ 1U << 31, 104729 }, { 1U << 31, 104729 },
#endif
}; };
INSTANTIATE_TEST_CASE_P(MultiBitComp, MultiBitCompTest, INSTANTIATE_TEST_CASE_P(MultiBitComp, MultiBitCompTest,

View File

@ -673,8 +673,15 @@ TEST(SimdUtilsTest, movq) {
int64x2_t a = { 0x123456789abcdefLL, ~0LL }; int64x2_t a = { 0x123456789abcdefLL, ~0LL };
simd = vreinterpretq_s32_s64(a); simd = vreinterpretq_s32_s64(a);
#elif defined(ARCH_PPC64EL) #elif defined(ARCH_PPC64EL)
#if defined(__clang__) && (__clang_major__ >= 15)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecate-lax-vec-conv-all"
#endif // defined(__clang__) && (__clang_major__ == 15)
int64x2_t a = {0x123456789abcdefLL, ~0LL }; int64x2_t a = {0x123456789abcdefLL, ~0LL };
simd = (m128) a; simd = reinterpret_cast<m128>(a);
#if defined(__clang__) && (__clang_major__ >= 15)
#pragma clang diagnostic pop
#endif // defined(__clang__) && (__clang_major__ == 15)
#endif #endif
#endif #endif
r = movq(simd); r = movq(simd);

View File

@ -9,7 +9,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
message("RAGEL_C_FLAGS" ${RAGEL_C_FLAGS}) message("RAGEL_C_FLAGS" ${RAGEL_C_FLAGS})
set_source_files_properties( set_source_files_properties(
${CMAKE_BINARY_DIR}/util/ExpressionParser.cpp ExpressionParser.cpp
PROPERTIES PROPERTIES
COMPILE_FLAGS "${RAGEL_C_FLAGS}") COMPILE_FLAGS "${RAGEL_C_FLAGS}")