Merge pull request #381 from ihaller/ihaller/msvc17

Improved support for MSVC with C++17
This commit is contained in:
Istvan Haller
2021-08-26 14:24:38 +01:00
committed by GitHub
2 changed files with 5 additions and 1 deletions

View File

@@ -108,6 +108,10 @@ endif()
add_library(snmalloc_lib INTERFACE)
target_include_directories(snmalloc_lib INTERFACE src/)
if(SNMALLOC_USE_CXX17)
target_compile_definitions(snmalloc_lib INTERFACE -DSNMALLOC_USE_CXX17)
endif()
if(NOT MSVC)
find_package(Threads REQUIRED COMPONENTS snmalloc_lib)
target_link_libraries(snmalloc_lib INTERFACE ${CMAKE_THREAD_LIBS_INIT})

View File

@@ -7,7 +7,7 @@
# define unlikely(x) !!(x)
# define SNMALLOC_SLOW_PATH NOINLINE
# define SNMALLOC_FAST_PATH ALWAYSINLINE
# if _MSC_VER >= 1927
# if _MSC_VER >= 1927 && !defined(SNMALLOC_USE_CXX17)
# define SNMALLOC_FAST_PATH_LAMBDA [[msvc::forceinline]]
# else
# define SNMALLOC_FAST_PATH_LAMBDA