Skip to content

Commit 19bef29

Browse files
authored
ci: add /WX (warnings as errors) compile flag when compiling with MSVC. (#923)
* Add /WX (warnings as errors) compile flag when compiling with MSVC. * Call darts::score() with floats instead of doubles to get rid of C4305. * Suppress C4244 and C4267 because lots of code triggers them and GCC and CLang are fine with those conversions. * Add missing endif to CMakeLists.txt for sieve.
1 parent 3d106a5 commit 19bef29

File tree

96 files changed

+391
-106
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+391
-106
lines changed

exercises/concept/doctor-data/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,12 @@ if(${EXERCISM_RUN_ALL_TESTS})
5555
endif()
5656

5757
# Tell MSVC not to warn us about unchecked iterators in debug builds
58+
# Treat warnings as errors
59+
# Treat type conversion warnings C4244 and C4267 as level 4 warnings, i.e. ignore them in level 3
5860
if(${MSVC})
5961
set_target_properties(${exercise} PROPERTIES
60-
COMPILE_DEFINITIONS_DEBUG _SCL_SECURE_NO_WARNINGS)
62+
COMPILE_DEFINITIONS_DEBUG _SCL_SECURE_NO_WARNINGS
63+
COMPILE_FLAGS "/WX /w44244 /w44267")
6164
endif()
6265

6366
# Run the tests on every build

exercises/concept/election-day/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,12 @@ if(${EXERCISM_RUN_ALL_TESTS})
5858
endif()
5959

6060
# Tell MSVC not to warn us about unchecked iterators in debug builds
61+
# Treat warnings as errors
62+
# Treat type conversion warnings C4244 and C4267 as level 4 warnings, i.e. ignore them in level 3
6163
if(${MSVC})
6264
set_target_properties(${exercise} PROPERTIES
63-
COMPILE_DEFINITIONS_DEBUG _SCL_SECURE_NO_WARNINGS)
65+
COMPILE_DEFINITIONS_DEBUG _SCL_SECURE_NO_WARNINGS
66+
COMPILE_FLAGS "/WX /w44244 /w44267")
6467
endif()
6568

6669
# Run the tests on every build

exercises/concept/ellens-alien-game/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,12 @@ if(${EXERCISM_RUN_ALL_TESTS})
5757
endif()
5858

5959
# Tell MSVC not to warn us about unchecked iterators in debug builds
60+
# Treat warnings as errors
61+
# Treat type conversion warnings C4244 and C4267 as level 4 warnings, i.e. ignore them in level 3
6062
if(${MSVC})
6163
set_target_properties(${exercise} PROPERTIES
62-
COMPILE_DEFINITIONS_DEBUG _SCL_SECURE_NO_WARNINGS)
64+
COMPILE_DEFINITIONS_DEBUG _SCL_SECURE_NO_WARNINGS
65+
COMPILE_FLAGS "/WX /w44244 /w44267")
6366
endif()
6467

6568
# Run the tests on every build

exercises/concept/freelancer-rates/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,12 @@ if(${EXERCISM_RUN_ALL_TESTS})
5757
endif()
5858

5959
# Tell MSVC not to warn us about unchecked iterators in debug builds
60+
# Treat warnings as errors
61+
# Treat type conversion warnings C4244 and C4267 as level 4 warnings, i.e. ignore them in level 3
6062
if(${MSVC})
6163
set_target_properties(${exercise} PROPERTIES
62-
COMPILE_DEFINITIONS_DEBUG _SCL_SECURE_NO_WARNINGS)
64+
COMPILE_DEFINITIONS_DEBUG _SCL_SECURE_NO_WARNINGS
65+
COMPILE_FLAGS "/WX /w44244 /w44267")
6366
endif()
6467

6568
# Run the tests on every build

exercises/concept/interest-is-interesting/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,12 @@ if(${EXERCISM_RUN_ALL_TESTS})
5757
endif()
5858

5959
# Tell MSVC not to warn us about unchecked iterators in debug builds
60+
# Treat warnings as errors
61+
# Treat type conversion warnings C4244 and C4267 as level 4 warnings, i.e. ignore them in level 3
6062
if(${MSVC})
6163
set_target_properties(${exercise} PROPERTIES
62-
COMPILE_DEFINITIONS_DEBUG _SCL_SECURE_NO_WARNINGS)
64+
COMPILE_DEFINITIONS_DEBUG _SCL_SECURE_NO_WARNINGS
65+
COMPILE_FLAGS "/WX /w44244 /w44267")
6366
endif()
6467

