Skip to content

Commit f7973f4

Browse files
authored
Use official Clang/GCC containers (nlohmann#3703)
1 parent 4c8cdd7 commit f7973f4

File tree

12 files changed

+117
-7041
lines changed

12 files changed

+117
-7041
lines changed

.clang-tidy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Checks: '*,
3333
-llvm-header-guard,
3434
-llvm-include-order,
3535
-llvmlibc-*,
36+
-misc-confusable-identifiers,
3637
-misc-no-recursion,
3738
-misc-non-private-member-variables-in-classes,
3839
-modernize-concat-nested-namespaces,

.github/workflows/ubuntu.yml

Lines changed: 63 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@ concurrency:
1616
jobs:
1717
ci_test_clang:
1818
runs-on: ubuntu-latest
19-
container: ghcr.io/nlohmann/json-ci:v2.4.0
19+
container: silkeh/clang:dev
2020
steps:
21+
- name: Install git
22+
run: apt-get update ; apt-get install -y git
2123
- uses: actions/checkout@v3
24+
- name: Get latest CMake and ninja
25+
uses: lukka/get-cmake@latest
2226
- name: Run CMake
2327
run: cmake -S . -B build -DJSON_CI=On
2428
- name: Build
@@ -39,32 +43,54 @@ jobs:
3943
container: ghcr.io/nlohmann/json-ci:v2.4.0
4044
strategy:
4145
matrix:
42-
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]
46+
target: [ci_cppcheck, ci_test_valgrind, ci_test_amalgamation, ci_test_single_header, ci_single_binaries, ci_infer]
4347
steps:
4448
- uses: actions/checkout@v3
4549
- name: Run CMake
4650
run: cmake -S . -B build -DJSON_CI=On
4751
- name: Build
4852
run: cmake --build build --target ${{ matrix.target }}
4953

50-
ci_test_single_header:
54+
ci_static_analysis_ubuntu:
5155
runs-on: ubuntu-latest
52-
container: ghcr.io/nlohmann/json-ci:v2.4.0
56+
strategy:
57+
matrix:
58+
target: [ci_cpplint, ci_cmake_flags, ci_reproducible_tests, ci_non_git_tests, ci_offline_testdata]
5359
steps:
5460
- uses: actions/checkout@v3
61+
- name: Get latest CMake and ninja
62+
uses: lukka/get-cmake@latest
5563
- name: Run CMake
5664
run: cmake -S . -B build -DJSON_CI=On
5765
- name: Build
58-
run: cmake --build build --target ci_test_single_header
66+
run: cmake --build build --target ${{ matrix.target }}
67+
68+
ci_static_analysis_clang:
69+
runs-on: ubuntu-latest
70+
container: silkeh/clang:dev
71+
strategy:
72+
matrix:
73+
target: [ci_clang_tidy, ci_test_clang_sanitizer, ci_clang_analyze]
74+
steps:
75+
- name: Install git
76+
run: apt-get update ; apt-get install -y git
77+
- uses: actions/checkout@v3
78+
- name: Get latest CMake and ninja
79+
uses: lukka/get-cmake@latest
80+
- name: Run CMake
81+
run: cmake -S . -B build -DJSON_CI=On
82+
- name: Build
83+
run: cmake --build build --target ${{ matrix.target }}
5984

6085
ci_cmake_options:
6186
runs-on: ubuntu-latest
62-
container: ghcr.io/nlohmann/json-ci:v2.4.0
6387
strategy:
6488
matrix:
6589
target: [ci_test_diagnostics, ci_test_noexceptions, ci_test_noimplicitconversions, ci_test_legacycomparison, ci_test_noglobaludls]
6690
steps:
6791
- uses: actions/checkout@v3
92+
- name: Get latest CMake and ninja
93+
uses: lukka/get-cmake@latest
6894
- name: Run CMake
6995
run: cmake -S . -B build -DJSON_CI=On
7096
- name: Build
@@ -90,12 +116,42 @@ jobs:
90116
github-token: ${{ secrets.GITHUB_TOKEN }}
91117
path-to-lcov: ${{ github.workspace }}/build/json.info.filtered.noexcept
92118

