diff --git a/.clang-tidy b/.clang-tidy index 3673930d4b..b981348f37 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -43,6 +43,7 @@ Checks: '*, -readability-identifier-length, -readability-magic-numbers, -readability-redundant-access-specifiers, + -readability-simplify-boolean-expr -readability-uppercase-literal-suffix' CheckOptions: diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 39098e4d79..c243326289 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -12,7 +12,7 @@ on: jobs: ci_test_clang: runs-on: ubuntu-latest - container: ghcr.io/nlohmann/json-ci:v2.3.0 + container: ghcr.io/nlohmann/json-ci:v2.4.0 steps: - uses: actions/checkout@v3 - name: cmake @@ -22,7 +22,7 @@ jobs: ci_test_gcc: runs-on: ubuntu-latest - container: ghcr.io/nlohmann/json-ci:v2.3.0 + container: ghcr.io/nlohmann/json-ci:v2.4.0 steps: - uses: actions/checkout@v3 - name: cmake @@ -32,7 +32,7 @@ jobs: ci_static_analysis: runs-on: ubuntu-latest - container: ghcr.io/nlohmann/json-ci:v2.3.0 + container: ghcr.io/nlohmann/json-ci:v2.4.0 strategy: matrix: target: [ci_clang_tidy, ci_cppcheck, ci_test_valgrind, ci_test_clang_sanitizer, ci_test_amalgamation, ci_clang_analyze, ci_cpplint, ci_cmake_flags, ci_single_binaries, ci_reproducible_tests, ci_non_git_tests, ci_offline_testdata, ci_infer] @@ -45,7 +45,7 @@ jobs: ci_cmake_options: runs-on: ubuntu-latest - container: ghcr.io/nlohmann/json-ci:v2.3.0 + container: ghcr.io/nlohmann/json-ci:v2.4.0 strategy: matrix: target: [ci_test_diagnostics, ci_test_noexceptions, ci_test_noimplicitconversions, ci_test_legacycomparison] @@ -58,7 +58,7 @@ jobs: ci_test_coverage: runs-on: ubuntu-latest - container: ghcr.io/nlohmann/json-ci:v2.3.0 + container: ghcr.io/nlohmann/json-ci:v2.4.0 steps: - uses: actions/checkout@v3 - name: cmake @@ -78,10 +78,10 @@ jobs: ci_test_compilers: runs-on: ubuntu-latest - container: ghcr.io/nlohmann/json-ci:v2.3.0 + container: ghcr.io/nlohmann/json-ci:v2.4.0 strategy: matrix: - compiler: [g++-4.8, g++-4.9, g++-5, g++-6, g++-7, g++-8, g++-9, g++-10, clang++-3.5, clang++-3.6, clang++-3.7, clang++-3.8, clang++-3.9, clang++-4.0, clang++-5.0, clang++-6.0, clang++-7, clang++-8, clang++-9, clang++-10, clang++-11, clang++-12, clang++-13, clang++-14] + compiler: [g++-4.8, g++-4.9, g++-5, g++-6, g++-7, g++-8, g++-9, g++-10, g++-11, clang++-3.5, clang++-3.6, clang++-3.7, clang++-3.8, clang++-3.9, clang++-4.0, clang++-5.0, clang++-6.0, clang++-7, clang++-8, clang++-9, clang++-10, clang++-11, clang++-12, clang++-13, clang++-14] steps: - uses: actions/checkout@v3 - name: cmake @@ -91,7 +91,7 @@ jobs: ci_test_standards: runs-on: ubuntu-latest - container: ghcr.io/nlohmann/json-ci:v2.3.0 + container: ghcr.io/nlohmann/json-ci:v2.4.0 strategy: matrix: standard: [11, 14, 17, 20] @@ -105,7 +105,7 @@ jobs: ci_cuda_example: runs-on: ubuntu-latest - container: ghcr.io/nlohmann/json-ci:v2.3.0 + container: ghcr.io/nlohmann/json-ci:v2.4.0 steps: - uses: actions/checkout@v3 - name: cmake diff --git a/README.md b/README.md index 1f4ea0e610..220b3a9f15 100644 --- a/README.md +++ b/README.md @@ -1110,8 +1110,8 @@ The following compilers are currently used in continuous integration at [AppVeyo | Clang 11.0.0 (11.0.0-2~ubuntu20.04.1) | Ubuntu 20.04.3 LTS | GitHub Actions | | Clang 12.0.0 (12.0.0-3ubuntu1~20.04.3) | Ubuntu 20.04.3 LTS | GitHub Actions | | Clang 13.0.1 (13.0.1-++20211015123032+cf15ccdeb6d5-1exp120211015003613.5) | Ubuntu 20.04.3 LTS | GitHub Actions | -| Clang 14.0.0 (14.0.0-++20211221052852+55c71c9eac9b-1exp120211221172954.95) | Ubuntu 20.04.3 LTS | GitHub Actions | -| Clang 15.0.0 (15.0.0-++20220403052648+896770c9a92e-1~exp1~20220403172744.209) | Ubuntu 20.04.3 LTS | GitHub Actions | +| Clang 14.0.5-++20220603124341+2f0a69c32a4c-1~exp1~20220603124352.149 | Ubuntu 20.04.3 LTS | GitHub Actions | +| Clang 15.0.0 (15.0.0-++20220530052901+b7d2b160c3ba-1~exp1~20220530172952.268) | Ubuntu 20.04.3 LTS | GitHub Actions | | GCC 4.8.5 (Ubuntu 4.8.5-4ubuntu2) | Ubuntu 20.04.3 LTS | GitHub Actions | | GCC 4.9.3 (Ubuntu 4.9.3-13ubuntu2) | Ubuntu 20.04.3 LTS | GitHub Actions | | GCC 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.12) | Ubuntu 20.04.3 LTS | GitHub Actions | @@ -1123,7 +1123,8 @@ The following compilers are currently used in continuous integration at [AppVeyo | GCC 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04) | Ubuntu 20.04.3 LTS | GitHub Actions | | GCC 10.2.0 (Ubuntu 10.2.0-5ubuntu1~20.04) | Ubuntu 20.04.3 LTS | GitHub Actions | | GCC 11.1.0 | Ubuntu (aarch64) | Drone CI | -| GCC 12.0.0 20211219 (experimental) | Ubuntu 20.04.3 LTS | GitHub Actions | +| GCC 11.1.0 (Ubuntu 11.1.0-1ubuntu1~20.04) | Ubuntu 20.04.3 LTS | GitHub Actions | +| GCC 13.0.0 13.0.0 20220605 (experimental) | Ubuntu 20.04.3 LTS | GitHub Actions | | Intel C++ Compiler 2021.5.0.20211109 | Ubuntu 20.04.3 LTS | GitHub Actions | | NVCC 11.0.221 | Ubuntu 20.04.3 LTS | GitHub Actions | | Visual Studio 14 2015 MSVC 19.0.24241.7 (Build Engine version 14.0.25420.1) | Windows-6.3.9600 | AppVeyor | diff --git a/cmake/ci.cmake b/cmake/ci.cmake index a571c493b4..d813a17739 100644 --- a/cmake/ci.cmake +++ b/cmake/ci.cmake @@ -111,7 +111,7 @@ set(CLANG_CXXFLAGS -Wno-reserved-identifier ) -# Warning flags determined for GCC 12.0 (experimental) with https://github.com/nlohmann/gcc_flags: +# Warning flags determined for GCC 13.0 (experimental) with https://github.com/nlohmann/gcc_flags: # Ignored GCC warnings: # -Wno-abi-tag We do not care about ABI tags. # -Wno-aggregate-return The library uses aggregate returns. @@ -161,10 +161,13 @@ set(GCC_CXXFLAGS -Wanalyzer-use-after-free -Wanalyzer-use-of-pointer-in-stale-stack-frame -Wanalyzer-use-of-uninitialized-value + -Wanalyzer-va-arg-type-mismatch + -Wanalyzer-va-list-exhausted + -Wanalyzer-va-list-leak + -Wanalyzer-va-list-use-after-va-end -Wanalyzer-write-to-const -Wanalyzer-write-to-string-literal -Warith-conversion - -Warray-bounds -Warray-bounds=2 -Warray-compare -Warray-parameter=2 @@ -209,6 +212,7 @@ set(GCC_CXXFLAGS -Wctad-maybe-unsupported -Wctor-dtor-privacy -Wdangling-else + -Wdangling-pointer=2 -Wdate-time -Wdelete-incomplete -Wdelete-non-virtual-dtor @@ -279,6 +283,7 @@ set(GCC_CXXFLAGS -Wmissing-include-dirs -Wmissing-profile -Wmissing-requires + -Wmissing-template-keyword -Wmultichar -Wmultiple-inheritance -Wmultistatement-macros @@ -340,9 +345,9 @@ set(GCC_CXXFLAGS -Wsizeof-pointer-div -Wsizeof-pointer-memaccess -Wstack-protector - -Wstrict-aliasing -Wstrict-aliasing=3 -Wstrict-null-sentinel + -Wno-strict-overflow -Wstring-compare -Wstringop-overflow=4 -Wstringop-overread @@ -371,6 +376,7 @@ set(GCC_CXXFLAGS -Wterminate -Wtrampolines -Wtrigraphs + -Wtrivial-auto-var-init -Wtsan -Wtype-limits -Wundef @@ -390,6 +396,7 @@ set(GCC_CXXFLAGS -Wunused-result -Wunused-value -Wunused-variable + -Wuse-after-free=3 -Wuseless-cast -Wvarargs -Wvariadic-macros @@ -710,6 +717,7 @@ add_custom_target(ci_offline_testdata ############################################################################### add_custom_target(ci_non_git_tests + COMMAND git config --global --add safe.directory ${PROJECT_SOURCE_DIR} COMMAND mkdir -p ${PROJECT_BINARY_DIR}/build_non_git_tests/sources COMMAND cd ${PROJECT_SOURCE_DIR} && for FILE in `${GIT_TOOL} ls-tree --name-only HEAD`\; do cp -r $$FILE ${PROJECT_BINARY_DIR}/build_non_git_tests/sources \; done COMMAND ${CMAKE_COMMAND} @@ -854,7 +862,7 @@ add_custom_target(ci_cmake_flags # Use more installed compilers. ############################################################################### -foreach(COMPILER g++-4.8 g++-4.9 g++-5 g++-6 g++-7 g++-8 g++-9 g++-10 clang++-3.5 clang++-3.6 clang++-3.7 clang++-3.8 clang++-3.9 clang++-4.0 clang++-5.0 clang++-6.0 clang++-7 clang++-8 clang++-9 clang++-10 clang++-11 clang++-12 clang++-13 clang++-14) +foreach(COMPILER g++-4.8 g++-4.9 g++-5 g++-6 g++-7 g++-8 g++-9 g++-10 g++-11 clang++-3.5 clang++-3.6 clang++-3.7 clang++-3.8 clang++-3.9 clang++-4.0 clang++-5.0 clang++-6.0 clang++-7 clang++-8 clang++-9 clang++-10 clang++-11 clang++-12 clang++-13 clang++-14) find_program(COMPILER_TOOL NAMES ${COMPILER}) if (COMPILER_TOOL) if ("${COMPILER}" STREQUAL "clang++-9") diff --git a/include/nlohmann/detail/meta/type_traits.hpp b/include/nlohmann/detail/meta/type_traits.hpp index 0901b71bb5..cc34831224 100644 --- a/include/nlohmann/detail/meta/type_traits.hpp +++ b/include/nlohmann/detail/meta/type_traits.hpp @@ -183,7 +183,7 @@ template struct conjunction : std::true_type { }; template struct conjunction : B { }; template struct conjunction -: std::conditional, B>::type {}; +: std::conditional(B::value), conjunction, B>::type {}; // https://en.cppreference.com/w/cpp/types/negation template struct negation : std::integral_constant < bool, !B::value > { }; diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 3dcd480274..c5fd3fd0bf 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -3374,7 +3374,7 @@ template struct conjunction : std::true_type { }; template struct conjunction : B { }; template struct conjunction -: std::conditional, B>::type {}; +: std::conditional(B::value), conjunction, B>::type {}; // https://en.cppreference.com/w/cpp/types/negation template struct negation : std::integral_constant < bool, !B::value > { };