Repository navigation
Fix compiler warnings on develop from the API performance stack - #5858
Merged
Merged
Conversation
These PRs were merged while their CI runs were cancelled, so the warnings went unnoticed. All of them fail the -Werror builds: - json_pointer.hpp (#5836): size_t += int under GCC -Wsign-conversion - binary_reader.hpp (#5839): char_int_type passed as char under GCC -Wconversion - json.hpp (#5838): @throw without a description under clang -Wdocumentation - string_escape.hpp (#5836): escape_into() was inserted between escape() and its documentation, so the @return was attached to a void function - unit-diagnostics.cpp (#5832): clang -Wnrvo in a lambda without an explicit return type - unit-to_json-rvalue.cpp (#5837): GCC -Wnoexcept (C++20) and clang -Wunneeded-member-function on the test type Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Most of the API performance stack (#5832–#5842) was merged while its CI runs were cancelled. On develop, the
-Werrorbuilds now fail, so every open PR that merges develop fails ~60 jobs (seen on #5826). This PR fixes every warning I could reproduce locally with the CI flags fromcmake/gcc_flags.cmakeandcmake/clang_flags.cmake(GCC 16.2 and Apple clang 21, alltests/src/unit-*.cppat C++11/17/20):detail/json_pointer.hpp-Wsign-conversion:size_t += intstatic_cast<std::size_t>(c == '/')detail/input/binary_reader.hpp-Wconversion:char_int_typepassed ascharbson_unsupported_type_error()takeschar_int_typejson.hpp-Wdocumentation:@throwwithout a descriptiondetail/string_escape.hpp-Wdocumentation:escape_into()was inserted betweenescape()and its doc comment, so@returndocumented a void functionescape(), short comment forescape_into()tests/src/unit-diagnostics.cpp-Wnrvoin a lambda-> Jreturn typetests/src/unit-to_json-rvalue.cpp-Wnoexcept(C++20), clang-Wunneeded-member-functionnoexceptconstructor; the unused move assignment is deletedVerified locally: no errors left from either compiler under the CI warning flags (apart from macOS-only
int64_t == long longartifacts in old tests), and unit-json_pointer, unit-diagnostics, unit-to_json-rvalue, unit-bson and unit-algorithms pass.make amalgamateis clean. CI may still find issues on other platforms (MSVC, clang-tidy, older compilers) that I couldn't reproduce here.Public API
No breaking changes. The only change to a declaration is the parameter type of the private
binary_reader::bson_unsupported_type_error(). Everything else is comments and tests.Written by Claude Code on behalf of Niels Lohmann.
🤖 Generated with Claude Code