119+
ci_test_compilers_gcc:
120+
runs-on: ubuntu-latest
121+
strategy:
122+
matrix:
123+
compiler: ['4', '5', '6', '7', '8', '9', '10', '11', '12', 'latest']
124+
container: gcc:${{ matrix.compiler }}
125+
steps:
126+
- uses: actions/checkout@v3
127+
- name: Get latest CMake and ninja
128+
uses: lukka/get-cmake@latest
129+
- name: Run CMake
130+
run: cmake -S . -B build -DJSON_CI=On
131+
- name: Build
132+
run: cmake --build build --target ci_test_compiler_default
133+
134+
ci_test_compilers_clang:
135+
runs-on: ubuntu-latest
136+
strategy:
137+
matrix:
138+
compiler: ['3.5', '3.6', '3.7', '3.8', '3.9', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', 'latest']
139+
container: silkeh/clang:${{ matrix.compiler }}
140+
steps:
141+
- uses: actions/checkout@v3
142+
- name: Get latest CMake and ninja
143+
uses: lukka/get-cmake@latest
144+
- name: Run CMake
145+
run: cmake -S . -B build -DJSON_CI=On
146+
- name: Build
147+
run: cmake --build build --target ci_test_compiler_default
148+
93149
ci_test_compilers:
94150
runs-on: ubuntu-latest
95151
container: ghcr.io/nlohmann/json-ci:v2.4.0
96152
strategy:
97153
matrix:
98-
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]
154+
compiler: [g++-4.8]
99155
steps:
100156
- uses: actions/checkout@v3
101157
- name: Run CMake

