From 9e194ea8b6c67fc9033bacce0d1758287c009870 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Sat, 6 Jul 2024 01:13:32 +0900 Subject: [PATCH 1/5] chore: add -Werror and while compilation --- CMakeLists.txt | 16 +++++- src/CMakeLists.txt | 17 ++++++ tests/CMakeLists.txt | 122 +++++++++++++++++++------------------------ 3 files changed, 85 insertions(+), 70 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dcfc83a..0e63969 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,8 +36,22 @@ if(${TOML11_TEST_WITH_ASAN} AND ${TOML11_TEST_WITH_UBSAN}) message(FATAL_ERROR "trying to build tests with BOTH asan and ubsan") endif() -include(GNUInstallDirs) +include(CheckCXXCompilerFlag) +check_cxx_compiler_flag("-Wall" TOML11_COMPILER_SUPPORTS_WALL) +check_cxx_compiler_flag("-Wextra" TOML11_COMPILER_SUPPORTS_WEXTRA) +check_cxx_compiler_flag("-Wpedantic" TOML11_COMPILER_SUPPORTS_WPEDANTIC) +check_cxx_compiler_flag("-Werror" TOML11_COMPILER_SUPPORTS_WERROR) +check_cxx_compiler_flag("-Wsign-conversion" TOML11_COMPILER_SUPPORTS_WSIGN_CONVERSION) +check_cxx_compiler_flag("-Wconversion" TOML11_COMPILER_SUPPORTS_WCONVERSION) +check_cxx_compiler_flag("-Wduplicated-cond" TOML11_COMPILER_SUPPORTS_WDUPLICATED_COND) +check_cxx_compiler_flag("-Wduplicated-branches" TOML11_COMPILER_SUPPORTS_WDUPLICATED_BRANCHES) +check_cxx_compiler_flag("-Wlogical-op" TOML11_COMPILER_SUPPORTS_WLOGICAL_OP) +check_cxx_compiler_flag("-Wdouble-promotion" TOML11_COMPILER_SUPPORTS_WDOUBLE_PROMOTION) +check_cxx_compiler_flag("-Wrange-loop-analysis" TOML11_COMPILER_SUPPORTS_WRANGE_LOOP_ANALYSIS) +check_cxx_compiler_flag("-Wundef" TOML11_COMPILER_SUPPORTS_WUNDEF) +check_cxx_compiler_flag("-Wshadow" TOML11_COMPILER_SUPPORTS_WSHADOW) +include(GNUInstallDirs) set(TOML11_INSTALL_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/toml11) set(TOML11_INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR}) set(TOML11_CONFIG_DIR ${CMAKE_CURRENT_BINARY_DIR}/cmake) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 43c8636..c83c54f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -99,6 +99,7 @@ if(TOML11_PRECOMPILE) # required options to use toml11 with MSVC if(MSVC) target_compile_options(toml11 PUBLIC "/utf-8") + target_compile_options(toml11 PRIVATE "/W3" "/WX") if(MSVC_VERSION LESS 1910) message(STATUS "MSVC < 1910. DEFINE_CONVERSION_NON_INTRUSIVE is disabled") target_compile_definitions(toml11 PUBLIC -DTOML11_WITHOUT_DEFINE_NON_INTRUSIVE) @@ -107,6 +108,22 @@ if(TOML11_PRECOMPILE) else() # MSVC 2019 target_compile_options(toml11 PUBLIC "/Zc:preprocessor") endif() + else() + target_compile_options(toml11 PRIVATE + $<$: -Wall > + $<$: -Wextra > + $<$: -Wpedantic > + $<$: -Werror > + $<$: -Wsign-conversion > + $<$: -Wconversion > + $<$: -Wduplicated-cond > + $<$: -Wduplicated-branches> + $<$: -Wlogical-op > + $<$: -Wdouble-promotion > + $<$: -Wrange-loop-analysis> + $<$: -Wundef > + $<$: -Wshadow > + ) endif() else() add_library(toml11 INTERFACE) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 2cf41cf..adc2e7a 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -41,23 +41,6 @@ set(TOML11_TEST_NAMES test_visit ) -include(CheckCXXCompilerFlag) - -check_cxx_compiler_flag("-Wall" COMPILER_SUPPORTS_WALL) -check_cxx_compiler_flag("-Wextra" COMPILER_SUPPORTS_WEXTRA) -check_cxx_compiler_flag("-Wpedantic" COMPILER_SUPPORTS_WPEDANTIC) -check_cxx_compiler_flag("-Werror" COMPILER_SUPPORTS_WERROR) - -check_cxx_compiler_flag("-Wsign-conversion" COMPILER_SUPPORTS_WSIGN_CONVERSION) -check_cxx_compiler_flag("-Wconversion" COMPILER_SUPPORTS_WCONVERSION) -check_cxx_compiler_flag("-Wduplicated-cond" COMPILER_SUPPORTS_WDUPLICATED_COND) -check_cxx_compiler_flag("-Wduplicated-branches" COMPILER_SUPPORTS_WDUPLICATED_BRANCHES) -check_cxx_compiler_flag("-Wlogical-op" COMPILER_SUPPORTS_WLOGICAL_OP) -check_cxx_compiler_flag("-Wdouble-promotion" COMPILER_SUPPORTS_WDOUBLE_PROMOTION) -check_cxx_compiler_flag("-Wrange-loop-analysis" COMPILER_SUPPORTS_WRANGE_LOOP_ANALYSIS) -check_cxx_compiler_flag("-Wundef" COMPILER_SUPPORTS_WUNDEF) -check_cxx_compiler_flag("-Wshadow" COMPILER_SUPPORTS_WSHADOW) - if(BUILD_TESTING) add_library(toml11_test_utility STATIC utility.cpp) target_include_directories(toml11_test_utility @@ -72,27 +55,28 @@ if(BUILD_TESTING) ) target_link_libraries(${TEST_NAME} PUBLIC toml11 toml11_test_utility) if(MSVC) - target_compile_options(${TEST_NAME} PRIVATE /W3) + target_compile_options(${TEST_NAME} PRIVATE /W3 /WX) else() target_compile_options(${TEST_NAME} PRIVATE - $<$: -Wall > - $<$: -Wextra > - $<$: -Wpedantic > - $<$: -Wsign-conversion > - $<$: -Wconversion > - $<$: -Wduplicated-cond > - $<$: -Wduplicated-branches> - $<$: -Wlogical-op > - $<$: -Wdouble-promotion > - $<$: -Wrange-loop-analysis> - $<$: -Wundef > - $<$: -Wshadow > - $<$: -fsanitize=address > - $<$: -fsanitize=undefined > + $<$: -Wall > + $<$: -Wextra > + $<$: -Wpedantic > + $<$: -Werror > + $<$: -Wsign-conversion > + $<$: -Wconversion > + $<$: -Wduplicated-cond > + $<$: -Wduplicated-branches> + $<$: -Wlogical-op > + $<$: -Wdouble-promotion > + $<$: -Wrange-loop-analysis> + $<$: -Wundef > + $<$: -Wshadow > + $<$: -fsanitize=address > + $<$: -fsanitize=undefined > ) target_link_options(${TEST_NAME} PRIVATE - $<$: -fsanitize=address > - $<$: -fsanitize=undefined > + $<$: -fsanitize=address > + $<$: -fsanitize=undefined > ) endif() add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME}) @@ -111,27 +95,27 @@ if(TOML11_BUILD_TOML_TESTS) ) target_link_libraries(toml11_decoder PRIVATE toml11) if(MSVC) - target_compile_options(${TEST_NAME} PRIVATE /W3) + target_compile_options(${TEST_NAME} PRIVATE /W3 /WX) else() target_compile_options(toml11_decoder PRIVATE - $<$: -Wall > - $<$: -Wextra > - $<$: -Wpedantic > - $<$: -Wsign-conversion > - $<$: -Wconversion > - $<$: -Wduplicated-cond > - $<$: -Wduplicated-branches> - $<$: -Wlogical-op > - $<$: -Wdouble-promotion > - $<$: -Wrange-loop-analysis> - $<$: -Wundef > - $<$: -Wshadow > - $<$: -fsanitize=address > - $<$: -fsanitize=undefined > + $<$: -Wall > + $<$: -Wextra > + $<$: -Wpedantic > + $<$: -Wsign-conversion > + $<$: -Wconversion > + $<$: -Wduplicated-cond > + $<$: -Wduplicated-branches> + $<$: -Wlogical-op > + $<$: -Wdouble-promotion > + $<$: -Wrange-loop-analysis> + $<$: -Wundef > + $<$: -Wshadow > + $<$: -fsanitize=address > + $<$: -fsanitize=undefined > ) target_link_options(toml11_decoder PRIVATE - $<$: -fsanitize=address > - $<$: -fsanitize=undefined > + $<$: -fsanitize=address > + $<$: -fsanitize=undefined > ) endif() @@ -143,7 +127,7 @@ if(TOML11_BUILD_TOML_TESTS) target_compile_definitions(toml11_decoder_v1_1_0 PRIVATE -DTOML11_TO_JSON_USE_V1_1_0) target_link_libraries(toml11_decoder_v1_1_0 PRIVATE toml11) if(MSVC) - target_compile_options(${TEST_NAME} PRIVATE /W3) + target_compile_options(${TEST_NAME} PRIVATE /W3 /WX) else() target_compile_options(toml11_decoder_v1_1_0 PRIVATE $<$: -Wall > @@ -174,27 +158,27 @@ if(TOML11_BUILD_TOML_TESTS) ) target_link_libraries(toml11_encoder PRIVATE toml11) if(MSVC) - target_compile_options(${TEST_NAME} PRIVATE /W3) + target_compile_options(${TEST_NAME} PRIVATE /W3 /WX) else() target_compile_options(toml11_encoder PRIVATE - $<$: -Wall > - $<$: -Wextra > - $<$: -Wpedantic > - $<$: -Wsign-conversion > - $<$: -Wconversion > - $<$: -Wduplicated-cond > - $<$: -Wduplicated-branches> - $<$: -Wlogical-op > - $<$: -Wdouble-promotion > - $<$: -Wrange-loop-analysis> - $<$: -Wundef > - $<$: -Wshadow > - $<$: -fsanitize=address > - $<$: -fsanitize=undefined > + $<$: -Wall > + $<$: -Wextra > + $<$: -Wpedantic > + $<$: -Wsign-conversion > + $<$: -Wconversion > + $<$: -Wduplicated-cond > + $<$: -Wduplicated-branches> + $<$: -Wlogical-op > + $<$: -Wdouble-promotion > + $<$: -Wrange-loop-analysis> + $<$: -Wundef > + $<$: -Wshadow > + $<$: -fsanitize=address > + $<$: -fsanitize=undefined > ) target_link_options(toml11_encoder PRIVATE - $<$: -fsanitize=address > - $<$: -fsanitize=undefined > + $<$: -fsanitize=address > + $<$: -fsanitize=undefined > ) endif() endif(TOML11_BUILD_TOML_TESTS) From d72493a2fc8cb0d8071adfead3ed51fd939c3921 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Sat, 6 Jul 2024 01:36:55 +0900 Subject: [PATCH 2/5] fix: remove name of unused argument --- include/toml11/compat.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/toml11/compat.hpp b/include/toml11/compat.hpp index 931dc9c..3308a32 100644 --- a/include/toml11/compat.hpp +++ b/include/toml11/compat.hpp @@ -498,7 +498,7 @@ struct source_location static source_location current() { return source_location{}; } }; -inline std::string to_string(const source_location& loc) +inline std::string to_string(const source_location&) { return std::string(""); } From b63668c0dc05675133a0253d1940d7ed4017fdff Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Sat, 6 Jul 2024 02:14:24 +0900 Subject: [PATCH 3/5] chore: raise msvc warning level --- src/CMakeLists.txt | 2 +- tests/CMakeLists.txt | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c83c54f..c65307f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -99,7 +99,7 @@ if(TOML11_PRECOMPILE) # required options to use toml11 with MSVC if(MSVC) target_compile_options(toml11 PUBLIC "/utf-8") - target_compile_options(toml11 PRIVATE "/W3" "/WX") + target_compile_options(toml11 PRIVATE "/W4" "/WX") if(MSVC_VERSION LESS 1910) message(STATUS "MSVC < 1910. DEFINE_CONVERSION_NON_INTRUSIVE is disabled") target_compile_definitions(toml11 PUBLIC -DTOML11_WITHOUT_DEFINE_NON_INTRUSIVE) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index adc2e7a..37dfea8 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -55,7 +55,7 @@ if(BUILD_TESTING) ) target_link_libraries(${TEST_NAME} PUBLIC toml11 toml11_test_utility) if(MSVC) - target_compile_options(${TEST_NAME} PRIVATE /W3 /WX) + target_compile_options(${TEST_NAME} PRIVATE /W4 /WX) else() target_compile_options(${TEST_NAME} PRIVATE $<$: -Wall > @@ -95,7 +95,7 @@ if(TOML11_BUILD_TOML_TESTS) ) target_link_libraries(toml11_decoder PRIVATE toml11) if(MSVC) - target_compile_options(${TEST_NAME} PRIVATE /W3 /WX) + target_compile_options(${TEST_NAME} PRIVATE /W4 /WX) else() target_compile_options(toml11_decoder PRIVATE $<$: -Wall > @@ -127,7 +127,7 @@ if(TOML11_BUILD_TOML_TESTS) target_compile_definitions(toml11_decoder_v1_1_0 PRIVATE -DTOML11_TO_JSON_USE_V1_1_0) target_link_libraries(toml11_decoder_v1_1_0 PRIVATE toml11) if(MSVC) - target_compile_options(${TEST_NAME} PRIVATE /W3 /WX) + target_compile_options(${TEST_NAME} PRIVATE /W4 /WX) else() target_compile_options(toml11_decoder_v1_1_0 PRIVATE $<$: -Wall > @@ -158,7 +158,7 @@ if(TOML11_BUILD_TOML_TESTS) ) target_link_libraries(toml11_encoder PRIVATE toml11) if(MSVC) - target_compile_options(${TEST_NAME} PRIVATE /W3 /WX) + target_compile_options(${TEST_NAME} PRIVATE /W4 /WX) else() target_compile_options(toml11_encoder PRIVATE $<$: -Wall > From 2912407d3312a6b337290295f6f3384570d0bbc2 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Sat, 6 Jul 2024 02:29:35 +0900 Subject: [PATCH 4/5] ci: temporary suppress gcc/clang --- .github/workflows/main.yml | 316 ++++++++++++++++++------------------- 1 file changed, 158 insertions(+), 158 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a745a14..51cfef2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,167 +3,167 @@ name: build on: [push, pull_request] jobs: - build-linux-gcc: - runs-on: Ubuntu-22.04 - strategy: - matrix: - compiler: ['g++-12', 'g++-11', 'g++-10', 'g++-9'] - standard: ['11', '14', '17', '20'] - precompile: ['ON', 'OFF'] - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - submodules: true - - name: Install - run: | - sudo apt-get update - sudo apt-get install language-pack-fr # test serializer w/ locale - sudo apt-get install ${{ matrix.compiler }} - - name: Configure - run: | - cmake -B build/ -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} -DCMAKE_CXX_STANDARD=${{ matrix.standard }} -DTOML11_BUILD_TESTS=ON -DTOML11_PRECOMPILE=${{ matrix.precompile }} - - name: Build - run: | - cmake --build build/ - - name: Test - run: | - ctest --output-on-failure --test-dir build/ - build-linux-clang: - runs-on: Ubuntu-22.04 - strategy: - matrix: - compiler: ['15', '14', '13', '12', '11'] - standard: ['11', '14', '17', '20'] - precompile: ['ON', 'OFF'] - exclude: - - {compiler: '14', standard: '20'} # to avoid using gcc-13 libstdc++ - - {compiler: '13', standard: '20'} # with older clang - - {compiler: '12', standard: '20'} - - {compiler: '11', standard: '20'} - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - submodules: true - - name: Install - run: | - sudo apt-get update - sudo apt-get install language-pack-fr # test serializer w/ locale - sudo apt-get install clang-${{ matrix.compiler }} - - name: Configure - run: | - cmake -B build/ -DCMAKE_CXX_COMPILER=clang++-${{ matrix.compiler }} -DCMAKE_CXX_STANDARD=${{ matrix.standard }} -DTOML11_BUILD_TESTS=ON -DTOML11_PRECOMPILE=${{ matrix.precompile }} - - name: Build - run: | - cmake --build build/ - - name: Test - run: | - ctest --output-on-failure --test-dir build/ - build-linux-old-gcc: - runs-on: Ubuntu-20.04 - strategy: - matrix: - compiler: ['g++-8', 'g++-7'] - standard: ['11', '14', '17', '20'] - precompile: ['ON', 'OFF'] - exclude: - - {compiler: 'g++-7', standard: '20'} - - {compiler: 'g++-8', standard: '17'} - - {compiler: 'g++-8', standard: '20'} - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - submodules: true - - name: Install - run: | - sudo apt-get update - sudo apt-get install language-pack-fr # test serializer w/ locale - sudo apt-get install ${{ matrix.compiler }} - - name: Configure - run: | - cmake -B build/ -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} -DCMAKE_CXX_STANDARD=${{ matrix.standard }} -DTOML11_BUILD_TESTS=ON -DTOML11_PRECOMPILE=${{ matrix.precompile }} - - name: Build - run: | - cmake --build build/ - - name: Test - run: | - ctest --output-on-failure --test-dir build/ + # build-linux-gcc: + # runs-on: Ubuntu-22.04 + # strategy: + # matrix: + # compiler: ['g++-12', 'g++-11', 'g++-10', 'g++-9'] + # standard: ['11', '14', '17', '20'] + # precompile: ['ON', 'OFF'] + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # with: + # submodules: true + # - name: Install + # run: | + # sudo apt-get update + # sudo apt-get install language-pack-fr # test serializer w/ locale + # sudo apt-get install ${{ matrix.compiler }} + # - name: Configure + # run: | + # cmake -B build/ -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} -DCMAKE_CXX_STANDARD=${{ matrix.standard }} -DTOML11_BUILD_TESTS=ON -DTOML11_PRECOMPILE=${{ matrix.precompile }} + # - name: Build + # run: | + # cmake --build build/ + # - name: Test + # run: | + # ctest --output-on-failure --test-dir build/ + # build-linux-clang: + # runs-on: Ubuntu-22.04 + # strategy: + # matrix: + # compiler: ['15', '14', '13', '12', '11'] + # standard: ['11', '14', '17', '20'] + # precompile: ['ON', 'OFF'] + # exclude: + # - {compiler: '14', standard: '20'} # to avoid using gcc-13 libstdc++ + # - {compiler: '13', standard: '20'} # with older clang + # - {compiler: '12', standard: '20'} + # - {compiler: '11', standard: '20'} + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # with: + # submodules: true + # - name: Install + # run: | + # sudo apt-get update + # sudo apt-get install language-pack-fr # test serializer w/ locale + # sudo apt-get install clang-${{ matrix.compiler }} + # - name: Configure + # run: | + # cmake -B build/ -DCMAKE_CXX_COMPILER=clang++-${{ matrix.compiler }} -DCMAKE_CXX_STANDARD=${{ matrix.standard }} -DTOML11_BUILD_TESTS=ON -DTOML11_PRECOMPILE=${{ matrix.precompile }} + # - name: Build + # run: | + # cmake --build build/ + # - name: Test + # run: | + # ctest --output-on-failure --test-dir build/ + # build-linux-old-gcc: + # runs-on: Ubuntu-20.04 + # strategy: + # matrix: + # compiler: ['g++-8', 'g++-7'] + # standard: ['11', '14', '17', '20'] + # precompile: ['ON', 'OFF'] + # exclude: + # - {compiler: 'g++-7', standard: '20'} + # - {compiler: 'g++-8', standard: '17'} + # - {compiler: 'g++-8', standard: '20'} + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # with: + # submodules: true + # - name: Install + # run: | + # sudo apt-get update + # sudo apt-get install language-pack-fr # test serializer w/ locale + # sudo apt-get install ${{ matrix.compiler }} + # - name: Configure + # run: | + # cmake -B build/ -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} -DCMAKE_CXX_STANDARD=${{ matrix.standard }} -DTOML11_BUILD_TESTS=ON -DTOML11_PRECOMPILE=${{ matrix.precompile }} + # - name: Build + # run: | + # cmake --build build/ + # - name: Test + # run: | + # ctest --output-on-failure --test-dir build/ - build-linux-old-clang: - runs-on: Ubuntu-20.04 - strategy: - matrix: - compiler: ['10', '9', '8', '7', '6.0'] - standard: ['11', '14', '17', '20'] - precompile: ['ON', 'OFF'] - exclude: - - {compiler: '6.0', standard: '20'} - - {compiler: '7', standard: '20'} - - {compiler: '8', standard: '20'} - - {compiler: '9', standard: '20'} - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - submodules: true - - name: Install - run: | - sudo apt-get update - sudo apt-get install language-pack-fr # test serializer w/ locale - sudo apt-get install clang-${{ matrix.compiler }} - - name: Configure - run: | - cmake -B build/ -DCMAKE_CXX_COMPILER=clang++-${{ matrix.compiler }} -DCMAKE_CXX_STANDARD=${{ matrix.standard }} -DTOML11_BUILD_TESTS=ON -DTOML11_PRECOMPILE=${{ matrix.precompile }} - - name: Build - run: | - cmake --build build/ - - name: Test - run: | - ctest --output-on-failure --test-dir build/ + # build-linux-old-clang: + # runs-on: Ubuntu-20.04 + # strategy: + # matrix: + # compiler: ['10', '9', '8', '7', '6.0'] + # standard: ['11', '14', '17', '20'] + # precompile: ['ON', 'OFF'] + # exclude: + # - {compiler: '6.0', standard: '20'} + # - {compiler: '7', standard: '20'} + # - {compiler: '8', standard: '20'} + # - {compiler: '9', standard: '20'} + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # with: + # submodules: true + # - name: Install + # run: | + # sudo apt-get update + # sudo apt-get install language-pack-fr # test serializer w/ locale + # sudo apt-get install clang-${{ matrix.compiler }} + # - name: Configure + # run: | + # cmake -B build/ -DCMAKE_CXX_COMPILER=clang++-${{ matrix.compiler }} -DCMAKE_CXX_STANDARD=${{ matrix.standard }} -DTOML11_BUILD_TESTS=ON -DTOML11_PRECOMPILE=${{ matrix.precompile }} + # - name: Build + # run: | + # cmake --build build/ + # - name: Test + # run: | + # ctest --output-on-failure --test-dir build/ - build-osx-13: - runs-on: macos-13 - strategy: - matrix: - standard: ['11', '14', '17', '20'] - precompile: ['ON', 'OFF'] - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - submodules: true - - name: Configure - run: | - cmake -B build/ -DCMAKE_CXX_STANDARD=${{ matrix.standard }} -DTOML11_BUILD_TESTS=ON -DTOML11_PRECOMPILE=${{ matrix.precompile }} - - name: Build - run: | - cmake --build build/ - - name: Test - run: | - ctest --output-on-failure --test-dir build/ + # build-osx-13: + # runs-on: macos-13 + # strategy: + # matrix: + # standard: ['11', '14', '17', '20'] + # precompile: ['ON', 'OFF'] + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # with: + # submodules: true + # - name: Configure + # run: | + # cmake -B build/ -DCMAKE_CXX_STANDARD=${{ matrix.standard }} -DTOML11_BUILD_TESTS=ON -DTOML11_PRECOMPILE=${{ matrix.precompile }} + # - name: Build + # run: | + # cmake --build build/ + # - name: Test + # run: | + # ctest --output-on-failure --test-dir build/ - build-osx-12: - runs-on: macos-12 - strategy: - matrix: - standard: ['11', '14', '17', '20'] - precompile: ['ON', 'OFF'] - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - submodules: true - - name: Configure - run: | - cmake -B build/ -DCMAKE_CXX_STANDARD=${{ matrix.standard }} -DTOML11_BUILD_TESTS=ON -DTOML11_PRECOMPILE=${{ matrix.precompile }} - - name: Build - run: | - cmake --build build/ - - name: Test - run: | - ctest --output-on-failure --test-dir build/ + # build-osx-12: + # runs-on: macos-12 + # strategy: + # matrix: + # standard: ['11', '14', '17', '20'] + # precompile: ['ON', 'OFF'] + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # with: + # submodules: true + # - name: Configure + # run: | + # cmake -B build/ -DCMAKE_CXX_STANDARD=${{ matrix.standard }} -DTOML11_BUILD_TESTS=ON -DTOML11_PRECOMPILE=${{ matrix.precompile }} + # - name: Build + # run: | + # cmake --build build/ + # - name: Test + # run: | + # ctest --output-on-failure --test-dir build/ build-windows-msvc: runs-on: windows-2022 From b2ea268d69c68599e30787ee2431978d3fdc6ec1 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Sat, 6 Jul 2024 02:30:09 +0900 Subject: [PATCH 5/5] fix: unreachable code --- include/toml11/value.hpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/include/toml11/value.hpp b/include/toml11/value.hpp index 6139ad9..6ac4319 100644 --- a/include/toml11/value.hpp +++ b/include/toml11/value.hpp @@ -1775,19 +1775,20 @@ class basic_value { switch(this->type_) { - case value_t::boolean : { boolean_ .~boolean_storage (); return; } - case value_t::integer : { integer_ .~integer_storage (); return; } - case value_t::floating : { floating_ .~floating_storage (); return; } - case value_t::string : { string_ .~string_storage (); return; } - case value_t::offset_datetime : { offset_datetime_.~offset_datetime_storage (); return; } - case value_t::local_datetime : { local_datetime_ .~local_datetime_storage (); return; } - case value_t::local_date : { local_date_ .~local_date_storage (); return; } - case value_t::local_time : { local_time_ .~local_time_storage (); return; } - case value_t::array : { array_ .~array_storage (); return; } - case value_t::table : { table_ .~table_storage (); return; } - default : { return; } + case value_t::boolean : { boolean_ .~boolean_storage (); break; } + case value_t::integer : { integer_ .~integer_storage (); break; } + case value_t::floating : { floating_ .~floating_storage (); break; } + case value_t::string : { string_ .~string_storage (); break; } + case value_t::offset_datetime : { offset_datetime_.~offset_datetime_storage (); break; } + case value_t::local_datetime : { local_datetime_ .~local_datetime_storage (); break; } + case value_t::local_date : { local_date_ .~local_date_storage (); break; } + case value_t::local_time : { local_time_ .~local_time_storage (); break; } + case value_t::array : { array_ .~array_storage (); break; } + case value_t::table : { table_ .~table_storage (); break; } + default : { break; } } this->type_ = value_t::empty; + return; } template