Merge pull request #79 from fastfloat/dlemire/vs_studio_persmissive_minus

adding to recent Visual Studio builds a permissive- flag
This commit is contained in:
Daniel Lemire 2021-06-01 10:08:10 -04:00 committed by GitHub
commit e3af106668
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 50 additions and 42 deletions

View File

@ -22,7 +22,7 @@ jobs:
mkdir build
cd build && cmake -G "${{matrix.gen}}" -A ${{matrix.arch}} -DFASTFLOAT_TEST=ON ..
- name: Build
run: cmake --build build --config Release --parallel
run: cmake --build build --verbose --config Release --parallel
- name: 'Run CTest'
run: |
cd build

View File

@ -20,10 +20,10 @@ jobs:
mkdir build &&
cd build &&
cmake ${{matrix.cxx}} ${{matrix.arch}} -DFASTFLOAT_TEST=ON -DCMAKE_INSTALL_PREFIX:PATH=destination .. &&
cmake --build . &&
cmake --build . --verbose &&
ctest --output-on-failure &&
cmake --install . &&
cd ../tests/installation_tests/find &&
mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX:PATH=../../../build/destination .. && cmake --build .
mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX:PATH=../../../build/destination .. && cmake --build . --verbose
cd ../../issue72_installation &&
mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX:PATH=../../../build/destination .. && cmake --build .
mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX:PATH=../../../build/destination .. && cmake --build . --verbose

View File

@ -37,6 +37,10 @@ if(FASTFLOAT_SANITIZE)
target_link_libraries(fast_float INTERFACE -fuse-ld=gold)
endif()
endif()
if(MSVC_VERSION GREATER 1910)
target_compile_options(fast_float INTERFACE /permissive-)
endif()
include(CMakePackageConfigHelpers)

View File

