Skip to content

Commit e3af106

Browse files
authored
Merge pull request #79 from fastfloat/dlemire/vs_studio_persmissive_minus
adding to recent Visual Studio builds a permissive- flag
2 parents 2f0c95f + 9519835 commit e3af106

File tree

6 files changed

+50
-42
lines changed

6 files changed

+50
-42
lines changed

.github/workflows/vs15-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
mkdir build
2323
cd build && cmake -G "${{matrix.gen}}" -A ${{matrix.arch}} -DFASTFLOAT_TEST=ON ..
2424
- name: Build
25-
run: cmake --build build --config Release --parallel
25+
run: cmake --build build --verbose --config Release --parallel
2626
- name: 'Run CTest'
2727
run: |
2828
cd build

.github/workflows/vs16-ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020
mkdir build &&
2121
cd build &&
2222
cmake ${{matrix.cxx}} ${{matrix.arch}} -DFASTFLOAT_TEST=ON -DCMAKE_INSTALL_PREFIX:PATH=destination .. &&
23-
cmake --build . &&
23+
cmake --build . --verbose &&
2424
ctest --output-on-failure &&
2525
cmake --install . &&
2626
cd ../tests/installation_tests/find &&
27-
mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX:PATH=../../../build/destination .. && cmake --build .
27+
mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX:PATH=../../../build/destination .. && cmake --build . --verbose
2828
cd ../../issue72_installation &&
29-
mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX:PATH=../../../build/destination .. && cmake --build .
29+
mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX:PATH=../../../build/destination .. && cmake --build . --verbose

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ if(FASTFLOAT_SANITIZE)
3737
target_link_libraries(fast_float INTERFACE -fuse-ld=gold)
3838
endif()
3939
endif()
40+
if(MSVC_VERSION GREATER 1910)
41+
target_compile_options(fast_float INTERFACE /permissive-)
42+
endif()
43+
4044

4145
include(CMakePackageConfigHelpers)
4246

include/fast_float/float_common.h

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -210,115 +210,115 @@ constexpr static float powers_of_ten_float[] = {1e0, 1e1, 1e2, 1e3, 1e4, 1e5,
210210
1e6, 1e7, 1e8, 1e9, 1e10};
211211

212212
template <typename T> struct binary_format {
213-
static constexpr int mantissa_explicit_bits();
214-
static constexpr int minimum_exponent();
215-
static constexpr int infinite_power();
216-
static constexpr int sign_index();
217-
static constexpr int min_exponent_fast_path();
218-
static constexpr int max_exponent_fast_path();
219-
static constexpr int max_exponent_round_to_even();
220-
static constexpr int min_exponent_round_to_even();
221-
static constexpr uint64_t max_mantissa_fast_path();
222-
static constexpr int largest_power_of_ten();
223-
static constexpr int smallest_power_of_ten();
224-
static constexpr T exact_power_of_ten(int64_t power);
213+
static inline constexpr int mantissa_explicit_bits();
214+
static inline constexpr int minimum_exponent();
215+
static inline constexpr int infinite_power();
216+
static inline constexpr int sign_index();
217+
static inline constexpr int min_exponent_fast_path();
218+
static inline constexpr int max_exponent_fast_path();
219+
static inline constexpr int max_exponent_round_to_even();
220+
static inline constexpr int min_exponent_round_to_even();
221+
static inline constexpr uint64_t max_mantissa_fast_path();
222+
static inline constexpr int largest_power_of_ten();
223+
static inline constexpr int smallest_power_of_ten();
224+
static inline constexpr T exact_power_of_ten(int64_t power);
225225
};
226226

