92 Commits

Author SHA1 Message Date
Niels Lohmann
dfb9eb6eec
🚨 fix warning
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
2025-04-24 08:31:54 +02:00
dependabot[bot]
7ddea2686f
⬆️ Bump cpplint from 2.0.1 to 2.0.2 in /cmake/requirements (#4728)
Bumps [cpplint](https://github.com/cpplint/cpplint) from 2.0.1 to 2.0.2.
- [Release notes](https://github.com/cpplint/cpplint/releases)
- [Changelog](https://github.com/cpplint/cpplint/blob/develop/CHANGELOG.rst)
- [Commits](https://github.com/cpplint/cpplint/compare/2.0.1...2.0.2)

---
updated-dependencies:
- dependency-name: cpplint
  dependency-version: 2.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-11 10:56:23 +02:00
dependabot[bot]
9ef4967389
⬆️ Bump cpplint from 2.0.0 to 2.0.1 in /cmake/requirements (#4719)
Bumps [cpplint](https://github.com/cpplint/cpplint) from 2.0.0 to 2.0.1.
- [Release notes](https://github.com/cpplint/cpplint/releases)
- [Changelog](https://github.com/cpplint/cpplint/blob/develop/CHANGELOG.rst)
- [Commits](https://github.com/cpplint/cpplint/compare/2.0.0...2.0.1)

---
updated-dependencies:
- dependency-name: cpplint
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-03 07:39:59 +02:00
Niels Lohmann
d41ca94fa8
Adjust CMake minimal version (#4709)
* 🔧 adjust CMake versions

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 🔧 install OpenSSL for CMake

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 🔧 install OpenSSL for CMake

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 🔧 install OpenSSL for CMake

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 🔧 install OpenSSL for CMake

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 🔧 install OpenSSL for CMake

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 🔨 clean up

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 📝 update documentation

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

---------

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
2025-04-01 14:42:08 +02:00
dependabot[bot]
3a5703931a
⬆️ Bump cppcheck from 1.4.8 to 1.5.0 in /cmake/requirements (#4698)
Bumps [cppcheck](https://github.com/msclock/cppcheck-wheel) from 1.4.8 to 1.5.0.
- [Release notes](https://github.com/msclock/cppcheck-wheel/releases)
- [Changelog](https://github.com/msclock/cppcheck-wheel/blob/master/.releaserc.js)
- [Commits](https://github.com/msclock/cppcheck-wheel/compare/v1.4.8...v1.5.0)

---
updated-dependencies:
- dependency-name: cppcheck
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-29 16:33:52 +01:00
dependabot[bot]
11a835df85
⬆️ Bump cppcheck from 1.4.7 to 1.4.8 in /cmake/requirements (#4697)
Bumps [cppcheck](https://github.com/msclock/cppcheck-wheel) from 1.4.7 to 1.4.8.
- [Release notes](https://github.com/msclock/cppcheck-wheel/releases)
- [Changelog](https://github.com/msclock/cppcheck-wheel/blob/master/.releaserc.js)
- [Commits](https://github.com/msclock/cppcheck-wheel/compare/v1.4.7...v1.4.8)

---
updated-dependencies:
- dependency-name: cppcheck
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-19 08:29:39 +01:00
Niels Lohmann
26cfec34be
Clean up and document project files (#4560) 2025-01-17 06:53:35 +01:00
Niels Lohmann
ad2ee18539
Fix coverage job (#4595)
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
2025-01-15 18:08:37 +01:00
Harinath Nampally
a6255cc418
add a ci step for Json_Diagnostic_Positions (#4579)
* add a ci step for Json_Diagnostic_Positions

Signed-off-by: Harinath Nampally <harinath922@gmail.com>

* Update ci.cmake to address review comments

Signed-off-by: Harinath Nampally <harinath922@gmail.com>

* address review comment

Signed-off-by: Harinath Nampally <harinath922@gmail.com>

* fix typo in the comment

Signed-off-by: Harinath Nampally <harinath922@gmail.com>

* fix typos in ci.cmake

Signed-off-by: Harinath Nampally <harinath922@gmail.com>

* invoke the new ci step from ubuntu.yml

Signed-off-by: Harinath Nampally <harinath922@gmail.com>

---------

Signed-off-by: Harinath Nampally <harinath922@gmail.com>
2025-01-03 07:15:37 +01:00
Niels Lohmann
6057b31df7
Overwork astyle call (#4573)
* 🔧 overwork astyle call

* 🔧 overwork astyle call

* 🔧 overwork astyle call

* 🔧 overwork astyle call

* 🔧 overwork astyle call

* 🔧 overwork astyle call

* 🔧 overwork astyle call

* 🔧 overwork astyle call

* 🔧 overwork astyle call

* 🔧 overwork astyle call

* 🔧 overwork astyle call

* Use ubuntu-latest image to run Valgrind (#4575)

* 🔧 use Clang image to run valgrind

* 🔧 use Clang image to run valgrind

* 🔧 use Clang image to run valgrind

* 🔧 use Ubuntu image to run valgrind

* Use Clang image to run iwyu (#4574)

* 🔧 use Clang image to run iwyu

* 🔧 use Clang image to run iwyu

* 🔧 overwork astyle call

* 🔧 overwork astyle call

* 🔧 overwork astyle call

* 🔧 overwork astyle call

* 🔧 overwork astyle call

* 🔧 overwork astyle call

* 🔧 overwork astyle call

* 🔧 overwork astyle call

* 🔧 overwork astyle call

* 🔧 overwork astyle call

* 🔧 overwork astyle call

* 🎨 format code

* 🔨 clean up
2024-12-29 17:06:03 +01:00
dependabot[bot]
6be4e85600
Bump cppcheck from 1.4.6 to 1.4.7 in /cmake/requirements (#4567) 2024-12-23 19:17:06 +01:00
Niels Lohmann
30cd44df95
Clean up CI (#4553)
* 💚 overwork cppcheck

* 🔒 adjust permissions

* 💚 fixes

* 💚 fixes
2024-12-17 18:58:05 +01:00
Niels Lohmann
f2a4ac0673
Add step to build the documentation (#4549)
* 💚 add step to build the documentation

* 💚 add step to build the documentation
2024-12-17 09:48:24 +01:00
Niels Lohmann
549c79ba7e
Overwork documentation (#4516) 2024-12-09 23:02:30 +01:00
Niels Lohmann
a006a7a48b
Add more GCC warning flags (#4524)
* 🔧 add more GCC warning flags

* 👷 use GCC image for GCC test

* 👷 use GCC image for GCC test

* 👷 use GCC image for GCC test

* 👷 use GCC image for GCC test

* 👷 use GCC image for GCC test

* 👷 use GCC image for GCC test

* 👷 use GCC image for GCC test

* 👷 use GCC image for GCC test

* 🔧 adjust flags

* 👷 adjust jobs

* 👷 adjust jobs
2024-12-01 16:13:48 +01:00
Dylan Baker
d333f08958
CMake: generate a pkg-config file that follow pkg-config conventions (#4456)
* CMake: configure pkg-config with @only

And use @ replacement instead of {}, since ${} is significant in
pkg-config's format

* CMake: use conventional prefix and incluedir variables in pkg-config

This is more standard, and has some advantages when cross compiling.
This also means that the pkg-config files generated by Meson and CMake
now match.
2024-11-26 08:39:11 +01:00
Niels Lohmann
378e091795
Fix weak-vtables warning (#4500)
* 🔧 remove warning suppression

* 🚨 fix weak-vtables warning #4087

* 🚨 suppress -Wweak-vtables warning

* 🚨 suppress -Wweak-vtables warning

*  fix test

*  fix test

*  fix test
2024-11-20 08:29:44 +01:00
Niels Lohmann
e3ac5a64bf
Add test for libstdc++ (#4495)
* 👷 add test for libstdc++

* 👷 add test for libstdc++

* 💚 add fixes from #4490

* 💚 add fixes from #4490
2024-11-17 07:35:35 +01:00
Niels Lohmann
a0c1318830
Fix CI + new Doctest (#3985) 2023-05-21 17:23:18 +02:00
theevilone45
b504dca35a
Fix typo in test.cmake (#3951) 2023-03-05 14:12:18 +01:00
Raphael Grimm
233d233439
Fix CI issues (#3906)
Co-authored-by: barcode <barcode@example.com>
2023-01-31 19:23:37 +01:00
Niels Lohmann
813c329fbb
💚 fix Ubuntu build 2022-12-10 23:00:41 +01:00
Niels Lohmann
97f88ce21d
💚 fix Ubuntu build 2022-12-10 22:50:46 +01:00
Niels Lohmann
44423b4d8f
💚 fix Ubuntu build 2022-12-10 22:28:23 +01:00
Niels Lohmann
b6dcf3edf3
💚 fix Ubuntu build 2022-12-10 22:01:08 +01:00
Vertexwahn
2d1f9b6a7d
Add Bazel build support (#3709) 2022-09-18 08:15:12 +02:00
Niels Lohmann
f7973f46d6
Use official Clang/GCC containers (#3703) 2022-08-27 17:28:50 +02:00
Florian Albrechtskirchinger
231f3108ff
Amalgamate the forward declaration header (#3679)
* Amalgamate the forward declaration header

* Update CONTRIBUTING and PULL_REQUEST_TEMPLATE

* Update documentation
2022-08-07 13:57:32 +02:00
Niels Lohmann
7b6cf5918b
Documentation change (#3672)
Co-authored-by: Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>
2022-08-05 19:51:39 +02:00
Florian Albrechtskirchinger
cbaf1033be
Fix global UDLs (#3646)
* Add ci_test_noglobaludls to CI

* Really default JSON_GLOBAL_UDLS to 1

* Test global UDLs

* Suppress warnings

* Clarify documentation
2022-08-01 22:42:35 +02:00
Florian Albrechtskirchinger
9aafcbe965
Move UDLs out of the global namespace (#3605)
* Move UDLs into nlohmann::literals::json_literals namespace

* Add 'using namespace' to unit tests

* Add 'using namespace' to examples

* Add 'using namespace' to README

* Move UDL mkdocs pages out of basic_json/

* Update documentation

* Update docset index

* Add JSON_GlobalUDLs CMake option

* Add unit test

* Build examples without global UDLs

* Add CI target
2022-07-31 17:38:52 +02:00
Florian Albrechtskirchinger
d3e347bd2d
More documentation updates for 3.11.0 (#3553)
* mkdocs: add string_view examples

* mkdocs: reference underlying operators

* mkdocs: add operator<=> examples

* mkdocs: fix style check issues

* mkdocs: tweak BJData page

* mkdocs: add CMake option hints to macros

* mkdocs: fix JSON_DISABLE_ENUM_SERIALIZATION definition

* mkdocs: fix link to unit-udt.cpp

* mkdocs: fix "Arbitrary Type Conversions" title

* mkdocs: link to api/macros/*.md instead of features/macros.md

* mkdocs: document JSON_DisableEnumSerialization CMake option

* mkdocs: encode required C++ standard in example files

* docset: detect gsed/sed

* docset: update index

* docset: fix CSS patching

* docset: add list_missing_pages make target

* docset: add list_removed_paths make target

* docset: replace page titles with name from index

* docset: add install target for Zeal docset browser

* Use GCC_TOOL in ci_test_documentation target
2022-07-31 14:05:58 +02:00
Niels Lohmann
d1d79b930d
Adjust JSON Pointer examples (#3622)
* 📝 adjust JSON Pointer examples

* 👷 add test for documentation

* 📝 note platform-dependent output on some examples
2022-07-29 14:28:37 +02:00
Florian Albrechtskirchinger
71bdaf5748
Enable overriding test properties and set Unicode test timeouts (#3580)
* CMake: Add TEST_PROPERTIES to json_test_set_test_options()

Allow overriding test properties via json_test_set_test_options().

* CMake: Set timeouts for Unicode tests
2022-07-17 13:43:32 +02:00
Alexander Karzhenkov
954b10ad3b
CI: fix "JSON_MultipleHeaders" option spelling (#3555) 2022-06-25 13:38:39 +02:00
Richard Hozák
f6acdbec2c
Allow disabling default enum conversions (#3536) 2022-06-16 19:34:32 +02:00
Florian Albrechtskirchinger
e80945da2c
CI: Enable 32bit unit test (3) (#3532)
* Enable JSON_MultipleHeaders by default

* CI: Add single-header build

* CI: Enable 32bit unit test

* Fix "-Wuseless-cast" warnings

* Remove coverage exclusion

* Fix 32bit test case
2022-06-14 08:54:12 +02:00
Niels Lohmann
af34396129
Use new CI image (#3528)
* ⬆️ use new CI image

* ⬆️ use new CI image

* 🚨 fix warning

* 🔧 remove duplicate warning flags

* 💚 fix test

* 📝 update compiler versions
2022-06-12 14:31:07 +02:00
Florian Albrechtskirchinger
560cede06d
CI: Remove -Wstrict-overflow (#3516) 2022-06-03 20:39:24 +02:00
Florian Albrechtskirchinger
6b97599a27
Fix C++20/gcc-12 issues (Part 2) (#3446)
* Add C++20 3-way comparison operator and fix broken comparisons

Fixes #3207.
Fixes #3409.

* Fix iterators to meet (more) std::ranges requirements

Fixes #3130.
Related discussion: #3408

* Add note about CMake standard version selection to unit tests

Document how CMake chooses which C++ standard version to use when
building tests.

* Update documentation

* CI: add legacy discarded value comparison

* Fix internal linkage errors when building a module
2022-05-29 13:08:06 +02:00
Florian Albrechtskirchinger
bdc21ad1a7
Add build step for ICPC (with fixes) (#3465)
* ⬆️ Doctest 2.4.7

* 👷 add CI step for ICPC

* 👷 add CI step for ICPC

* 👷 add CI step for ICPC

* ⬇️ downgrade to Doctest 2.4.6

* 👷 add CI step for ICPC

* 👷 add CI step for ICPC

* 👷 add CI step for ICPC

* 👷 add CI step for ICPC

* 👷 add CI step for ICPC

* 🔇 suppress warning #2196: routine is both "inline" and "noinline"

* Re-enable <filesystem> detection on ICPC

* Limit regression test for #3070 to Clang and GCC >=8.4

* Disable deprecation warnings on ICPC

* Disable regression test for #1647 on ICPC (C++20)

* Fix compilation failure of regression test for #3077 on ICPC

* Disable wstring unit test on ICPC

Fixes:
  error 913: invalid multibyte character sequence

* Add ICPC to README

Co-authored-by: Niels Lohmann <mail@nlohmann.me>
2022-05-01 22:46:45 +02:00
Niels Lohmann
b21c345179
Reorganize directories (#3462)
* 🚚 move files
* 🚚 rename doc folder to docs
* 🚚 rename test folder to tests
2022-05-01 09:41:50 +02:00
Qianqian Fang
ee51661481
Support UBJSON-derived Binary JData (BJData) format (#3336)
* support UBJSON-derived Binary JData (BJData) format

* fix Codacy warning

* partially fix VS compilation errors

* fix additional VS errors

* fix more VS compilation errors

* fix additional warnings and errors for clang and msvc

* add more tests to cover the new bjdata types

* add tests for optimized ndarray, improve coverage, fix clang/gcc warnings

* gcc warn useless conversion but msvc gives an error

* fix ci_test errors

* complete test coverage, fix ci_test errors

* add half precision error test

* fix No newline at end of file error by clang

* simplify endian condition, format unit-bjdata

* remove broken test due to alloc limit

* full coverage, I hope

* move bjdata new markers from default to the same level as ubjson markers

* fix ci errors, add tests for new bjdata switch structure

* make is_bjdata const after using initializer list

* remove the unwanted assert

* move is_bjdata to an optional param to write_ubjson

* pass use_bjdata via output adapter

* revert order to avoid msvc 2015 unreferenced formal param error

* update BJData Spect V1 Draft-2 URL after spec release

* amalgamate code

* code polishing following @gregmarr's feedback

* make use_bjdata a non-default parameter

* fix ci error, remove unwanted param comment

* encode and decode bjdata ndarray in jdata annotations, enable roundtrip tests

* partially fix ci errors, add tests to improve coverage

* polish patch to remove ci errors

* fix a ndarray dim vector condition

* fix clang tidy error

* add sax test cases for ndarray

* add additional sax event tests

* adjust sax event numbering

* fix sax tests

* ndarray can only be used with array containers, discard if used in object

* complete test coverage

* disable [{SHTFNZ in optimized type due to security risks in #2793 and hampered readability

* fix ci error

* move OutputIsLittleEndian from tparam to param to replace use_bjdata

* fix ci clang gcc error

* fix ci static analysis error

* update json_test_data to 3.1.0, enable file-based bjdata unit tests

* fix stack overflow error on msvc 2019 and 2022

* use https link, update sax_parse_error after rebase

* make input_format const and use initializer

* return bool for write_bjdata_ndarray

* test write_bjdata_ndarray return value as boolean

* fix ci error
2022-04-29 21:17:30 +02:00
Niels Lohmann
448b173ccf
Update CI image (#3420)
* ⬆️ use new CI image

* ⬆️ use new CI image

* 🚨 suppress Clang-Tidy warnings

* 💚 use proper scan-build version

* 🚨 suppress Clang-Tidy warnings

* ⬆️ use more recent GitHub actions

* 💚 add missing compiler

* 📝 update used compilers

* 🚨 fix duplicate inclusion
2022-04-06 15:14:14 +02:00
Florian Albrechtskirchinger
ad103e5b45
Improve unit testing (Part 1) (#3380)
* Refactor unit test creation

Add functions for creating tests and to supply test- and
standard-specific build settings.

Raises minimum CMake version to 3.13 in test directory.

json_test_add_test_for(
    <file>
    MAIN <main>
    [CXX_STANDARDS <version_number>...] [FORCE])

Given a <file> unit-foo.cpp, produces

    test-foo_cpp<version_number>

if C++ standard <version_number> is supported by the compiler and
thesource file contains JSON_HAS_CPP_<version_number>.  Use FORCE to
create the test regardless of the file containing
JSON_HAS_CPP_<version_number>.  Test targets are linked against <main>.
CXX_STANDARDS defaults to "11".

json_test_set_test_options(
    all|<tests>
    [CXX_STANDARDS all|<args>...]
    [COMPILE_DEFINITIONS <args>...]
    [COMPILE_FEATURES <args>...]
    [COMPILE_OPTIONS <args>...]
    [LINK_LIBRARIES <args>...]
    [LINK_OPTIONS <args>...])

Supply test- and standard-specific build settings.
Specify multiple tests using a list e.g., "test-foo;test-bar".

Must be called BEFORE the test is created.

* Use CMAKE_MODULE_PATH

* Don't undef some macros if JSON_TEST_KEEP_MACROS is defined

* Use JSON_TEST_KEEP_MACROS

Incidentally enables the regression tests for #2546 and #3070.

A CHECK_THROWS_WITH_AS in #3070 was disabled which is tracked in #3377
and a line in from_json(..., std_fs::path&) was marked with LCOV_EXCL_LINE.

* Add three-way comparison feature test macro

* Disable broken comparison if JSON_HAS_THREE_WAY_COMPARISON

* Fix redefinition of inline constexpr statics

Redelcaration of inline constexpr static data members in namespace scope
was deprecated in C++17. Fixes -Werror=deprecated compilation failures.

* Fix more test build failures due to missing noexcept

* CI: update cmake_flags test to use CMake 3.13 in test directory

Also change default for JSON_BuildTests option to depend on CMake
version.

* CI: turn *_CXXFLAGS into CMake lists

* CI: use JSON_TestStandards to set CXX_STANDARD

* CI: pass extra CXXFLAGS to standards tests
2022-03-24 07:54:07 +01:00
Florian Albrechtskirchinger
f208a9c19b
Fix C++20/gcc-12 issues (Part 1) (#3379)
* 🔧 use proper GCC binary

* 🔧 add more GCC warning flags

* ⚗️ try fix from https://github.com/nlohmann/json/issues/3138#issuecomment-1015562666

* Fix custom allocator test build failures (C++20)

Allocator tests fail to compile in C++20 mode with clang+MS STL due
to missing copy constructors.

* Fix test build failures due to missing noexcept (gcc-12)

* alt_string has multiple member functions that should be marked noexcept.
* nlohmann::ordered_map constructors can be noexcept.

Compilation failures result from the warning flag -Werror=noexcept and
gcc-12.

* Disable broken comparison tests in C++20 mode

Co-authored-by: Niels Lohmann <mail@nlohmann.me>
2022-03-07 22:19:28 +01:00
Niels Lohmann
1aca6cb949
Add build step for NVCC and fix a warning (#3227)
* 👷 add step for NVCC build #2676
* 🚨 fix warning (code taken from #2736)
* 👷 use version 2.2.0 of the CI image
2021-12-30 13:40:15 +01:00
Niels Lohmann
6d3115924c
Add C++17 copies of the test binaries (#3101)
* ⚗️ add C++17 copies of the test binaries
* ⚗️ use proper header for filesystem
* 🚨 fix warnings
* ⚗️ do not use too old compilers with C++17
*  add test
* 🔨 add more constraints #3097
* ⚗️ use fix from https://github.com/nlohmann/json/pull/3101#issuecomment-998788786
* ⚗️ use fix from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90050
* 👷 use published CI image
2021-12-29 09:47:05 +01:00
Niels Lohmann
7440786b81
Update CI (#3088)
* 👷 prepare GitHub actions for new Docker image

* 👷 use experimental docker image

* 👷 use Clang-Analyzer 14

* 🔇 suppress readability-identifier-length

* 🔇 suppress more Clang-Tidy warnings

* ♻️ simplify code

* 🔇 suppress more Clang-Tidy warnings

* 🔇 suppress more Clang-Tidy warnings

* 🚨 fix warning

* 🚨 fix warning

* 🚨 fix warning

* 👷 use new Docker image
2021-10-29 21:27:34 +02:00
Niels Lohmann
e0b02c355e
Use new Docker image (#2981) 2021-08-29 18:05:31 +02:00