Merge branch 'nlohmann:develop' into patch-1

This commit is contained in:
Kirill Lokotkov 2023-02-01 13:49:36 +03:00 committed by GitHub
commit ac03b999cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 20 deletions

View File

@ -1,13 +1,8 @@
kind: pipeline
name: test-on-arm64
arm_container:
image: gcc:latest
platform:
arch: arm64
steps:
- name: build
image: gcc
commands:
check_task:
check_script:
- wget https://github.com/Kitware/CMake/releases/download/v3.20.2/cmake-3.20.2.tar.gz
- tar xfz cmake-3.20.2.tar.gz
- cd cmake-3.20.2

View File

@ -146,6 +146,9 @@ jobs:
- uses: actions/checkout@v3
- name: Get latest CMake and ninja
uses: lukka/get-cmake@latest
- name: Set env FORCE_STDCPPFS_FLAG for clang 7 / 8 / 9 / 10
run: echo "JSON_FORCED_GLOBAL_COMPILE_OPTIONS=-DJSON_HAS_FILESYSTEM=0;-DJSON_HAS_EXPERIMENTAL_FILESYSTEM=0" >> "$GITHUB_ENV"
if: ${{ matrix.compiler == '7' || matrix.compiler == '8' || matrix.compiler == '9' || matrix.compiler == '10' }}
- name: Run CMake
run: cmake -S . -B build -DJSON_CI=On
- name: Build

View File

@ -7,7 +7,7 @@
[![Coverage Status](https://coveralls.io/repos/github/nlohmann/json/badge.svg?branch=develop)](https://coveralls.io/github/nlohmann/json?branch=develop)
[![Coverity Scan Build Status](https://scan.coverity.com/projects/5550/badge.svg)](https://scan.coverity.com/projects/nlohmann-json)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/e0d1a9d5d6fd46fcb655c4cb930bb3e8)](https://www.codacy.com/gh/nlohmann/json/dashboard?utm_source=github.com&utm_medium=referral&utm_content=nlohmann/json&utm_campaign=Badge_Grade)
[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/nlohmann/json.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/nlohmann/json/context:cpp)
[![Cirrus CI](https://api.cirrus-ci.com/github/nlohmann/json.svg)](https://cirrus-ci.com/github/nlohmann/json)
[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/json.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:json)
[![Try online](https://img.shields.io/badge/try-online-blue.svg)](https://wandbox.org/permlink/1mp10JbaANo6FUc7)
[![Documentation](https://img.shields.io/badge/docs-mkdocs-blue.svg)](https://json.nlohmann.me)
@ -1109,7 +1109,7 @@ auto cbor = json::to_msgpack(j); // 0xD5 (fixext2), 0x10, 0xCA, 0xFE
## Supported compilers
Though it's 2022 already, the support for C++11 is still a bit sparse. Currently, the following compilers are known to work:
Though it's 2023 already, the support for C++11 is still a bit sparse. Currently, the following compilers are known to work:
- GCC 4.8 - 12.0 (and possibly later)
- Clang 3.4 - 15.0 (and possibly later)
@ -1140,7 +1140,7 @@ Please note:
- Unsupported versions of GCC and Clang are rejected by `#error` directives. This can be switched off by defining `JSON_SKIP_UNSUPPORTED_COMPILER_CHECK`. Note that you can expect no support in this case.
The following compilers are currently used in continuous integration at [AppVeyor](https://ci.appveyor.com/project/nlohmann/json), [Drone CI](https://cloud.drone.io/nlohmann/json), and [GitHub Actions](https://github.com/nlohmann/json/actions):
The following compilers are currently used in continuous integration at [AppVeyor](https://ci.appveyor.com/project/nlohmann/json), [Cirrus CI](https://cirrus-ci.com/github/nlohmann/json), and [GitHub Actions](https://github.com/nlohmann/json/actions):
| Compiler | Operating System | CI Provider |
|--------------------------------------------------------------------------------------------------------|--------------------|----------------|
@ -1190,7 +1190,7 @@ The following compilers are currently used in continuous integration at [AppVeyo
| GCC 8.5.0 | Ubuntu 20.04.3 LTS | GitHub Actions |
| GCC 9.5.0 | Ubuntu 20.04.3 LTS | GitHub Actions |
| GCC 10.4.0 | Ubuntu 20.04.3 LTS | GitHub Actions |
| GCC 11.1.0 | Ubuntu (aarch64) | Drone CI |
| GCC 11.1.0 | Ubuntu (aarch64) | Cirrus CI |
| GCC 11.3.0 | Ubuntu 20.04.3 LTS | GitHub Actions |
| GCC 12.2.0 | Ubuntu 20.04.3 LTS | GitHub Actions |
| GCC 13.0.0 20220605 (experimental) | Ubuntu 20.04.3 LTS | GitHub Actions |

View File

@ -901,12 +901,7 @@ add_custom_target(ci_cmake_flags
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")
# fix for https://github.com/nlohmann/json/pull/3101#issuecomment-998788786 / https://stackoverflow.com/a/64051725/266378
set(ADDITIONAL_FLAGS "-DCMAKE_CXX_FLAGS=--gcc-toolchain=/root/gcc/9")
else()
unset(ADDITIONAL_FLAGS)
endif()
unset(ADDITIONAL_FLAGS)
add_custom_target(ci_test_compiler_${COMPILER}
COMMAND CXX=${COMPILER} ${CMAKE_COMMAND}

View File

@ -6,6 +6,15 @@ option(JSON_FastTests "Skip expensive/slow tests." OFF)
set(JSON_32bitTest AUTO CACHE STRING "Enable the 32bit unit test (ON/OFF/AUTO/ONLY).")
set(JSON_TestStandards "" CACHE STRING "The list of standards to test explicitly.")
# using an env var, since this will also affect targets executing cmake (such as "ci_test_compiler_default")
set(JSON_FORCED_GLOBAL_COMPILE_OPTIONS $ENV{JSON_FORCED_GLOBAL_COMPILE_OPTIONS})
if (NOT "" STREQUAL "$ENV{JSON_FORCED_GLOBAL_COMPILE_OPTIONS}")
add_compile_options($ENV{JSON_FORCED_GLOBAL_COMPILE_OPTIONS})
endif()
if (NOT "" STREQUAL "$ENV{JSON_FORCED_GLOBAL_LINK_OPTIONS}")
add_link_options($ENV{JSON_FORCED_GLOBAL_LINK_OPTIONS})
endif()
include(test)
#############################################################################

View File

@ -37,7 +37,9 @@ using ordered_json = nlohmann::ordered_json;
#endif
#ifdef JSON_HAS_CPP_20
#include <span>
#if __has_include(<span>)
#include <span>
#endif
#endif
// NLOHMANN_JSON_SERIALIZE_ENUM uses a static std::pair
@ -664,6 +666,7 @@ TEST_CASE("regression tests 2")
}
#ifdef JSON_HAS_CPP_20
#if __has_include(<span>)
SECTION("issue #2546 - parsing containers of std::byte")
{
const char DATA[] = R"("Hello, world!")"; // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
@ -671,6 +674,7 @@ TEST_CASE("regression tests 2")
const json j = json::parse(s);
CHECK(j.dump() == "\"Hello, world!\"");
}
#endif
#endif
SECTION("issue #2574 - Deserialization to std::array, std::pair, and std::tuple with non-default constructable types fails")