-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Annoying -Wundef on new JSON_DIAGNOSTICS macro #2975
Labels
confirmed
kind: bug
release item: 🔨 further change
solution: proposed fix
a fix for the issue has been proposed and waits for confirmation
Milestone
Comments
It could be safely fixed by adding
somewhere at the beginning of the header. |
gcerretani
added a commit
to gcerretani/json
that referenced
this issue
Aug 25, 2021
Define JSON_DIAGNOSTICS to 0 if not defined to fix annoying Wundef warnings.
4 tasks
I can confirm the issue. The reason we did not detect this is that we define JSON_DIAGNOSTICS=$<BOOL:${JSON_Diagnostics}> in the CMake build which we use in the CI. That is, the warning only occurs when building without CMake. It was an oversight not to treat #ifndef JSON_USE_IMPLICIT_CONVERSIONS
#define JSON_USE_IMPLICIT_CONVERSIONS 1
#endif |
nlohmann
added
solution: proposed fix
a fix for the issue has been proposed and waits for confirmation
release item: 🔨 further change
labels
Aug 25, 2021
nlohmann
pushed a commit
that referenced
this issue
Aug 26, 2021
* Fix #2975 Define JSON_DIAGNOSTICS to 0 if not defined to fix annoying Wundef warnings. * amalgamated
kraj
pushed a commit
to YoeDistro/meta-openembedded
that referenced
this issue
Sep 6, 2021
Release date: 2021-08-26 SHA-256: 059743e48b37e41579ee3a92e82e984bfa0d2a9a2b20b175d04db8089f46f047 (json.hpp) 61e605be15e88deeac4582aaf01c09d616f8302edde7adcaba9261ddc3b4ceca (include.zip) Summary This release is made days after the 3.10.1 release due to a bug in the release script: The 3.10.1 release at GitHub contained the correct files, but the associated tag v3.10.1 points to the wrong commit. This release is made with a fixed build script. All changes are backward-compatible. Improvements Fix the release scripts to correctly tag releases. nlohmann/json#2973 Fix some -Wunused warnings on JSON_DIAGNOSTICS when the library is built without CMake. nlohmann/json#2975 nlohmann/json#2976 Deprecated functions Passing iterator pairs or pointer/length pairs to parsing functions (basic_json::parse, basic_json::accept, basic_json::sax_parse, basic_json::from_cbor, basic_json::from_msgpack, basic_json::from_ubjson, basic_json::from_bson) via initializer lists is deprecated. Instead, pass two iterators; for instance, call basic_json::from_cbor(ptr, ptr+len) instead of basic_json::from_cbor({ptr, len}). -License-Update: Copyright year updated to 2021. Signed-off-by: Wang Mingyu <wangmy@fujitsu.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
daregit
pushed a commit
to daregit/yocto-combined
that referenced
this issue
May 22, 2024
Release date: 2021-08-26 SHA-256: 059743e48b37e41579ee3a92e82e984bfa0d2a9a2b20b175d04db8089f46f047 (json.hpp) 61e605be15e88deeac4582aaf01c09d616f8302edde7adcaba9261ddc3b4ceca (include.zip) Summary This release is made days after the 3.10.1 release due to a bug in the release script: The 3.10.1 release at GitHub contained the correct files, but the associated tag v3.10.1 points to the wrong commit. This release is made with a fixed build script. All changes are backward-compatible. Improvements Fix the release scripts to correctly tag releases. nlohmann/json#2973 Fix some -Wunused warnings on JSON_DIAGNOSTICS when the library is built without CMake. nlohmann/json#2975 nlohmann/json#2976 Deprecated functions Passing iterator pairs or pointer/length pairs to parsing functions (basic_json::parse, basic_json::accept, basic_json::sax_parse, basic_json::from_cbor, basic_json::from_msgpack, basic_json::from_ubjson, basic_json::from_bson) via initializer lists is deprecated. Instead, pass two iterators; for instance, call basic_json::from_cbor(ptr, ptr+len) instead of basic_json::from_cbor({ptr, len}). -License-Update: Copyright year updated to 2021. Signed-off-by: Wang Mingyu <wangmy@fujitsu.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
daregit
pushed a commit
to daregit/yocto-combined
that referenced
this issue
May 22, 2024
Release date: 2021-08-26 SHA-256: 059743e48b37e41579ee3a92e82e984bfa0d2a9a2b20b175d04db8089f46f047 (json.hpp) 61e605be15e88deeac4582aaf01c09d616f8302edde7adcaba9261ddc3b4ceca (include.zip) Summary This release is made days after the 3.10.1 release due to a bug in the release script: The 3.10.1 release at GitHub contained the correct files, but the associated tag v3.10.1 points to the wrong commit. This release is made with a fixed build script. All changes are backward-compatible. Improvements Fix the release scripts to correctly tag releases. nlohmann/json#2973 Fix some -Wunused warnings on JSON_DIAGNOSTICS when the library is built without CMake. nlohmann/json#2975 nlohmann/json#2976 Deprecated functions Passing iterator pairs or pointer/length pairs to parsing functions (basic_json::parse, basic_json::accept, basic_json::sax_parse, basic_json::from_cbor, basic_json::from_msgpack, basic_json::from_ubjson, basic_json::from_bson) via initializer lists is deprecated. Instead, pass two iterators; for instance, call basic_json::from_cbor(ptr, ptr+len) instead of basic_json::from_cbor({ptr, len}). -License-Update: Copyright year updated to 2021. Signed-off-by: Wang Mingyu <wangmy@fujitsu.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
confirmed
kind: bug
release item: 🔨 further change
solution: proposed fix
a fix for the issue has been proposed and waits for confirmation
A new convenience macro JSON_DIAGNOSTICS has been introduced on v3.10.0. If not defiend, lots of
-Wundef
warning are reported.What is the issue you have?
JSON_DIAGNOSTICS
macro is used in preprocessor directives like:It is legal, as stated here on cppreference.com:
However, GCC reports tons of warnings is executed with
-Wundef
, like:Not sure if it is a bug or not, but the "evaluates to 0" preprocessor rule usage is very rare.
Please describe the steps to reproduce the issue.
-Wundef
Can you provide a small but working code example?
#include <nlohmann/json.hpp>
What is the expected behavior?
No warning.
And what is the actual behavior instead?
Warnings!
Which compiler and operating system are you using?
Which version of the library did you use?
develop
branchIf you experience a compilation error: can you compile and run the unit tests?
The text was updated successfully, but these errors were encountered: