Skip to content
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

Support nlohmann JSON_DIAGNOSTICS for better exception messages #324

Open
pprettysimpple opened this issue Jun 13, 2024 · 0 comments
Open

Comments

@pprettysimpple
Copy link

If I compile this project with this macro definition JSON_DIAGNOSTICS=1

CXXFLAGS=-DJSON_DIAGNOSTICS=1 cmake -B build
cmake --build build

or add this line at the top level of the main cmake file add_compile_definitions(-DJSON_DIAGNOSTICS=1) and run usual build.

I get a lot of warnings of that type:

/usr/include/c++/13/bits/stl_tree.h:998:16: warning: array subscript ‘std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, nlohmann::json_abi_diag_v3_11_2::basic_json<> >, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, nlohmann::json_abi_diag_v3_11_2::basic_json<> > >, std::less<void>, std::allocator<std::pair<const std::__cxx11::basic_string<char>, nlohmann::json_abi_diag_v3_11_2::basic_json<> > > >[0]’ is partly outside array bounds of ‘unsigned char [32]’ [-Warray-bounds=]
  998 |       { return iterator(this->_M_impl._M_header._M_left); }

Looks like there is no support for this nlohmann option at this moment, but I find this option really useful!

Please, tell me if I'm doing something wrong and there is a proper way to enable better exception reports.

My use-case: I want to use this option mainly for nlohmann, but if so, there is no way to call validation on that json object. Because mangled name for function differs, when compiling with or without define. And that leads to linker fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant