diff --git a/.github/workflows/vs.yml b/.github/workflows/vs.yml index 754fe9e..c8b8dc0 100644 --- a/.github/workflows/vs.yml +++ b/.github/workflows/vs.yml @@ -1,4 +1,4 @@ -name: VS16-CI +name: VS17-CI on: push: @@ -13,16 +13,16 @@ jobs: if: >- ! contains(toJSON(github.event.commits.*.message), '[skip ci]') && ! contains(toJSON(github.event.commits.*.message), '[skip github]') - name: windows-vs16 + name: windows-vs17 runs-on: windows-latest strategy: fail-fast: false matrix: include: - - {gen: Visual Studio 16 2019, arch: Win32, static: ON} - - {gen: Visual Studio 16 2019, arch: Win32, static: OFF} - - {gen: Visual Studio 16 2019, arch: x64, static: ON} - - {gen: Visual Studio 16 2019, arch: x64, static: OFF} + - {gen: Visual Studio 17 2022, arch: Win32, static: ON} + - {gen: Visual Studio 17 2022, arch: Win32, static: OFF} + - {gen: Visual Studio 17 2022, arch: x64, static: ON} + - {gen: Visual Studio 17 2022, arch: x64, static: OFF} steps: - name: checkout uses: actions/checkout@v2 diff --git a/CMakeLists.txt b/CMakeLists.txt index bc20563..39df85d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,5 @@ cmake_minimum_required(VERSION 3.3) set(CMAKE_MACOSX_RPATH OFF) -if (NOT CMAKE_BUILD_TYPE) - message(STATUS "No build type selected, default to Release") - set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) -endif() - project(STREAMVBYTE VERSION "1.0.0") set(STREAMVBYTE_LIB_VERSION "1.0.0" CACHE STRING "streamvbyte library version") @@ -12,6 +7,24 @@ set(STREAMVBYTE_LIB_SOVERSION "1" CACHE STRING "streamvbyte library soversion") set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD_REQUIRED ON) +option(STREAMVBYTE_SANITIZE "Sanitize addresses" OFF) +if (NOT CMAKE_BUILD_TYPE) + message(STATUS "No build type selected") + if(STREAMVBYTE_SANITIZE) + message(STATUS "Default to Debug") + set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE) + else() + message(STATUS "Default to Release") + set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) + endif() +endif() + +if(STREAMVBYTE_SANITIZE) + message(STATUS "Enabling memory sanitizer.") + add_compile_options(-fsanitize=address -fno-omit-frame-pointer -fno-sanitize-recover=all) + add_compile_definitions(ASAN_OPTIONS=detect_leaks=1) +endif() + if (MSVC) add_definitions( "-D__restrict__=__restrict" @@ -70,6 +83,7 @@ install( TARGETS streamvbyte streamvbyte_static DESTINATION lib) + option(STREAMVBYTE_SANITIZE_UNDEFINED "Sanitize undefined behavior" OFF) if(STREAMVBYTE_SANITIZE_UNDEFINED) add_compile_options(-fsanitize=undefined -fno-sanitize-recover=all) diff --git a/src/streamvbyte_isadetection.h b/src/streamvbyte_isadetection.h index da5a4d6..2480472 100644 --- a/src/streamvbyte_isadetection.h +++ b/src/streamvbyte_isadetection.h @@ -230,7 +230,7 @@ static inline bool streamvbyte_ssse3() { } #else static inline bool streamvbyte_ssse3() { - return (dynamic_streamvbyte_detect_supported_architectures() & streamvbyte_SSSE3) == streamvbyte_SSSE3; + return (streamvbyte_detect_supported_architectures() & streamvbyte_SSSE3) == streamvbyte_SSSE3; } #endif