@ -210,68 +210,68 @@ constexpr static float powers_of_ten_float[] = {1e0, 1e1, 1e2, 1e3, 1e4, 1e5,
1e6, 1e7, 1e8, 1e9, 1e10};
template <typename T> struct binary_format {
static constexpr int mantissa_explicit_bits();
static constexpr int minimum_exponent();
static constexpr int infinite_power();
static constexpr int sign_index();
static constexpr int min_exponent_fast_path();
static constexpr int max_exponent_fast_path();
static constexpr int max_exponent_round_to_even();
static constexpr int min_exponent_round_to_even();
static constexpr uint64_t max_mantissa_fast_path();
static constexpr int largest_power_of_ten();
static constexpr int smallest_power_of_ten();
static constexpr T exact_power_of_ten(int64_t power);
static inline constexpr int mantissa_explicit_bits();
static inline constexpr int minimum_exponent();
static inline constexpr int infinite_power();
static inline constexpr int sign_index();
static inline constexpr int min_exponent_fast_path();
static inline constexpr int max_exponent_fast_path();
static inline constexpr int max_exponent_round_to_even();
static inline constexpr int min_exponent_round_to_even();
static inline constexpr uint64_t max_mantissa_fast_path();
static inline constexpr int largest_power_of_ten();
static inline constexpr int smallest_power_of_ten();
static inline constexpr T exact_power_of_ten(int64_t power);
};
template <> constexpr int binary_format<double>::mantissa_explicit_bits() {
template <> inline constexpr int binary_format<double>::mantissa_explicit_bits() {
return 52;
}
template <> constexpr int binary_format<float>::mantissa_explicit_bits() {
template <> inline constexpr int binary_format<float>::mantissa_explicit_bits() {
return 23;
}
template <> constexpr int binary_format<double>::max_exponent_round_to_even() {
template <> inline constexpr int binary_format<double>::max_exponent_round_to_even() {
return 23;
}
template <> constexpr int binary_format<float>::max_exponent_round_to_even() {
template <> inline constexpr int binary_format<float>::max_exponent_round_to_even() {
return 10;
}
template <> constexpr int binary_format<double>::min_exponent_round_to_even() {
template <> inline constexpr int binary_format<double>::min_exponent_round_to_even() {
return -4;
}
template <> constexpr int binary_format<float>::min_exponent_round_to_even() {
template <> inline constexpr int binary_format<float>::min_exponent_round_to_even() {
return -17;
}
template <> constexpr int binary_format<double>::minimum_exponent() {
template <> inline constexpr int binary_format<double>::minimum_exponent() {
return -1023;
}
template <> constexpr int binary_format<float>::minimum_exponent() {
template <> inline constexpr int binary_format<float>::minimum_exponent() {
return -127;
}
template <> constexpr int binary_format<double>::infinite_power() {
template <> inline constexpr int binary_format<double>::infinite_power() {
return 0x7FF;
}
template <> constexpr int binary_format<float>::infinite_power() {
template <> inline constexpr int binary_format<float>::infinite_power() {
return 0xFF;
}
template <> constexpr int binary_format<double>::sign_index() { return 63; }
template <> constexpr int binary_format<float>::sign_index() { return 31; }
template <> inline constexpr int binary_format<double>::sign_index() { return 63; }
template <> inline constexpr int binary_format<float>::sign_index() { return 31; }
template <> constexpr int binary_format<double>::min_exponent_fast_path() {
template <> inline constexpr int binary_format<double>::min_exponent_fast_path() {
#if (FLT_EVAL_METHOD != 1) && (FLT_EVAL_METHOD != 0)
return 0;
#else
return -22;
#endif
}
template <> constexpr int binary_format<float>::min_exponent_fast_path() {
template <> inline constexpr int binary_format<float>::min_exponent_fast_path() {
#if (FLT_EVAL_METHOD != 1) && (FLT_EVAL_METHOD != 0)
return 0;
#else
@ -279,46 +279,46 @@ template <> constexpr int binary_format<float>::min_exponent_fast_path() {
#endif
}
template <> constexpr int binary_format<double>::max_exponent_fast_path() {
template <> inline constexpr int binary_format<double>::max_exponent_fast_path() {
return 22;
}
template <> constexpr int binary_format<float>::max_exponent_fast_path() {
template <> inline constexpr int binary_format<float>::max_exponent_fast_path() {
return 10;
}
template <> constexpr uint64_t binary_format<double>::max_mantissa_fast_path() {
template <> inline constexpr uint64_t binary_format<double>::max_mantissa_fast_path() {
return uint64_t(2) << mantissa_explicit_bits();
}
template <> constexpr uint64_t binary_format<float>::max_mantissa_fast_path() {
template <> inline constexpr uint64_t binary_format<float>::max_mantissa_fast_path() {
return uint64_t(2) << mantissa_explicit_bits();
}
template <>
constexpr double binary_format<double>::exact_power_of_ten(int64_t power) {
inline constexpr double binary_format<double>::exact_power_of_ten(int64_t power) {
return powers_of_ten_double[power];
}
template <>
constexpr float binary_format<float>::exact_power_of_ten(int64_t power) {
inline constexpr float binary_format<float>::exact_power_of_ten(int64_t power) {
return powers_of_ten_float[power];
}
template <>
constexpr int binary_format<double>::largest_power_of_ten() {
inline constexpr int binary_format<double>::largest_power_of_ten() {
return 308;
}
template <>
constexpr int binary_format<float>::largest_power_of_ten() {
inline constexpr int binary_format<float>::largest_power_of_ten() {
return 38;
}
template <>
constexpr int binary_format<double>::smallest_power_of_ten() {
inline constexpr int binary_format<double>::smallest_power_of_ten() {
return -342;
}
template <>
constexpr int binary_format<float>::smallest_power_of_ten() {
inline constexpr int binary_format<float>::smallest_power_of_ten() {
return -65;
}

View File

@ -4,7 +4,9 @@ project(test_simdjson_install VERSION 0.1.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(MSVC_VERSION GREATER 1910)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -permissive-")
endif()
find_package(FastFloat REQUIRED)

View File

@ -4,6 +4,9 @@ project(test_simdjson_install VERSION 0.1.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(MSVC_VERSION GREATER 1910)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -permissive-")
endif()
find_package(FastFloat REQUIRED)
@ -20,6 +23,5 @@ int main() { return 0; }")
file(WRITE foo.cpp "
#include \"test.h\"
void foo() { }")
add_executable(issue72 main.cpp main.cpp)
target_link_libraries(issue72 PUBLIC FastFloat::fast_float)