Fix documentation errors and clean up repository leftovers
Documentation: - basic_json_view::contains: basic_json::contains(json_pointer) never throws either; drop the claim that it does. - std::format support is dated 3.13.0 in the serialization feature page; std::optional is supported since 3.12.0 and std::filesystem::path since 3.10.5 in type_recipes.md. - basic_json_view::source_offset: also -1 for values written by an edit and arrays/objects whose elements an edit added or removed. - basic_json_view::items: const auto& works (binds to the temporary); by value is recommended, non-const auto& does not compile. - basic_json_view::operator==/!=: document the overload that compares a read-only with an editable view. - basic_json_document::erase: out_of_range.404 also for a last token "-". - json_editable_document/json_editable_view: mention insert and erase. - basic_json::swap/std::swap: describe the conditional noexcept (only a throwing move of json_base_class_t can make it throw) and that the std::swap specialization is not provided with C++20 (ADL swap is). - exceptions.md: out_of_range.405 also from front/pop_front and from basic_json_document::erase with an empty pointer; other_error.502 also for non-empty binary values in UBJSON/BJData Draft 2, as the writer does. - Macro pages: fix highlighted lines. Tests: - unit-unicode.cpp: enable the "incorrect sequences" sections that were disabled with #if 0 since 2017 without a reason. They pass; the reason was the runtime of the quadratic high/low surrogate sweep (1024 * 64512 parses, not finished after 3 CPU minutes). That sweep is thinned to all high surrogates against boundary code units, plus one high surrogate against every code unit with accept(). The sections are merged into the existing "incorrect sequences" section of the same name. Repository: - labeler.yml: match the moved json_view feature docs folder. - check_amalgamation.yml: take config_json_view.json from develop's tools. - FILES.md: list json_view_benchmarks.yml. - cmake/ci.cmake: remove the unused targets ci_test_amalgamation (a duplicate of make check-amalgamation), ci_benchmarks and ci_clean, and the .gitignore entry of the first. - make clean and .gitignore cover all tests/*_fuzzer binaries. - hedley_undef.hpp: regenerate with make update_hedley_undef (one line moves into sorted order); regenerate the amalgamation. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
25 files changed
+106
-134
No files matched your search
@@ -406,61 +406,6 @@ add_custom_target(ci_test_clang_sanitizer
|
||||
COMMENT "Compile and test with sanitizers"
|
||||
)
|
||||
|
||||
###############################################################################
|
||||
# Check if header is amalgamated and sources are properly indented.
|
||||
###############################################################################
|
||||
|
||||
# Same file set as .github/workflows/check_amalgamation.yml, so this CMake target (which can be run locally) is held
|
||||
# to the same standard as the workflow (which runs for pull requests and for pushes to develop/master/release/*).
|
||||
file(GLOB_RECURSE INDENT_FILES
|
||||
${PROJECT_SOURCE_DIR}/docs/mkdocs/docs/examples/*.hpp
|
||||
${PROJECT_SOURCE_DIR}/docs/mkdocs/docs/examples/*.cpp
|
||||
${PROJECT_SOURCE_DIR}/docs/mkdocs/docs/examples/*.cu
|
||||
${PROJECT_SOURCE_DIR}/include/*.hpp
|
||||
${PROJECT_SOURCE_DIR}/include/*.cpp
|
||||
${PROJECT_SOURCE_DIR}/include/*.cu
|
||||
${PROJECT_SOURCE_DIR}/tests/*.hpp
|
||||
${PROJECT_SOURCE_DIR}/tests/*.cpp
|
||||
${PROJECT_SOURCE_DIR}/tests/*.cu
|
||||
)
|
||||
list(FILTER INDENT_FILES EXCLUDE REGEX "/tests/thirdparty/|/tests/abi/include/nlohmann/")
|
||||
|
||||
set(include_dir ${PROJECT_SOURCE_DIR}/single_include/nlohmann)
|
||||
set(tool_dir ${PROJECT_SOURCE_DIR}/tools/amalgamate)
|
||||
add_custom_target(ci_test_amalgamation
|
||||
COMMAND rm -fr ${include_dir}/json.hpp~ ${include_dir}/json_fwd.hpp~ ${include_dir}/json_literals.hpp~ ${include_dir}/json_view.hpp~
|
||||
COMMAND cp ${include_dir}/json.hpp ${include_dir}/json.hpp~
|
||||
COMMAND cp ${include_dir}/json_fwd.hpp ${include_dir}/json_fwd.hpp~
|
||||
COMMAND cp ${include_dir}/json_literals.hpp ${include_dir}/json_literals.hpp~
|
||||
COMMAND cp ${include_dir}/json_view.hpp ${include_dir}/json_view.hpp~
|
||||
COMMAND cp ${PROJECT_SOURCE_DIR}/BUILD.bazel ${PROJECT_SOURCE_DIR}/BUILD.bazel~
|
||||
|
||||
COMMAND ${Python3_EXECUTABLE} -mvenv venv_astyle
|
||||
COMMAND venv_astyle/bin/pip3 --quiet install -r ${CMAKE_SOURCE_DIR}/tools/astyle/requirements.txt
|
||||
COMMAND venv_astyle/bin/astyle --version
|
||||
|
||||
COMMAND ${Python3_EXECUTABLE} ${tool_dir}/amalgamate.py -c ${tool_dir}/config_json.json -s .
|
||||
COMMAND ${Python3_EXECUTABLE} ${tool_dir}/amalgamate.py -c ${tool_dir}/config_json_fwd.json -s .
|
||||
COMMAND cp ${PROJECT_SOURCE_DIR}/include/nlohmann/json_literals.hpp ${include_dir}/json_literals.hpp
|
||||
COMMAND ${Python3_EXECUTABLE} ${tool_dir}/amalgamate.py -c ${tool_dir}/config_json_view.json -s .
|
||||
COMMAND venv_astyle/bin/astyle --project=tools/astyle/.astylerc --suffix=none ${include_dir}/json.hpp ${include_dir}/json_fwd.hpp ${include_dir}/json_literals.hpp ${include_dir}/json_view.hpp
|
||||
COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/cmake/scripts/gen_bazel_build_file.cmake
|
||||
|
||||
COMMAND diff ${include_dir}/json.hpp~ ${include_dir}/json.hpp
|
||||
COMMAND diff ${include_dir}/json_fwd.hpp~ ${include_dir}/json_fwd.hpp
|
||||
COMMAND diff ${include_dir}/json_literals.hpp~ ${include_dir}/json_literals.hpp
|
||||
COMMAND diff ${include_dir}/json_view.hpp~ ${include_dir}/json_view.hpp
|
||||
COMMAND diff ${PROJECT_SOURCE_DIR}/BUILD.bazel~ ${PROJECT_SOURCE_DIR}/BUILD.bazel
|
||||
|
||||
COMMAND venv_astyle/bin/astyle --project=tools/astyle/.astylerc --suffix=orig ${INDENT_FILES}
|
||||
COMMAND for FILE in `find . -name '*.orig'`\; do false \; done
|
||||
|
||||
COMMAND rm -f ${include_dir}/json.hpp~ ${include_dir}/json_fwd.hpp~ ${include_dir}/json_literals.hpp~ ${include_dir}/json_view.hpp~ ${PROJECT_SOURCE_DIR}/BUILD.bazel~
|
||||
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
COMMENT "Check amalgamation, formatting, and BUILD.bazel"
|
||||
)
|
||||
|
||||
###############################################################################
|
||||
# Build and test using the amalgamated header
|
||||
###############################################################################
|
||||
@@ -692,19 +637,6 @@ else()
|
||||
)
|
||||
endif()
|
||||
|
||||
###############################################################################
|
||||
# Benchmarks
|
||||
###############################################################################
|
||||
|
||||
add_custom_target(ci_benchmarks
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DCMAKE_BUILD_TYPE=Release -GNinja
|
||||
-S${PROJECT_SOURCE_DIR}/tests/benchmarks -B${PROJECT_BINARY_DIR}/build_benchmarks
|
||||
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_benchmarks --target json_benchmarks
|
||||
COMMAND cd ${PROJECT_BINARY_DIR}/build_benchmarks && ./json_benchmarks
|
||||
COMMENT "Run benchmarks"
|
||||
)
|
||||
|
||||
###############################################################################
|
||||
# CMake flags
|
||||
###############################################################################
|
||||
@@ -965,12 +897,3 @@ add_custom_target(ci_test_documentation_mermaid
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/docs/mkdocs
|
||||
COMMENT "Check the Mermaid diagrams of the documentation"
|
||||
)
|
||||
|
||||
###############################################################################
|
||||
# Clean up all generated files.
|
||||
###############################################################################
|
||||
|
||||
add_custom_target(ci_clean
|
||||
COMMAND rm -fr ${PROJECT_BINARY_DIR}/build_* ${PROJECT_BINARY_DIR}/cmake-3.5.0 ${PROJECT_BINARY_DIR}/cmake-3.31.6 ${PROJECT_BINARY_DIR}/cmake-4.0.0 ${JSON_CMAKE_FLAG_BUILD_DIRS} ${single_binaries}
|
||||
COMMENT "Clean generated directories"
|
||||
)
|
||||
Reference in new issue
Block a user