227-
template <> constexpr int binary_format<double>::mantissa_explicit_bits() {
227+
template <> inline constexpr int binary_format<double>::mantissa_explicit_bits() {
228228
return 52;
229229
}
230-
template <> constexpr int binary_format<float>::mantissa_explicit_bits() {
230+
template <> inline constexpr int binary_format<float>::mantissa_explicit_bits() {
231231
return 23;
232232
}
233233

234-
template <> constexpr int binary_format<double>::max_exponent_round_to_even() {
234+
template <> inline constexpr int binary_format<double>::max_exponent_round_to_even() {
235235
return 23;
236236
}
237237

238-
template <> constexpr int binary_format<float>::max_exponent_round_to_even() {
238+
template <> inline constexpr int binary_format<float>::max_exponent_round_to_even() {
239239
return 10;
240240
}
241241

242-
template <> constexpr int binary_format<double>::min_exponent_round_to_even() {
242+
template <> inline constexpr int binary_format<double>::min_exponent_round_to_even() {
243243
return -4;
244244
}
245245

246-
template <> constexpr int binary_format<float>::min_exponent_round_to_even() {
246+
template <> inline constexpr int binary_format<float>::min_exponent_round_to_even() {
247247
return -17;
248248
}
249249

250-
template <> constexpr int binary_format<double>::minimum_exponent() {
250+
template <> inline constexpr int binary_format<double>::minimum_exponent() {
251251
return -1023;
252252
}
253-
template <> constexpr int binary_format<float>::minimum_exponent() {
253+
template <> inline constexpr int binary_format<float>::minimum_exponent() {
254254
return -127;
255255
}
256256

257-
template <> constexpr int binary_format<double>::infinite_power() {
257+
template <> inline constexpr int binary_format<double>::infinite_power() {
258258
return 0x7FF;
259259
}
260-
template <> constexpr int binary_format<float>::infinite_power() {
260+
template <> inline constexpr int binary_format<float>::infinite_power() {
261261
return 0xFF;
262262
}
263263

264-
template <> constexpr int binary_format<double>::sign_index() { return 63; }
265-
template <> constexpr int binary_format<float>::sign_index() { return 31; }
264+
template <> inline constexpr int binary_format<double>::sign_index() { return 63; }
265+
template <> inline constexpr int binary_format<float>::sign_index() { return 31; }
266266

267-
template <> constexpr int binary_format<double>::min_exponent_fast_path() {
267+
template <> inline constexpr int binary_format<double>::min_exponent_fast_path() {
268268
#if (FLT_EVAL_METHOD != 1) && (FLT_EVAL_METHOD != 0)
269269
return 0;
270270
#else
271271
return -22;
272272
#endif
273273
}
274-
template <> constexpr int binary_format<float>::min_exponent_fast_path() {
274+
template <> inline constexpr int binary_format<float>::min_exponent_fast_path() {
275275
#if (FLT_EVAL_METHOD != 1) && (FLT_EVAL_METHOD != 0)
276276
return 0;
277277
#else
278278
return -10;
279279
#endif
280280
}
281281

282-
template <> constexpr int binary_format<double>::max_exponent_fast_path() {
282+
template <> inline constexpr int binary_format<double>::max_exponent_fast_path() {
283283
return 22;
284284
}
285-
template <> constexpr int binary_format<float>::max_exponent_fast_path() {
285+
template <> inline constexpr int binary_format<float>::max_exponent_fast_path() {
286286
return 10;
287287
}
288288

289-
template <> constexpr uint64_t binary_format<double>::max_mantissa_fast_path() {
289+
template <> inline constexpr uint64_t binary_format<double>::max_mantissa_fast_path() {
290290
return uint64_t(2) << mantissa_explicit_bits();
291291
}
292-
template <> constexpr uint64_t binary_format<float>::max_mantissa_fast_path() {
292+
template <> inline constexpr uint64_t binary_format<float>::max_mantissa_fast_path() {
293293
return uint64_t(2) << mantissa_explicit_bits();
294294
}
295295

296296
template <>
297-
constexpr double binary_format<double>::exact_power_of_ten(int64_t power) {
297+
inline constexpr double binary_format<double>::exact_power_of_ten(int64_t power) {
298298
return powers_of_ten_double[power];
299299
}
300300
template <>
301-
constexpr float binary_format<float>::exact_power_of_ten(int64_t power) {
301+
inline constexpr float binary_format<float>::exact_power_of_ten(int64_t power) {
302302

303303
return powers_of_ten_float[power];
304304
}
305305

306306

307307
template <>
308-
constexpr int binary_format<double>::largest_power_of_ten() {
308+
inline constexpr int binary_format<double>::largest_power_of_ten() {
309309
return 308;
310310
}
311311
template <>
312-
constexpr int binary_format<float>::largest_power_of_ten() {
312+
inline constexpr int binary_format<float>::largest_power_of_ten() {
313313
return 38;
314314
}
315315

316316
template <>
317-
constexpr int binary_format<double>::smallest_power_of_ten() {
317+
inline constexpr int binary_format<double>::smallest_power_of_ten() {
318318
return -342;
319319
}
320320
template <>
321-
constexpr int binary_format<float>::smallest_power_of_ten() {
321+
inline constexpr int binary_format<float>::smallest_power_of_ten() {
322322
return -65;
323323
}
324324

tests/installation_tests/find/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ project(test_simdjson_install VERSION 0.1.0 LANGUAGES CXX)
44

55
set(CMAKE_CXX_STANDARD 17)
66
set(CMAKE_CXX_STANDARD_REQUIRED ON)
7-
7+
if(MSVC_VERSION GREATER 1910)
8+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -permissive-")
9+
endif()
810
find_package(FastFloat REQUIRED)
911

1012

tests/installation_tests/issue72_installation/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ project(test_simdjson_install VERSION 0.1.0 LANGUAGES CXX)
44

55
set(CMAKE_CXX_STANDARD 17)
66
set(CMAKE_CXX_STANDARD_REQUIRED ON)
7+
if(MSVC_VERSION GREATER 1910)
8+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -permissive-")
9+
endif()
710

811
find_package(FastFloat REQUIRED)
912

@@ -20,6 +23,5 @@ int main() { return 0; }")
2023
file(WRITE foo.cpp "
2124
#include \"test.h\"
2225
void foo() { }")
23-
2426
add_executable(issue72 main.cpp main.cpp)
2527
target_link_libraries(issue72 PUBLIC FastFloat::fast_float)

0 commit comments

Comments
 (0)