diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index fad51b632e..4978e5d973 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -37,13 +37,13 @@ jobs: steps: - uses: actions/checkout@v2 - name: cmake - run: cmake -S . -B build -G "Visual Studio 15 2017" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DCMAKE_EXE_LINKER_FLAGS="/STACK:4000000" + run: cmake -S . -B build -G "Visual Studio 15 2017" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DCMAKE_EXE_LINKER_FLAGS="/STACK:4000000" -DCMAKE_CXX_FLAGS="/W4 /WX" if: matrix.build_type == 'Release' && matrix.architecture == 'x64' - name: cmake - run: cmake -S . -B build -G "Visual Studio 15 2017" -A ${{ matrix.architecture }} -DJSON_BuildTests=On + run: cmake -S . -B build -G "Visual Studio 15 2017" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DCMAKE_CXX_FLAGS="/W4 /WX" if: matrix.build_type == 'Release' && matrix.architecture != 'x64' - name: cmake - run: cmake -S . -B build -G "Visual Studio 15 2017" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DJSON_FastTests=ON + run: cmake -S . -B build -G "Visual Studio 15 2017" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DJSON_FastTests=ON -DCMAKE_CXX_FLAGS="/W4 /WX" if: matrix.build_type == 'Debug' - name: build run: cmake --build build --config ${{ matrix.build_type }} --parallel 10 @@ -56,7 +56,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: cmake - run: cmake -S . -B build -G "Visual Studio 15 2017" -DJSON_BuildTests=On -DCMAKE_CXX_FLAGS="/permissive- /std:c++latest /utf-8 /W4" + run: cmake -S . -B build -G "Visual Studio 15 2017" -DJSON_BuildTests=On -DCMAKE_CXX_FLAGS="/permissive- /std:c++latest /utf-8 /W4 /WX" - name: build run: cmake --build build --config Release --parallel 10 - name: test @@ -72,10 +72,10 @@ jobs: steps: - uses: actions/checkout@v2 - name: cmake - run: cmake -S . -B build -G "Visual Studio 16 2019" -A ${{ matrix.architecture }} -DJSON_BuildTests=On + run: cmake -S . -B build -G "Visual Studio 16 2019" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DCMAKE_CXX_FLAGS="/W4 /WX" if: matrix.build_type == 'Release' - name: cmake - run: cmake -S . -B build -G "Visual Studio 16 2019" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DJSON_FastTests=ON + run: cmake -S . -B build -G "Visual Studio 16 2019" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DJSON_FastTests=ON -DCMAKE_CXX_FLAGS="/W4 /WX" if: matrix.build_type == 'Debug' - name: build run: cmake --build build --config ${{ matrix.build_type }} --parallel 10 @@ -88,7 +88,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: cmake - run: cmake -S . -B build -G "Visual Studio 16 2019" -DJSON_BuildTests=On -DCMAKE_CXX_FLAGS="/permissive- /std:c++latest /utf-8 /W4" + run: cmake -S . -B build -G "Visual Studio 16 2019" -DJSON_BuildTests=On -DCMAKE_CXX_FLAGS="/permissive- /std:c++latest /utf-8 /W4 /WX" - name: build run: cmake --build build --config Release --parallel 10 - name: test diff --git a/appveyor.yml b/appveyor.yml index 4dba417c63..0157e20811 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,7 +5,7 @@ environment: - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 configuration: Debug platform: x86 - CXX_FLAGS: "" + CXX_FLAGS: "/W4 /WX" LINKER_FLAGS: "" CMAKE_OPTIONS: "" GENERATOR: Visual Studio 14 2015 @@ -13,7 +13,7 @@ environment: - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 configuration: Release platform: x86 - CXX_FLAGS: "" + CXX_FLAGS: "/W4 /WX" LINKER_FLAGS: "" CMAKE_OPTIONS: "" GENERATOR: Visual Studio 14 2015 @@ -22,7 +22,7 @@ environment: configuration: Release platform: x86 name: with_win_header - CXX_FLAGS: "" + CXX_FLAGS: "/W4 /WX" LINKER_FLAGS: "" CMAKE_OPTIONS: "" GENERATOR: Visual Studio 14 2015 @@ -30,7 +30,7 @@ environment: - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 configuration: Release platform: x86 - CXX_FLAGS: "/permissive- /std:c++latest /utf-8" + CXX_FLAGS: "/permissive- /std:c++latest /utf-8 /W4 /WX" LINKER_FLAGS: "" CMAKE_OPTIONS: "" GENERATOR: Visual Studio 15 2017 @@ -38,7 +38,7 @@ environment: - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 configuration: Release platform: x86 - CXX_FLAGS: "" + CXX_FLAGS: "/W4 /WX" LINKER_FLAGS: "" CMAKE_OPTIONS: "-DJSON_ImplicitConversions=OFF" GENERATOR: Visual Studio 16 2019 @@ -46,7 +46,7 @@ environment: - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 configuration: Release platform: x64 - CXX_FLAGS: "" + CXX_FLAGS: "/W4 /WX" LINKER_FLAGS: "" CMAKE_OPTIONS: "" GENERATOR: Visual Studio 14 2015 @@ -54,7 +54,7 @@ environment: - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 configuration: Release platform: x64 - CXX_FLAGS: "/permissive- /std:c++latest /Zc:__cplusplus /utf-8 /F4000000" + CXX_FLAGS: "/permissive- /std:c++latest /Zc:__cplusplus /utf-8 /F4000000 /W4 /WX" LINKER_FLAGS: "/STACK:4000000" CMAKE_OPTIONS: "" GENERATOR: Visual Studio 15 2017 diff --git a/test/src/unit-allocator.cpp b/test/src/unit-allocator.cpp index 962828d201..7b5a36090d 100644 --- a/test/src/unit-allocator.cpp +++ b/test/src/unit-allocator.cpp @@ -108,6 +108,7 @@ struct my_allocator : std::allocator throw std::bad_alloc(); } + static_cast(p); // fix MSVC's C4100 warning p->~T(); } diff --git a/test/src/unit-deserialization.cpp b/test/src/unit-deserialization.cpp index 293d2418fb..ad96343a0a 100644 --- a/test/src/unit-deserialization.cpp +++ b/test/src/unit-deserialization.cpp @@ -1089,7 +1089,7 @@ TEST_CASE_TEMPLATE("deserialization of different character types (UTF-8)", T, char, unsigned char, std::uint8_t) { // a star emoji - std::vector v = {'"', static_cast(0xe2), static_cast(0xad), static_cast(0x90), static_cast(0xef), static_cast(0xb8), static_cast(0x8f), '"'}; + std::vector v = {'"', static_cast(0xe2u), static_cast(0xadu), static_cast(0x90u), static_cast(0xefu), static_cast(0xb8u), static_cast(0x8fu), '"'}; CHECK(json::parse(v).dump(-1, ' ', true) == "\"\\u2b50\\ufe0f\""); CHECK(json::accept(v)); diff --git a/test/src/unit-udt.cpp b/test/src/unit-udt.cpp index 2bebd8f599..12770ce64d 100644 --- a/test/src/unit-udt.cpp +++ b/test/src/unit-udt.cpp @@ -816,7 +816,10 @@ class Evil public: Evil() = default; template - Evil(T t) : m_i(sizeof(t)) {} + Evil(T t) : m_i(sizeof(t)) + { + static_cast(t); // fix MSVC's C4100 warning + } int m_i = 0; };