Commit Graph

13 Commits (c35d260c2fb91b8a53e585d480607a0f088cbbbb)

Author SHA1 Message Date
Craig Scott fac07e22c5
Accept NEW CMake policies up to CMake 3.14 (#4112)
Starting with CMake 3.27, deprecation warnings are issued
when asking for policy settings for CMake 3.4 or earlier.
The cmake_minimum_required() command accepts a version
range, which allows NEW policy settings up to the upper end
of that range to be used, but without raising the minimum
CMake version above the bottom of that range. This means
NEW policy settings will be used where available, without
requiring them. This change updates the project's
cmake_minimum_required() calls to use a version range to
extend the upper policy version to 3.14 where it wasn't already
at that version or higher. This prevents the deprecation warning
from CMake 3.27, and gives breathing space before a future
CMake release will start issuing similar deprecation warnings
again.
2023-09-25 09:31:26 +02:00
Raphael Grimm 233d233439
Fix CI issues (#3906)
Co-authored-by: barcode <barcode@example.com>
2023-01-31 19:23:37 +01:00
Florian Albrechtskirchinger 0c7a18374c
Reimplement value() access functions (#3663)
* Reimplement value() access functions

* Merges the 'const char *' with the 'ValueType &&' overloads.
* Fixes ambiguities when default value is 0.
* Fixes 'no matching function' error when specifying ValueType template
  parameter.
* Fixes incorrect template parameter order in previous overloads.

* Add additional value() tests

* Make JSON_MultipleHeaders visible to unit tests

Define the macro JSON_TEST_USING_MULTIPLE_HEADERS to 0/1 depending on
JSON_MultipleHeaders.

* Add type_traits unit test

* Update documentation
2022-08-07 13:54:55 +02:00
Florian Albrechtskirchinger a2578d1d50
Disable exceptions on ICPC (#3621) 2022-07-30 22:10:49 +02:00
Florian Albrechtskirchinger d909f80960
Add versioned, ABI-tagged inline namespace and namespace macros (#3590)
* Add versioned inline namespace

Add a versioned inline namespace to prevent ABI issues when linking code
using multiple library versions.

* Add namespace macros

* Encode ABI information in inline namespace

Add _diag suffix to inline namespace if JSON_DIAGNOSTICS is enabled, and
_ldvcmp suffix if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON is enabled.

* Move ABI-affecting macros into abi_macros.hpp

* Move std_fs namespace definition into std_fs.hpp

* Remove std_fs namespace from unit test

* Format more files in tests directory

* Add unit tests

* Update documentation

* Fix GDB pretty printer

* fixup! Add namespace macros

* Derive ABI prefix from NLOHMANN_JSON_VERSION_*
2022-07-30 21:59:13 +02:00
Florian Albrechtskirchinger 5520761433
Fix Unicode test timeout (for real this time!) (#3614)
* Use TIMEOUT instead of TIMEOUT_AFTER_MATCH to set test timeout
2022-07-28 21:51:11 +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
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
Florian Albrechtskirchinger 48a102c2c5
Fix ndarray dimension signedness, fix ndarray length overflow (2); add 32bit unit test (#3523)
* Fix ndarray dimension signness, fix ndarray length overflow, close #3519

* detect size overflow in ubjson and bjdata

* force reformatting

* Fix MSVC compiler warning

* Add value_in_range_of trait

* Use value_in_range_of trait

* Correct 408 parse_errors to out_of_range

* Add 32bit unit test

The test can be enabled by setting JSON_32bitTest=ON.

* Exclude unreachable lines from coverage

Certain lines are unreachable in 64bit builds.

Co-authored-by: Qianqian Fang <fangqq@gmail.com>
2022-06-09 08:22:58 +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
Niels Lohmann 6a7392058e
Complete documentation for 3.11.0 (#3464)
* 👥 update contributor and sponsor list

* 🚧 document BJData format

* 🚧 document BJData format

* 📝 clarified documentation of [json.exception.parse_error.112]

* ✏️ adjust titles

* 📝 add more examples

* 🚨 adjust warnings for index.md files

* 📝 add more examples

* 🔥 remove example for deprecated code

* 📝 add missing enum entry

* 📝 overwork table for binary formats

*  add test to create table for binary formats

* 📝 fix wording in example

* 📝 add more examples

* Update iterators.md (#3481)

*  add check for overloads to linter #3455

* 👥 update contributor list

* 📝 add more examples

* 📝 fix documentation

* 📝 add more examples

* 🎨 fix indentation

* 🔥 remove example for destructor

* 📝 overwork documentation

* Updated BJData documentation, #3464 (#3493)

* update bjdata.md for #3464

* Minor edit

* Fix URL typo

* Add info on demoting ND array to a 1-D optimized array when singleton dimension

Co-authored-by: Chaoqi Zhang <prncoprs@163.com>
Co-authored-by: Qianqian Fang <fangqq@gmail.com>
2022-05-17 13:08:56 +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