Skip to content

Commit

Permalink
Merge pull request #2861 from nlohmann/documentation
Browse files Browse the repository at this point in the history
Update documentation
  • Loading branch information
nlohmann committed Jul 11, 2021
2 parents 098bbab + 2496880 commit 9426074
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmake/ci.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -467,15 +467,15 @@ add_custom_target(ci_test_diagnostics
###############################################################################

add_custom_target(ci_test_coverage
COMMAND CXX=${GCC_TOOL} ${CMAKE_COMMAND}
COMMAND CXX=g++ ${CMAKE_COMMAND}
-DCMAKE_BUILD_TYPE=Debug -GNinja -DCMAKE_CXX_FLAGS="--coverage;-fprofile-arcs;-ftest-coverage"
-DJSON_BuildTests=ON -DJSON_MultipleHeaders=ON
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_coverage
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_coverage
COMMAND cd ${PROJECT_BINARY_DIR}/build_coverage && ${CMAKE_CTEST_COMMAND} --parallel ${N} --output-on-failure

COMMAND ${LCOV_TOOL} --directory . --capture --output-file json.info --rc lcov_branch_coverage=1
COMMAND ${LCOV_TOOL} -e json.info ${SRC_FILES} --output-file json.info.filtered --gcov-tool ${GCOV_TOOL} --rc lcov_branch_coverage=1
COMMAND ${LCOV_TOOL} -e json.info ${SRC_FILES} --output-file json.info.filtered --rc lcov_branch_coverage=1
COMMAND ${CMAKE_SOURCE_DIR}/test/thirdparty/imapdl/filterbr.py json.info.filtered > json.info.filtered.noexcept
COMMAND genhtml --title "JSON for Modern C++" --legend --demangle-cpp --output-directory html --show-details --branch-coverage json.info.filtered.noexcept

Expand Down Expand Up @@ -560,7 +560,7 @@ add_custom_target(ci_clang_analyze
###############################################################################

add_custom_target(ci_cppcheck
COMMAND ${CPPCHECK_TOOL} --enable=warning --inline-suppr --inconclusive --force --std=c++11 ${PROJECT_SOURCE_DIR}/single_include/nlohmann/json.hpp --error-exitcode=1
COMMAND ${CPPCHECK_TOOL} --enable=warning --suppress=missingReturn --inline-suppr --inconclusive --force --std=c++11 ${PROJECT_SOURCE_DIR}/single_include/nlohmann/json.hpp --error-exitcode=1
COMMENT "Check code with Cppcheck"
)

Expand Down
4 changes: 4 additions & 0 deletions doc/mkdocs/docs/features/macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ When defining `JSON_NOEXCEPTION`, `#!cpp try` is replaced by `#!cpp if (true)`,

The same effect is achieved by setting the compiler flag `-fno-exceptions`.

## `JSON_NO_IO`

When defined, headers `<cstdio>`, `<ios>`, `<iosfwd>`, `<istream>`, and `<ostream>` are not included and parse functions relying on these headers are excluded. This is relevant for environment where these I/O functions are disallowed for security reasons (e.g., Intel Software Guard Extensions (SGX)).

## `JSON_SKIP_UNSUPPORTED_COMPILER_CHECK`

When defined, the library will not create a compile error when a known unsupported compiler is detected. This allows to use the library with compilers that do not fully support C++11 and may only work if unsupported features are not used.
Expand Down
15 changes: 15 additions & 0 deletions doc/mkdocs/docs/features/types/number_handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,21 @@ This is the same behavior as the code `#!c double x = 3.141592653589793238462643
- All integers outside the range $[-2^{63}, 2^{64}-1]$, as well as floating-point numbers are stored as `double`.
This also concurs with the specification above.

### Zeros

The JSON number grammar allows for different ways to express zero, and this library will store zeros differently:

| Literal | Stored value and type | Serialization |
| ------- | --------------------- | ------------- |
| `0` | `#!c std::uint64_t(0)` | `0` |
| `-0` | `#!c std::int64_t(0)` | `0` |
| `0.0` | `#!c double(0.0)` | `0.0` |
| `-0.0` | `#!c double(-0.0)` | `-0.0` |
| `0E0` | `#!c double(0.0)` | `0.0` |
| `-0E0` | `#!c double(-0.0)` | `-0.0` |

That is, `-0` is stored as a signed integer, but the serialization does not reproduce the `-`.

### Number serialization

- Integer numbers are serialized as is; that is, no scientific notation is used.
Expand Down

0 comments on commit 9426074

Please sign in to comment.