6568
# Run the tests on every build

exercises/concept/lasagna-master/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,12 @@ if(${EXERCISM_RUN_ALL_TESTS})
5555
endif()
5656

5757
# Tell MSVC not to warn us about unchecked iterators in debug builds
58+
# Treat warnings as errors
59+
# Treat type conversion warnings C4244 and C4267 as level 4 warnings, i.e. ignore them in level 3
5860
if(${MSVC})
5961
set_target_properties(${exercise} PROPERTIES
60-
COMPILE_DEFINITIONS_DEBUG _SCL_SECURE_NO_WARNINGS)
62+
COMPILE_DEFINITIONS_DEBUG _SCL_SECURE_NO_WARNINGS
63+
COMPILE_FLAGS "/WX /w44244 /w44267")
6164
endif()
6265

6366
# Run the tests on every build

exercises/concept/lasagna/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,12 @@ if(${EXERCISM_RUN_ALL_TESTS})
5757
endif()
5858

5959
# Tell MSVC not to warn us about unchecked iterators in debug builds
60+
# Treat warnings as errors
61+
# Treat type conversion warnings C4244 and C4267 as level 4 warnings, i.e. ignore them in level 3
6062
if(${MSVC})
6163
set_target_properties(${exercise} PROPERTIES
62-
COMPILE_DEFINITIONS_DEBUG _SCL_SECURE_NO_WARNINGS)
64+
COMPILE_DEFINITIONS_DEBUG _SCL_SECURE_NO_WARNINGS
65+
COMPILE_FLAGS "/WX /w44244 /w44267")
6366
endif()
6467

6568
# Run the tests on every build

exercises/concept/last-will/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,12 @@ if(${EXERCISM_RUN_ALL_TESTS})
5757
endif()
5858

5959
# Tell MSVC not to warn us about unchecked iterators in debug builds
60+
# Treat warnings as errors
61+
# Treat type conversion warnings C4244 and C4267 as level 4 warnings, i.e. ignore them in level 3
6062
if(${MSVC})
6163
set_target_properties(${exercise} PROPERTIES
62-
COMPILE_DEFINITIONS_DEBUG _SCL_SECURE_NO_WARNINGS)
64+
COMPILE_DEFINITIONS_DEBUG _SCL_SECURE_NO_WARNINGS
65+
COMPILE_FLAGS "/WX /w44244 /w44267")
6366
endif()
6467

6568
# Run the tests on every build

exercises/concept/log-levels/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,12 @@ if(${EXERCISM_RUN_ALL_TESTS})
5757
endif()
5858

5959
# Tell MSVC not to warn us about unchecked iterators in debug builds
60+
# Treat warnings as errors
61+
# Treat type conversion warnings C4244 and C4267 as level 4 warnings, i.e. ignore them in level 3
6062
if(${MSVC})
6163
set_target_properties(${exercise} PROPERTIES
62-
COMPILE_DEFINITIONS_DEBUG _SCL_SECURE_NO_WARNINGS)
64+
COMPILE_DEFINITIONS_DEBUG _SCL_SECURE_NO_WARNINGS
65+
COMPILE_FLAGS "/WX /w44244 /w44267")
6366
endif()
6467

6568
# Run the tests on every build

exercises/concept/making-the-grade/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,12 @@ if(${EXERCISM_RUN_ALL_TESTS})
5858
endif()
5959

6060
# Tell MSVC not to warn us about unchecked iterators in debug builds
61+
# Treat warnings as errors
62+
# Treat type conversion warnings C4244 and C4267 as level 4 warnings, i.e. ignore them in level 3
6163
if(${MSVC})
6264
set_target_properties(${exercise} PROPERTIES
63-
COMPILE_DEFINITIONS_DEBUG _SCL_SECURE_NO_WARNINGS)
65+
COMPILE_DEFINITIONS_DEBUG _SCL_SECURE_NO_WARNINGS
66+
COMPILE_FLAGS "/WX /w44244 /w44267")
6467
endif()
6568

6669
# Run the tests on every build

0 commit comments

Comments
 (0)