From 346e9813c524fe79b3819d6cf8dcbd92be785452 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Tue, 2 Jul 2019 20:25:51 +0200 Subject: [PATCH] :construction: add more annotations --- README.md | 3 +++ include/nlohmann/detail/input/lexer.hpp | 5 +++++ single_include/nlohmann/json.hpp | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/README.md b/README.md index 9ebd0789..071770c8 100644 --- a/README.md +++ b/README.md @@ -1076,6 +1076,8 @@ The class contains the UTF-8 Decoder from Bjoern Hoehrmann which is licensed und The class contains a slightly modified version of the Grisu2 algorithm from Florian Loitsch which is licensed under the [MIT License](http://opensource.org/licenses/MIT) (see above). Copyright © 2009 [Florian Loitsch](http://florian.loitsch.com/) +The class contains a copy of [Hedley](https://nemequ.github.io/hedley/) from Evan Nemerson which is licensed as [CC0-1.0](http://creativecommons.org/publicdomain/zero/1.0/). + ## Contact If you have questions regarding the library, I would like to invite you to [open an issue at GitHub](https://github.com/nlohmann/json/issues/new/choose). Please describe your request, problem, or question as detailed as possible, and also mention the version of the library you are using as well as the version of your compiler and operating system. Opening an issue at GitHub allows other users and contributors to this library to collaborate. For instance, I have little experience with MSVC, and most issues in this regard have been solved by a growing community. If you have a look at the [closed issues](https://github.com/nlohmann/json/issues?q=is%3Aissue+is%3Aclosed), you will see that we react quite timely in most cases. @@ -1285,6 +1287,7 @@ The library itself consists of a single header file licensed under the MIT licen - [**git-update-ghpages**](https://github.com/rstacruz/git-update-ghpages) to upload the documentation to gh-pages - [**GitHub Changelog Generator**](https://github.com/skywinder/github-changelog-generator) to generate the [ChangeLog](https://github.com/nlohmann/json/blob/develop/ChangeLog.md) - [**Google Benchmark**](https://github.com/google/benchmark) to implement the benchmarks +- [**Hedley**](https://nemequ.github.io/hedley/) to avoid re-inventing several compiler-agnostic feature macros - [**lcov**](http://ltp.sourceforge.net/coverage/lcov.php) to process coverage information and create a HTML view - [**libFuzzer**](http://llvm.org/docs/LibFuzzer.html) to implement fuzz testing for OSS-Fuzz - [**OSS-Fuzz**](https://github.com/google/oss-fuzz) for continuous fuzz testing of the library ([project repository](https://github.com/google/oss-fuzz/tree/master/projects/json)) diff --git a/include/nlohmann/detail/input/lexer.hpp b/include/nlohmann/detail/input/lexer.hpp index d19836cb..35e4e5d0 100644 --- a/include/nlohmann/detail/input/lexer.hpp +++ b/include/nlohmann/detail/input/lexer.hpp @@ -60,6 +60,7 @@ class lexer /// return name of values of type token_type (only used for errors) JSON_HEDLEY_RETURNS_NON_NULL + JSON_HEDLEY_CONST static const char* token_type_name(const token_type t) noexcept { switch (t) @@ -119,6 +120,7 @@ class lexer ///////////////////// /// return the locale-dependent decimal point + JSON_HEDLEY_PURE static char get_decimal_point() noexcept { const auto loc = localeconv(); @@ -817,18 +819,21 @@ class lexer } JSON_HEDLEY_NON_NULL(2) + JSON_HEDLEY_CONST static void strtof(float& f, const char* str, char** endptr) noexcept { f = std::strtof(str, endptr); } JSON_HEDLEY_NON_NULL(2) + JSON_HEDLEY_CONST static void strtof(double& f, const char* str, char** endptr) noexcept { f = std::strtod(str, endptr); } JSON_HEDLEY_NON_NULL(2) + JSON_HEDLEY_CONST static void strtof(long double& f, const char* str, char** endptr) noexcept { f = std::strtold(str, endptr); diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index e2704b9f..8eab28c2 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -7083,6 +7083,7 @@ class lexer /// return name of values of type token_type (only used for errors) JSON_HEDLEY_RETURNS_NON_NULL + JSON_HEDLEY_CONST static const char* token_type_name(const token_type t) noexcept { switch (t) @@ -7142,6 +7143,7 @@ class lexer ///////////////////// /// return the locale-dependent decimal point + JSON_HEDLEY_PURE static char get_decimal_point() noexcept { const auto loc = localeconv(); @@ -7840,18 +7842,21 @@ class lexer } JSON_HEDLEY_NON_NULL(2) + JSON_HEDLEY_CONST static void strtof(float& f, const char* str, char** endptr) noexcept { f = std::strtof(str, endptr); } JSON_HEDLEY_NON_NULL(2) + JSON_HEDLEY_CONST static void strtof(double& f, const char* str, char** endptr) noexcept { f = std::strtod(str, endptr); } JSON_HEDLEY_NON_NULL(2) + JSON_HEDLEY_CONST static void strtof(long double& f, const char* str, char** endptr) noexcept { f = std::strtold(str, endptr);