.reuse/dep5

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ Files: tools/amalgamate/*
2727
Copyright: 2012 Erik Edlund <erik.edlund@32767.se>
2828
License: BSD-3-Clause
2929

30-
Files: tools/cpplint/*
31-
Copyright: 2009 Google Inc. All rights reserved.
32-
License: BSD-3-Clause
33-
3430
Files: tools/gdb_pretty_printer
3531
Copyright: 2020 Hannes Domani <https://github.com/ssbssa>
3632
License: MIT

README.md

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,39 +1152,40 @@ The following compilers are currently used in continuous integration at [AppVeyo
11521152
| Apple Clang 13.0.0 (clang-1300.0.29.30); Xcode 13.2.1 | macOS 12.4 | GitHub Actions |
11531153
| Apple Clang 13.1.6 (clang-1316.0.21.2.3); Xcode 13.3.1 | macOS 12.4 | GitHub Actions |
11541154
| Apple Clang 13.1.6 (clang-1316.0.21.2.5); Xcode 13.4.1 | macOS 12.4 | GitHub Actions |
1155-
| Clang 3.5.2 (3.5.2-3ubuntu1) | Ubuntu 20.04.3 LTS | GitHub Actions |
1156-
| Clang 3.6.2 (3.6.2-3ubuntu2) | Ubuntu 20.04.3 LTS | GitHub Actions |
1157-
| Clang 3.7.1 (3.7.1-2ubuntu2) | Ubuntu 20.04.3 LTS | GitHub Actions |
1158-
| Clang 3.8.0 (3.8.0-2ubuntu4) | Ubuntu 20.04.3 LTS | GitHub Actions |
1159-
| Clang 3.9.1 (3.9.1-4ubuntu3\~16.04.2) | Ubuntu 20.04.3 LTS | GitHub Actions |
1160-
| Clang 4.0.0 (4.0.0-1ubuntu1\~16.04.2) | Ubuntu 20.04.3 LTS | GitHub Actions |
1161-
| Clang 5.0.0 (5.0.0-3\~16.04.1) | Ubuntu 20.04.3 LTS | GitHub Actions |
1162-
| Clang 6.0.1 (6.0.1-14) | Ubuntu 20.04.3 LTS | GitHub Actions |
1163-
| Clang 7.0.1 (7.0.1-12) | Ubuntu 20.04.3 LTS | GitHub Actions |
1164-
| Clang 8.0.1 (8.0.1-9) | Ubuntu 20.04.3 LTS | GitHub Actions |
1165-
| Clang 9.0.1 (9.0.1-12) | Ubuntu 20.04.3 LTS | GitHub Actions |
1166-
| Clang 10.0.0 (10.0.0-4ubuntu1) | Ubuntu 20.04.3 LTS | GitHub Actions |
1155+
| Clang 3.5.2 | Ubuntu 20.04.3 LTS | GitHub Actions |
1156+
| Clang 3.6.2 | Ubuntu 20.04.3 LTS | GitHub Actions |
1157+
| Clang 3.7.1 | Ubuntu 20.04.3 LTS | GitHub Actions |
1158+
| Clang 3.8.1 | Ubuntu 20.04.3 LTS | GitHub Actions |
1159+
| Clang 3.9.1 | Ubuntu 20.04.3 LTS | GitHub Actions |
1160+
| Clang 4.0.1 | Ubuntu 20.04.3 LTS | GitHub Actions |
1161+
| Clang 5.0.2 | Ubuntu 20.04.3 LTS | GitHub Actions |
1162+
| Clang 6.0.1 | Ubuntu 20.04.3 LTS | GitHub Actions |
1163+
| Clang 7.0.1 | Ubuntu 20.04.3 LTS | GitHub Actions |
1164+
| Clang 8.0.0 | Ubuntu 20.04.3 LTS | GitHub Actions |
1165+
| Clang 9.0.0 | Ubuntu 20.04.3 LTS | GitHub Actions |
1166+
| Clang 10.0.0 | Ubuntu 20.04.3 LTS | GitHub Actions |
11671167
| Clang 10.0.0 with GNU-like command-line | Windows-10.0.17763 | GitHub Actions |
11681168
| Clang 11.0.0 with GNU-like command-line | Windows-10.0.17763 | GitHub Actions |
11691169
| Clang 11.0.0 with MSVC-like command-line | Windows-10.0.17763 | GitHub Actions |
1170-
| Clang 11.0.0 (11.0.0-2~ubuntu20.04.1) | Ubuntu 20.04.3 LTS | GitHub Actions |
1171-
| Clang 12.0.0 (12.0.0-3ubuntu1~20.04.3) | Ubuntu 20.04.3 LTS | GitHub Actions |
1172-
| Clang 13.0.1 (13.0.1-++20211015123032+cf15ccdeb6d5-1exp120211015003613.5) | Ubuntu 20.04.3 LTS | GitHub Actions |
1173-
| Clang 14.0.5-++20220603124341+2f0a69c32a4c-1~exp1~20220603124352.149 | Ubuntu 20.04.3 LTS | GitHub Actions |
1174-
| Clang 15.0.0 (15.0.0-++20220530052901+b7d2b160c3ba-1~exp1~20220530172952.268) | Ubuntu 20.04.3 LTS | GitHub Actions |
1170+
| Clang 11.0.0 | Ubuntu 20.04.3 LTS | GitHub Actions |
1171+
| Clang 12.0.0 | Ubuntu 20.04.3 LTS | GitHub Actions |
1172+
| Clang 13.0.0 | Ubuntu 20.04.3 LTS | GitHub Actions |
1173+
| Clang 14.0.0 | Ubuntu 20.04.3 LTS | GitHub Actions |
1174+
| Clang 15.0.0 (15.0.0-++20220719071818+5fc621355110-1~exp1~20220719071918.324) | Ubuntu 20.04.3 LTS | GitHub Actions |
11751175
| GCC 4.8.5 (Ubuntu 4.8.5-4ubuntu2) | Ubuntu 20.04.3 LTS | GitHub Actions |
1176-
| GCC 4.9.3 (Ubuntu 4.9.3-13ubuntu2) | Ubuntu 20.04.3 LTS | GitHub Actions |
1177-
| GCC 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.12) | Ubuntu 20.04.3 LTS | GitHub Actions |
1178-
| GCC 6.4.0 (Ubuntu 6.4.0-17ubuntu1) | Ubuntu 20.04.3 LTS | GitHub Actions |
1179-
| GCC 7.5.0 (Ubuntu 7.5.0-6ubuntu2) | Ubuntu 20.04.3 LTS | GitHub Actions |
1176+
| GCC 4.9.4 | Ubuntu 20.04.3 LTS | GitHub Actions |
1177+
| GCC 5.5.0 | Ubuntu 20.04.3 LTS | GitHub Actions |
1178+
| GCC 6.5.0 | Ubuntu 20.04.3 LTS | GitHub Actions |
1179+
| GCC 7.5.0 | Ubuntu 20.04.3 LTS | GitHub Actions |
11801180
| GCC 8.1.0 (i686-posix-dwarf-rev0, Built by MinGW-W64 project) | Windows-10.0.17763 | GitHub Actions |
11811181
| GCC 8.1.0 (x86_64-posix-seh-rev0, Built by MinGW-W64 project) | Windows-10.0.17763 | GitHub Actions |
1182-
| GCC 8.4.0 (Ubuntu 8.4.0-3ubuntu2) | Ubuntu 20.04.3 LTS | GitHub Actions |
1183-
| GCC 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04) | Ubuntu 20.04.3 LTS | GitHub Actions |
1184-
| GCC 10.2.0 (Ubuntu 10.2.0-5ubuntu1~20.04) | Ubuntu 20.04.3 LTS | GitHub Actions |
1182+
| GCC 8.5.0 | Ubuntu 20.04.3 LTS | GitHub Actions |
1183+
| GCC 9.5.0 | Ubuntu 20.04.3 LTS | GitHub Actions |
1184+
| GCC 10.4.0 | Ubuntu 20.04.3 LTS | GitHub Actions |
11851185
| GCC 11.1.0 | Ubuntu (aarch64) | Drone CI |
1186-
| GCC 11.1.0 (Ubuntu 11.1.0-1ubuntu1~20.04) | Ubuntu 20.04.3 LTS | GitHub Actions |
1187-
| GCC 13.0.0 13.0.0 20220605 (experimental) | Ubuntu 20.04.3 LTS | GitHub Actions |
1186+
| GCC 11.3.0 | Ubuntu 20.04.3 LTS | GitHub Actions |
1187+
| GCC 12.2.0 | Ubuntu 20.04.3 LTS | GitHub Actions |
1188+
| GCC 13.0.0 20220605 (experimental) | Ubuntu 20.04.3 LTS | GitHub Actions |
11881189
| Intel C++ Compiler 2021.5.0.20211109 | Ubuntu 20.04.3 LTS | GitHub Actions |
11891190
| NVCC 11.0.221 | Ubuntu 20.04.3 LTS | GitHub Actions |
11901191
| Visual Studio 14 2015 MSVC 19.0.24241.7 (Build Engine version 14.0.25420.1) | Windows-6.3.9600 | AppVeyor |

cmake/ci.cmake

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ execute_process(COMMAND ${ASTYLE_TOOL} --version OUTPUT_VARIABLE ASTYLE_TOOL_VER
1313
string(REGEX MATCH "[0-9]+(\\.[0-9]+)+" ASTYLE_TOOL_VERSION "${ASTYLE_TOOL_VERSION}")
1414
message(STATUS "🔖 Artistic Style ${ASTYLE_TOOL_VERSION} (${ASTYLE_TOOL})")
1515

16-
find_program(CLANG_TOOL NAMES clang++-HEAD clang++-15 clang++-14 clang++-13 clang++-12 clang++-11 clang++)
16+
find_program(CLANG_TOOL NAMES clang++-HEAD clang++-16 clang++-15 clang++-14 clang++-13 clang++-12 clang++-11 clang++)
1717
execute_process(COMMAND ${CLANG_TOOL} --version OUTPUT_VARIABLE CLANG_TOOL_VERSION ERROR_VARIABLE CLANG_TOOL_VERSION)
1818
string(REGEX MATCH "[0-9]+(\\.[0-9]+)+" CLANG_TOOL_VERSION "${CLANG_TOOL_VERSION}")
1919
message(STATUS "🔖 Clang ${CLANG_TOOL_VERSION} (${CLANG_TOOL})")
@@ -30,7 +30,7 @@ execute_process(COMMAND ${CPPCHECK_TOOL} --version OUTPUT_VARIABLE CPPCHECK_TOOL
3030
string(REGEX MATCH "[0-9]+(\\.[0-9]+)+" CPPCHECK_TOOL_VERSION "${CPPCHECK_TOOL_VERSION}")
3131
message(STATUS "🔖 Cppcheck ${CPPCHECK_TOOL_VERSION} (${CPPCHECK_TOOL})")
3232

33-
find_program(GCC_TOOL NAMES g++-latest g++-HEAD g++-11 g++-10)
33+
find_program(GCC_TOOL NAMES g++-latest g++-HEAD g++-12 g++-11 g++-10)
3434
execute_process(COMMAND ${GCC_TOOL} --version OUTPUT_VARIABLE GCC_TOOL_VERSION ERROR_VARIABLE GCC_TOOL_VERSION)
3535
string(REGEX MATCH "[0-9]+(\\.[0-9]+)+" GCC_TOOL_VERSION "${GCC_TOOL_VERSION}")
3636
message(STATUS "🔖 GCC ${GCC_TOOL_VERSION} (${GCC_TOOL})")
@@ -667,8 +667,11 @@ add_custom_target(ci_cppcheck
667667
###############################################################################
668668

669669
add_custom_target(ci_cpplint
670-
COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/cpplint/cpplint.py --filter=-whitespace,-legal,-runtime/references,-runtime/explicit,-runtime/indentation_namespace,-readability/casting,-readability/nolint --quiet --recursive ${SRC_FILES}
670+
COMMAND ${Python3_EXECUTABLE} -mvenv venv_cpplint
671+
COMMAND venv_cpplint/bin/pip3 --quiet install cpplint
672+
COMMAND venv_cpplint/bin/cpplint --filter=-whitespace,-legal,-runtime/references,-runtime/explicit,-runtime/indentation_namespace,-readability/casting,-readability/nolint --quiet --recursive ${SRC_FILES}
671673
COMMENT "Check code with cpplint"
674+
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
672675
)
673676

674677
###############################################################################
@@ -929,6 +932,17 @@ foreach(COMPILER g++-4.8 g++-4.9 g++-5 g++-6 g++-7 g++-8 g++-9 g++-10 g++-11 cla
929932
unset(COMPILER_TOOL CACHE)
930933
endforeach()
931934

935+
add_custom_target(ci_test_compiler_default
936+
COMMAND ${CMAKE_COMMAND}
937+
-DCMAKE_BUILD_TYPE=Debug -GNinja
938+
-DJSON_BuildTests=ON -DJSON_FastTests=ON
939+
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_compiler_default
940+
${ADDITIONAL_FLAGS}
941+
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_compiler_default --parallel ${N}
942+
COMMAND cd ${PROJECT_BINARY_DIR}/build_compiler_default && ${CMAKE_CTEST_COMMAND} --parallel ${N} --exclude-regex "test-unicode" -LE git_required --output-on-failure
943+
COMMENT "Compile and test with default C++ compiler"
944+
)
945+
932946
###############################################################################
933947
# CUDA example
934948
###############################################################################

include/nlohmann/detail/iterators/iteration_proxy.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,11 @@ namespace std
219219
#pragma clang diagnostic ignored "-Wmismatched-tags"
220220
#endif
221221
template<typename IteratorType>
222-
class tuple_size<::nlohmann::detail::iteration_proxy_value<IteratorType>>
222+
class tuple_size<::nlohmann::detail::iteration_proxy_value<IteratorType>> // NOLINT(cert-dcl58-cpp)
223223
: public std::integral_constant<std::size_t, 2> {};
224224

225225
template<std::size_t N, typename IteratorType>
226-
class tuple_element<N, ::nlohmann::detail::iteration_proxy_value<IteratorType >>
226+
class tuple_element<N, ::nlohmann::detail::iteration_proxy_value<IteratorType >> // NOLINT(cert-dcl58-cpp)
227227
{
228228
public:
229229
using type = decltype(

include/nlohmann/json.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5160,7 +5160,7 @@ namespace std // NOLINT(cert-dcl58-cpp)
51605160
/// @brief hash value for JSON objects
51615161
/// @sa https://json.nlohmann.me/api/basic_json/std_hash/
51625162
NLOHMANN_BASIC_JSON_TPL_DECLARATION
5163-
struct hash<nlohmann::NLOHMANN_BASIC_JSON_TPL>
5163+
struct hash<nlohmann::NLOHMANN_BASIC_JSON_TPL> // NOLINT(cert-dcl58-cpp)
51645164
{
51655165
std::size_t operator()(const nlohmann::NLOHMANN_BASIC_JSON_TPL& j) const
51665166
{
@@ -5193,7 +5193,7 @@ struct less< ::nlohmann::detail::value_t> // do not remove the space after '<',
51935193
/// @brief exchanges the values of two JSON objects
51945194
/// @sa https://json.nlohmann.me/api/basic_json/std_swap/
51955195
NLOHMANN_BASIC_JSON_TPL_DECLARATION
5196-
inline void swap(nlohmann::NLOHMANN_BASIC_JSON_TPL& j1, nlohmann::NLOHMANN_BASIC_JSON_TPL& j2) noexcept( // NOLINT(readability-inconsistent-declaration-parameter-name)
5196+
inline void swap(nlohmann::NLOHMANN_BASIC_JSON_TPL& j1, nlohmann::NLOHMANN_BASIC_JSON_TPL& j2) noexcept( // NOLINT(readability-inconsistent-declaration-parameter-name, cert-dcl58-cpp)
51975197
is_nothrow_move_constructible<nlohmann::NLOHMANN_BASIC_JSON_TPL>::value&& // NOLINT(misc-redundant-expression)
51985198
is_nothrow_move_assignable<nlohmann::NLOHMANN_BASIC_JSON_TPL>::value)
51995199
{

0 commit comments

Comments
 (0)