mirror of
https://github.com/nlohmann/json.git
synced 2026-06-18 18:34:17 +00:00
Compare commits
98 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4308c54cef | |||
| 5c7c81d6fc | |||
| 0d8a3f1278 | |||
| 74caa1b78d | |||
| 6fa04ddf18 | |||
| 96be658738 | |||
| 02f17c1018 | |||
| 9446cb8fa1 | |||
| 3d26d62a39 | |||
| c0aa9485a6 | |||
| cf7c116a75 | |||
| fa76a96d90 | |||
| 74f72a3c59 | |||
| 7823c2ade7 | |||
| 0a7e3eb0e7 | |||
| 7cb41d25ca | |||
| 1b402111d4 | |||
| 1ce3fa5bc3 | |||
| b14b932a24 | |||
| 9747b9a034 | |||
| d62f424acb | |||
| 6b276104d1 | |||
| bbee86a3d1 | |||
| 094c066118 | |||
| de6545005b | |||
| c25905a6df | |||
| 0451d43da5 | |||
| d2014a5a79 | |||
| bc67341534 | |||
| 3d161f7495 | |||
| de508bc2d8 | |||
| 7a570ae601 | |||
| 8b3e448529 | |||
| fab37adabc | |||
| 0b14a60e6f | |||
| 06c7d96cae | |||
| c5b048860d | |||
| 980085f8fb | |||
| 2edffa5d7b | |||
| 3f8f635b63 | |||
| baa3082b26 | |||
| 8ac879d12d | |||
| 57e7092dfa | |||
| 72e81f5b40 | |||
| 5723019bbd | |||
| 0b82731bef | |||
| cd01edbea6 | |||
| 90f3fa4749 | |||
| c5cf12c0d5 | |||
| 954dedad9d | |||
| 71490250f6 | |||
| 5875ebf0ac | |||
| c789bb9b27 | |||
| e567fb9a17 | |||
| 0ad5544857 | |||
| efa0173f9b | |||
| f3ded41873 | |||
| 404c03b9f0 | |||
| b0d0937680 | |||
| 1d305a9c1b | |||
| 2e3e066195 | |||
| 3f8c22f631 | |||
| a9409755c7 | |||
| 702a1c2a48 | |||
| a0711a40c0 | |||
| e41981a751 | |||
| bd06f48825 | |||
| cb1747470b | |||
| 29e9ba0511 | |||
| de895b1d1a | |||
| b0759e09b1 | |||
| 32cf7af82a | |||
| 6c9075c692 | |||
| 6ff5604324 | |||
| 9cd1c63d00 | |||
| 4ce072a05e | |||
| a40ca752f0 | |||
| c818701d98 | |||
| 1a2fb08d1c | |||
| fb8527384c | |||
| a46ad99086 | |||
| 28c1cbfef9 | |||
| 1a095c93fb | |||
| fd94ec80c7 | |||
| 9ed446a688 | |||
| ac48b5c374 | |||
| e3f1e1d35b | |||
| 41cbe4b3ef | |||
| 364a48d9d6 | |||
| 836d436a40 | |||
| ab14172173 | |||
| b014c90f94 | |||
| a87fd638da | |||
| 344ced4012 | |||
| 1bda49b536 | |||
| 5de3c82c9a | |||
| 6a2266aff4 | |||
| 55f10f44a9 |
-23
@@ -1,23 +0,0 @@
|
|||||||
Checks: '-*,
|
|
||||||
bugprone-*,
|
|
||||||
cert-*,
|
|
||||||
clang-analyzer-*,
|
|
||||||
google-*,
|
|
||||||
-google-runtime-references,
|
|
||||||
hicpp-*,
|
|
||||||
-hicpp-no-array-decay,
|
|
||||||
-hicpp-uppercase-literal-suffix,
|
|
||||||
misc-*,
|
|
||||||
-misc-non-private-member-variables-in-classes,
|
|
||||||
llvm-*,
|
|
||||||
-llvm-header-guard,
|
|
||||||
modernize-*,
|
|
||||||
performance-*,
|
|
||||||
portability-*,
|
|
||||||
readability-*,
|
|
||||||
-readability-magic-numbers,
|
|
||||||
-readability-uppercase-literal-suffix'
|
|
||||||
|
|
||||||
CheckOptions:
|
|
||||||
- key: hicpp-special-member-functions.AllowSoleDefaultDtor
|
|
||||||
value: 1
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
[](http://issuestats.com/github/nlohmann/json) [](http://issuestats.com/github/nlohmann/json)
|
|
||||||
|
|
||||||
# How to contribute
|
|
||||||
|
|
||||||
This project started as a little excuse to exercise some of the cool new C++11 features. Over time, people actually started to use the JSON library (yey!) and started to help improve it by proposing features, finding bugs, or even fixing my mistakes. I am really [thankful](https://github.com/nlohmann/json/blob/master/README.md#thanks) for this and try to keep track of all the helpers.
|
|
||||||
|
|
||||||
To make it as easy as possible for you to contribute and for me to keep an overview, here are a few guidelines which should help us avoid all kinds of unnecessary work or disappointment. And of course, this document is subject to discussion, so please [create an issue](https://github.com/nlohmann/json/issues/new) or a pull request if you find a way to improve it!
|
|
||||||
|
|
||||||
## Private reports
|
|
||||||
|
|
||||||
Usually, all issues are tracked publicly on [GitHub](https://github.com/nlohmann/json/issues). If you want to make a private report (e.g., for a vulnerability or to attach an example that is not meant to be published), please send an email to <mail@nlohmann.me>.
|
|
||||||
|
|
||||||
## Prerequisites
|
|
||||||
|
|
||||||
Please [create an issue](https://github.com/nlohmann/json/issues/new), assuming one does not already exist, and describe your concern. Note you need a [GitHub account](https://github.com/signup/free) for this.
|
|
||||||
|
|
||||||
## Describe your issue
|
|
||||||
|
|
||||||
Clearly describe the issue:
|
|
||||||
|
|
||||||
- If it is a bug, please describe how to **reproduce** it. If possible, attach a complete example which demonstrates the error. Please also state what you **expected** to happen instead of the error.
|
|
||||||
- If you propose a change or addition, try to give an **example** how the improved code could look like or how to use it.
|
|
||||||
- If you found a compilation error, please tell us which **compiler** (version and operating system) you used and paste the (relevant part of) the error messages to the ticket.
|
|
||||||
|
|
||||||
Please stick to the [issue template](https://github.com/nlohmann/json/blob/develop/.github/ISSUE_TEMPLATE.md) if possible.
|
|
||||||
|
|
||||||
## Files to change
|
|
||||||
|
|
||||||
:exclamation: Before you make any changes, note the single-header file [`single_include/nlohmann/json.hpp`](https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json.hpp) is **generated** from the source files in the [`include/nlohmann` directory](https://github.com/nlohmann/json/tree/develop/include/nlohmann). Please **do not** edit file `single_include/nlohmann/json.hpp` directly, but change the `include/nlohmann` sources and regenerate file `single_include/nlohmann/json.hpp` by executing `make amalgamate`.
|
|
||||||
|
|
||||||
To make changes, you need to edit the following files:
|
|
||||||
|
|
||||||
1. [`include/nlohmann/*`](https://github.com/nlohmann/json/tree/develop/include/nlohmann) - These files are the sources of the library. Before testing or creating a pull request, execute `make amalgamate` to regenerate `single_include/nlohmann/json.hpp`.
|
|
||||||
|
|
||||||
2. [`test/src/unit-*.cpp`](https://github.com/nlohmann/json/tree/develop/test/src) - These files contain the [Catch](https://github.com/philsquared/Catch) unit tests which currently cover [100 %](https://coveralls.io/github/nlohmann/json) of the library's code.
|
|
||||||
|
|
||||||
If you add or change a feature, please also add a unit test to this file. The unit tests can be compiled and executed with
|
|
||||||
|
|
||||||
```sh
|
|
||||||
$ mkdir build
|
|
||||||
$ cd build
|
|
||||||
$ cmake ..
|
|
||||||
$ cmake --build .
|
|
||||||
$ ctest
|
|
||||||
```
|
|
||||||
|
|
||||||
The test cases are also executed with several different compilers on [Travis](https://travis-ci.org/nlohmann/json) once you open a pull request.
|
|
||||||
|
|
||||||
|
|
||||||
## Note
|
|
||||||
|
|
||||||
- If you open a pull request, the code will be automatically tested with [Valgrind](http://valgrind.org)'s Memcheck tool to detect memory leaks. Please be aware that the execution with Valgrind _may_ in rare cases yield different behavior than running the code directly. This can result in failing unit tests which run successfully without Valgrind.
|
|
||||||
- There is a Makefile target `make pretty` which runs [Artistic Style](http://astyle.sourceforge.net) to fix indentation. If possible, run it before opening the pull request. Otherwise, we shall run it afterward.
|
|
||||||
|
|
||||||
## Please don't
|
|
||||||
|
|
||||||
- The C++11 support varies between different **compilers** and versions. Please note the [list of supported compilers](https://github.com/nlohmann/json/blob/master/README.md#supported-compilers). Some compilers like GCC 4.7 (and earlier), Clang 3.3 (and earlier), or Microsoft Visual Studio 13.0 and earlier are known not to work due to missing or incomplete C++11 support. Please refrain from proposing changes that work around these compiler's limitations with `#ifdef`s or other means.
|
|
||||||
- Specifically, I am aware of compilation problems with **Microsoft Visual Studio** (there even is an [issue label](https://github.com/nlohmann/json/issues?utf8=✓&q=label%3A%22visual+studio%22+) for these kind of bugs). I understand that even in 2016, complete C++11 support isn't there yet. But please also understand that I do not want to drop features or uglify the code just to make Microsoft's sub-standard compiler happy. The past has shown that there are ways to express the functionality such that the code compiles with the most recent MSVC - unfortunately, this is not the main objective of the project.
|
|
||||||
- Please refrain from proposing changes that would **break [JSON](http://json.org) conformance**. If you propose a conformant extension of JSON to be supported by the library, please motivate this extension.
|
|
||||||
- We shall not extend the library to **support comments**. There is quite some [controversy](https://www.reddit.com/r/programming/comments/4v6chu/why_json_doesnt_support_comments_douglas_crockford/) around this topic, and there were quite some [issues](https://github.com/nlohmann/json/issues/376) on this. We believe that JSON is fine without comments.
|
|
||||||
- We do not preserve the **insertion order of object elements**. The [JSON standard](https://tools.ietf.org/html/rfc7159.html) defines objects as "an unordered collection of zero or more name/value pairs". To this end, this library does not preserve insertion order of name/value pairs. (In fact, keys will be traversed in alphabetical order as `std::map` with `std::less` is used by default.) Note this behavior conforms to the standard, and we shall not change it to any other order. If you do want to preserve the insertion order, you can specialize the object type with containers like [`tsl::ordered_map`](https://github.com/Tessil/ordered-map) or [`nlohmann::fifo_map`](https://github.com/nlohmann/fifo_map).
|
|
||||||
|
|
||||||
- Please do not open pull requests that address **multiple issues**.
|
|
||||||
|
|
||||||
## Wanted
|
|
||||||
|
|
||||||
The following areas really need contribution:
|
|
||||||
|
|
||||||
- Extending the **continuous integration** toward more exotic compilers such as Android NDK, Intel's Compiler, or the bleeding-edge versions of GCC or Clang.
|
|
||||||
- Improving the efficiency of the **JSON parser**. The current parser is implemented as a naive recursive descent parser with hand coded string handling. More sophisticated approaches like LALR parsers would be really appreciated. That said, parser generators like Bison or ANTLR do not play nice with single-header files -- I really would like to keep the parser inside the `json.hpp` header, and I am not aware of approaches similar to [`re2c`](http://re2c.org) for parsing.
|
|
||||||
- Extending and updating existing **benchmarks** to include (the most recent version of) this library. Though efficiency is not everything, speed and memory consumption are very important characteristics for C++ developers, so having proper comparisons would be interesting.
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
custom: http://paypal.me/nlohmann
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
---
|
|
||||||
name: Bug report
|
|
||||||
about: Create a report to help us improve
|
|
||||||
title: ''
|
|
||||||
labels: 'kind: bug'
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
- What is the issue you have?
|
|
||||||
|
|
||||||
- Please describe the steps to reproduce the issue. Can you provide a small but working code example?
|
|
||||||
|
|
||||||
- What is the expected behavior?
|
|
||||||
|
|
||||||
- And what is the actual behavior instead?
|
|
||||||
|
|
||||||
- Which compiler and operating system are you using? Is it a [supported compiler](https://github.com/nlohmann/json#supported-compilers)?
|
|
||||||
|
|
||||||
- Did you use a released version of the library or the version from the `develop` branch?
|
|
||||||
|
|
||||||
- If you experience a compilation error: can you [compile and run the unit tests](https://github.com/nlohmann/json#execute-unit-tests)?
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
---
|
|
||||||
name: Feature request
|
|
||||||
about: Suggest an idea for this project
|
|
||||||
title: ''
|
|
||||||
labels: 'kind: enhancement/improvement'
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
- Describe the feature in as much detail as possible.
|
|
||||||
|
|
||||||
- Include sample usage where appropriate.
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
---
|
|
||||||
name: Question
|
|
||||||
about: Ask a question regarding the library.
|
|
||||||
title: ''
|
|
||||||
labels: 'kind: question'
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
- Describe what you want to achieve.
|
|
||||||
|
|
||||||
- Describe what you tried.
|
|
||||||
|
|
||||||
- Describe which system (OS, compiler) you are using.
|
|
||||||
|
|
||||||
- Describe which version of the library you are using (release version, develop branch).
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
[Describe your pull request here. Please read the text below the line, and make sure you follow the checklist.]
|
|
||||||
|
|
||||||
* * *
|
|
||||||
|
|
||||||
## Pull request checklist
|
|
||||||
|
|
||||||
Read the [Contribution Guidelines](https://github.com/nlohmann/json/blob/develop/.github/CONTRIBUTING.md) for detailed information.
|
|
||||||
|
|
||||||
- [ ] Changes are described in the pull request, or an [existing issue is referenced](https://github.com/nlohmann/json/issues).
|
|
||||||
- [ ] The test suite [compiles and runs](https://github.com/nlohmann/json/blob/develop/README.md#execute-unit-tests) without error.
|
|
||||||
- [ ] [Code coverage](https://coveralls.io/github/nlohmann/json) is 100%. Test cases can be added by editing the [test suite](https://github.com/nlohmann/json/tree/develop/test/src).
|
|
||||||
- [ ] The source code is amalgamated; that is, after making changes to the sources in the `include/nlohmann` directory, run `make amalgamate` to create the single-header file `single_include/nlohmann/json.hpp`. The whole process is described [here](https://github.com/nlohmann/json/blob/develop/.github/CONTRIBUTING.md#files-to-change).
|
|
||||||
|
|
||||||
## Please don't
|
|
||||||
|
|
||||||
- The C++11 support varies between different **compilers** and versions. Please note the [list of supported compilers](https://github.com/nlohmann/json/blob/master/README.md#supported-compilers). Some compilers like GCC 4.7 (and earlier), Clang 3.3 (and earlier), or Microsoft Visual Studio 13.0 and earlier are known not to work due to missing or incomplete C++11 support. Please refrain from proposing changes that work around these compiler's limitations with `#ifdef`s or other means.
|
|
||||||
- Specifically, I am aware of compilation problems with **Microsoft Visual Studio** (there even is an [issue label](https://github.com/nlohmann/json/issues?utf8=✓&q=label%3A%22visual+studio%22+) for these kind of bugs). I understand that even in 2016, complete C++11 support isn't there yet. But please also understand that I do not want to drop features or uglify the code just to make Microsoft's sub-standard compiler happy. The past has shown that there are ways to express the functionality such that the code compiles with the most recent MSVC - unfortunately, this is not the main objective of the project.
|
|
||||||
- Please refrain from proposing changes that would **break [JSON](http://json.org) conformance**. If you propose a conformant extension of JSON to be supported by the library, please motivate this extension.
|
|
||||||
- Please do not open pull requests that address **multiple issues**.
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
# Configuration for sentiment-bot - https://github.com/behaviorbot/sentiment-bot
|
|
||||||
|
|
||||||
# *Required* toxicity threshold between 0 and .99 with the higher numbers being the most toxic
|
|
||||||
# Anything higher than this threshold will be marked as toxic and commented on
|
|
||||||
sentimentBotToxicityThreshold: .7
|
|
||||||
|
|
||||||
# *Required* Comment to reply with
|
|
||||||
sentimentBotReplyComment: >
|
|
||||||
Please be sure to review the [code of conduct](https://github.com/nlohmann/json/blob/develop/CODE_OF_CONDUCT.md) and be respectful of other users. cc/ @nlohmann
|
|
||||||
|
|
||||||
|
|
||||||
# Configuration for request-info - https://github.com/behaviorbot/request-info
|
|
||||||
|
|
||||||
# *Required* Comment to reply with
|
|
||||||
requestInfoReplyComment: >
|
|
||||||
We would appreciate it if you could provide us with more info about this issue or pull request! Please check the [issue template](https://github.com/nlohmann/json/blob/develop/.github/ISSUE_TEMPLATE.md) and the [pull request template](https://github.com/nlohmann/json/blob/develop/.github/PULL_REQUEST_TEMPLATE.md).
|
|
||||||
|
|
||||||
# *OPTIONAL* Label to be added to Issues and Pull Requests with insufficient information given
|
|
||||||
requestInfoLabelToAdd: "state: needs more info"
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
# Number of days of inactivity before an issue becomes stale
|
|
||||||
daysUntilStale: 30
|
|
||||||
# Number of days of inactivity before a stale issue is closed
|
|
||||||
daysUntilClose: 7
|
|
||||||
# Issues with these labels will never be considered stale
|
|
||||||
exemptLabels:
|
|
||||||
- pinned
|
|
||||||
- security
|
|
||||||
# Label to use when marking an issue as stale
|
|
||||||
staleLabel: "state: stale"
|
|
||||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
|
||||||
markComment: >
|
|
||||||
This issue has been automatically marked as stale because it has not had
|
|
||||||
recent activity. It will be closed if no further activity occurs. Thank you
|
|
||||||
for your contributions.
|
|
||||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
|
||||||
closeComment: false
|
|
||||||
-25
@@ -1,25 +0,0 @@
|
|||||||
json_unit
|
|
||||||
json_benchmarks
|
|
||||||
json_benchmarks_simple
|
|
||||||
fuzz-testing
|
|
||||||
|
|
||||||
*.dSYM
|
|
||||||
*.o
|
|
||||||
*.gcno
|
|
||||||
*.gcda
|
|
||||||
|
|
||||||
build
|
|
||||||
build_coverage
|
|
||||||
clang_analyze_build
|
|
||||||
|
|
||||||
doc/xml
|
|
||||||
doc/html
|
|
||||||
me.nlohmann.json.docset
|
|
||||||
|
|
||||||
benchmarks/files/numbers/*.json
|
|
||||||
|
|
||||||
.idea
|
|
||||||
cmake-build-debug
|
|
||||||
|
|
||||||
test/test-*
|
|
||||||
/.vs
|
|
||||||
-334
@@ -1,334 +0,0 @@
|
|||||||
#########################
|
|
||||||
# project configuration #
|
|
||||||
#########################
|
|
||||||
|
|
||||||
# C++ project
|
|
||||||
language: cpp
|
|
||||||
|
|
||||||
dist: trusty
|
|
||||||
sudo: required
|
|
||||||
group: edge
|
|
||||||
|
|
||||||
|
|
||||||
###################
|
|
||||||
# global settings #
|
|
||||||
###################
|
|
||||||
|
|
||||||
env:
|
|
||||||
global:
|
|
||||||
# The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
|
|
||||||
# via the "travis encrypt" command using the project repo's public key
|
|
||||||
- secure: "m89SSgE+ASLO38rSKx7MTXK3n5NkP9bIx95jwY71YEiuFzib30PDJ/DifKnXxBjvy/AkCGztErQRk/8ZCvq+4HXozU2knEGnL/RUitvlwbhzfh2D4lmS3BvWBGS3N3NewoPBrRmdcvnT0xjOGXxtZaJ3P74TkB9GBnlz/HmKORA="
|
|
||||||
|
|
||||||
|
|
||||||
################
|
|
||||||
# build matrix #
|
|
||||||
################
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
|
|
||||||
# Valgrind
|
|
||||||
- os: linux
|
|
||||||
compiler: gcc
|
|
||||||
env:
|
|
||||||
- COMPILER=g++-4.9
|
|
||||||
- CMAKE_OPTIONS=-DJSON_Valgrind=ON
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
|
||||||
packages: ['g++-4.9', 'valgrind', 'ninja-build']
|
|
||||||
|
|
||||||
# clang sanitizer
|
|
||||||
- os: linux
|
|
||||||
compiler: clang
|
|
||||||
env:
|
|
||||||
- COMPILER=clang++-5.0
|
|
||||||
- CMAKE_OPTIONS=-DJSON_Sanitizer=ON
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-trusty-5.0']
|
|
||||||
packages: ['g++-6', 'clang-5.0', 'ninja-build']
|
|
||||||
|
|
||||||
# cppcheck
|
|
||||||
- os: linux
|
|
||||||
compiler: gcc
|
|
||||||
env:
|
|
||||||
- COMPILER=g++-4.9
|
|
||||||
- SPECIAL=cppcheck
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
|
||||||
packages: ['g++-4.9', 'cppcheck', 'ninja-build']
|
|
||||||
after_success:
|
|
||||||
- make cppcheck
|
|
||||||
|
|
||||||
# no exceptions
|
|
||||||
- os: linux
|
|
||||||
compiler: gcc
|
|
||||||
env:
|
|
||||||
- COMPILER=g++-4.9
|
|
||||||
- CMAKE_OPTIONS=-DJSON_NoExceptions=ON
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
|
||||||
packages: ['g++-4.9', 'ninja-build']
|
|
||||||
|
|
||||||
# check amalgamation
|
|
||||||
- os: linux
|
|
||||||
compiler: gcc
|
|
||||||
env:
|
|
||||||
- COMPILER=g++-4.9
|
|
||||||
- SPECIAL=amalgamation
|
|
||||||
- MULTIPLE_HEADERS=ON
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
|
||||||
packages: ['g++-4.9', 'astyle', 'ninja-build']
|
|
||||||
after_success:
|
|
||||||
- make check-amalgamation
|
|
||||||
|
|
||||||
# Coveralls (http://gronlier.fr/blog/2015/01/adding-code-coverage-to-your-c-project/)
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: gcc
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
|
||||||
packages: ['g++-4.9', 'ninja-build']
|
|
||||||
before_script:
|
|
||||||
- pip install --user cpp-coveralls
|
|
||||||
after_success:
|
|
||||||
- coveralls --build-root test --include include/nlohmann --gcov 'gcov-4.9' --gcov-options '\-lp'
|
|
||||||
env:
|
|
||||||
- COMPILER=g++-4.9
|
|
||||||
- CMAKE_OPTIONS=-DJSON_Coverage=ON
|
|
||||||
- MULTIPLE_HEADERS=ON
|
|
||||||
|
|
||||||
# Coverity (only for branch coverity_scan)
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: clang
|
|
||||||
before_install: echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-certificates.crt
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.6']
|
|
||||||
packages: ['g++-6', 'clang-3.6', 'ninja-build']
|
|
||||||
coverity_scan:
|
|
||||||
project:
|
|
||||||
name: "nlohmann/json"
|
|
||||||
description: "Build submitted via Travis CI"
|
|
||||||
notification_email: niels.lohmann@gmail.com
|
|
||||||
build_command_prepend: "mkdir coverity_build ; cd coverity_build ; cmake .. ; cd .."
|
|
||||||
build_command: "make -C coverity_build"
|
|
||||||
branch_pattern: coverity_scan
|
|
||||||
env:
|
|
||||||
- SPECIAL=coverity
|
|
||||||
- COMPILER=clang++-3.6
|
|
||||||
|
|
||||||
# OSX / Clang
|
|
||||||
|
|
||||||
- os: osx
|
|
||||||
osx_image: xcode8.3
|
|
||||||
|
|
||||||
- os: osx
|
|
||||||
osx_image: xcode9
|
|
||||||
|
|
||||||
- os: osx
|
|
||||||
osx_image: xcode9.1
|
|
||||||
|
|
||||||
- os: osx
|
|
||||||
osx_image: xcode9.2
|
|
||||||
|
|
||||||
- os: osx
|
|
||||||
osx_image: xcode9.3
|
|
||||||
|
|
||||||
- os: osx
|
|
||||||
osx_image: xcode9.4
|
|
||||||
|
|
||||||
- os: osx
|
|
||||||
osx_image: xcode10
|
|
||||||
|
|
||||||
- os: osx
|
|
||||||
osx_image: xcode10.1
|
|
||||||
|
|
||||||
# Linux / GCC
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: gcc
|
|
||||||
env: compiler=g++-4.8
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
|
||||||
packages: ['g++-4.8', 'ninja-build']
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: gcc
|
|
||||||
env: compiler=g++-4.9
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
|
||||||
packages: ['g++-4.9', 'ninja-build']
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: gcc
|
|
||||||
env: COMPILER=g++-5
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
|
||||||
packages: ['g++-5', 'ninja-build']
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: gcc
|
|
||||||
env: COMPILER=g++-6
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
|
||||||
packages: ['g++-6', 'ninja-build']
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: gcc
|
|
||||||
env: COMPILER=g++-7
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
|
||||||
packages: ['g++-7', 'ninja-build']
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: gcc
|
|
||||||
env: COMPILER=g++-8
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
|
||||||
packages: ['g++-8', 'ninja-build']
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: gcc
|
|
||||||
env:
|
|
||||||
- COMPILER=g++-8
|
|
||||||
- CXXFLAGS=-std=c++17
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
|
||||||
packages: ['g++-8', 'ninja-build']
|
|
||||||
|
|
||||||
# Linux / Clang
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: clang
|
|
||||||
env: COMPILER=clang++-3.5
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.5']
|
|
||||||
packages: ['g++-6', 'clang-3.5', 'ninja-build']
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: clang
|
|
||||||
env: COMPILER=clang++-3.6
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.6']
|
|
||||||
packages: ['g++-6', 'clang-3.6', 'ninja-build']
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: clang
|
|
||||||
env: COMPILER=clang++-3.7
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.7']
|
|
||||||
packages: ['g++-6', 'clang-3.7', 'ninja-build']
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: clang
|
|
||||||
env: COMPILER=clang++-3.8
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
|
||||||
packages: ['g++-6', 'clang-3.8', 'ninja-build']
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: clang
|
|
||||||
env: COMPILER=clang++-3.9
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test']
|
|
||||||
packages: ['g++-6', 'clang-3.9', 'ninja-build']
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: clang
|
|
||||||
env: COMPILER=clang++-4.0
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-trusty-4.0']
|
|
||||||
packages: ['g++-6', 'clang-4.0', 'ninja-build']
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: clang
|
|
||||||
env: COMPILER=clang++-5.0
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-trusty-5.0']
|
|
||||||
packages: ['g++-6', 'clang-5.0', 'ninja-build']
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: clang
|
|
||||||
env: COMPILER=clang++-6.0
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-trusty-6.0']
|
|
||||||
packages: ['g++-6', 'clang-6.0', 'ninja-build']
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: clang
|
|
||||||
env: COMPILER=clang++-7
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-trusty-7']
|
|
||||||
packages: ['g++-6', 'clang-7', 'ninja-build']
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
compiler: clang
|
|
||||||
env:
|
|
||||||
- COMPILER=clang++-7
|
|
||||||
- CXXFLAGS=-std=c++1z
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-trusty-7']
|
|
||||||
packages: ['g++-6', 'clang-7', 'ninja-build']
|
|
||||||
|
|
||||||
################
|
|
||||||
# build script #
|
|
||||||
################
|
|
||||||
|
|
||||||
script:
|
|
||||||
# get CMake and Ninja (only for systems with brew - macOS)
|
|
||||||
- |
|
|
||||||
if [[ (-x $(which brew)) ]]; then
|
|
||||||
brew update
|
|
||||||
brew install cmake ninja
|
|
||||||
brew upgrade cmake
|
|
||||||
cmake --version
|
|
||||||
fi
|
|
||||||
|
|
||||||
# make sure CXX is correctly set
|
|
||||||
- if [[ "${COMPILER}" != "" ]]; then export CXX=${COMPILER}; fi
|
|
||||||
# by default, use the single-header version
|
|
||||||
- if [[ "${MULTIPLE_HEADERS}" == "" ]]; then export MULTIPLE_HEADERS=OFF; fi
|
|
||||||
|
|
||||||
# show OS/compiler version
|
|
||||||
- uname -a
|
|
||||||
- $CXX --version
|
|
||||||
|
|
||||||
# compile and execute unit tests
|
|
||||||
- mkdir -p build && cd build
|
|
||||||
- cmake .. ${CMAKE_OPTIONS} -DJSON_MultipleHeaders=${MULTIPLE_HEADERS} -GNinja && cmake --build . --config Release
|
|
||||||
- ctest -C Release -V -j
|
|
||||||
- cd ..
|
|
||||||
|
|
||||||
# check if homebrew works (only checks develop branch)
|
|
||||||
- if [ `which brew` ]; then
|
|
||||||
brew update ;
|
|
||||||
brew tap nlohmann/json ;
|
|
||||||
brew install nlohmann_json --HEAD ;
|
|
||||||
brew test nlohmann_json ;
|
|
||||||
fi
|
|
||||||
-130
@@ -1,130 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 3.1)
|
|
||||||
|
|
||||||
##
|
|
||||||
## PROJECT
|
|
||||||
## name and version
|
|
||||||
##
|
|
||||||
project(nlohmann_json VERSION 3.6.1 LANGUAGES CXX)
|
|
||||||
|
|
||||||
##
|
|
||||||
## INCLUDE
|
|
||||||
##
|
|
||||||
##
|
|
||||||
include(ExternalProject)
|
|
||||||
|
|
||||||
##
|
|
||||||
## OPTIONS
|
|
||||||
##
|
|
||||||
option(JSON_BuildTests "Build the unit tests when BUILD_TESTING is enabled." ON)
|
|
||||||
option(JSON_Install "Install CMake targets during install step." ON)
|
|
||||||
option(JSON_MultipleHeaders "Use non-amalgamated version of the library." OFF)
|
|
||||||
|
|
||||||
##
|
|
||||||
## CONFIGURATION
|
|
||||||
##
|
|
||||||
set(NLOHMANN_JSON_TARGET_NAME ${PROJECT_NAME})
|
|
||||||
set(NLOHMANN_JSON_CONFIG_INSTALL_DIR "lib/cmake/${PROJECT_NAME}"
|
|
||||||
CACHE INTERNAL "")
|
|
||||||
set(NLOHMANN_JSON_INCLUDE_INSTALL_DIR "include")
|
|
||||||
set(NLOHMANN_JSON_TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
|
|
||||||
set(NLOHMANN_JSON_CMAKE_CONFIG_TEMPLATE "cmake/config.cmake.in")
|
|
||||||
set(NLOHMANN_JSON_CMAKE_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}")
|
|
||||||
set(NLOHMANN_JSON_CMAKE_VERSION_CONFIG_FILE "${NLOHMANN_JSON_CMAKE_CONFIG_DIR}/${PROJECT_NAME}ConfigVersion.cmake")
|
|
||||||
set(NLOHMANN_JSON_CMAKE_PROJECT_CONFIG_FILE "${NLOHMANN_JSON_CMAKE_CONFIG_DIR}/${PROJECT_NAME}Config.cmake")
|
|
||||||
set(NLOHMANN_JSON_CMAKE_PROJECT_TARGETS_FILE "${NLOHMANN_JSON_CMAKE_CONFIG_DIR}/${PROJECT_NAME}Targets.cmake")
|
|
||||||
|
|
||||||
if (JSON_MultipleHeaders)
|
|
||||||
set(NLOHMANN_JSON_INCLUDE_BUILD_DIR "${PROJECT_SOURCE_DIR}/include/")
|
|
||||||
message(STATUS "Using the multi-header code from ${NLOHMANN_JSON_INCLUDE_BUILD_DIR}")
|
|
||||||
else()
|
|
||||||
set(NLOHMANN_JSON_INCLUDE_BUILD_DIR "${PROJECT_SOURCE_DIR}/single_include/")
|
|
||||||
message(STATUS "Using the single-header code from ${NLOHMANN_JSON_INCLUDE_BUILD_DIR}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
##
|
|
||||||
## TARGET
|
|
||||||
## create target and add include path
|
|
||||||
##
|
|
||||||
add_library(${NLOHMANN_JSON_TARGET_NAME} INTERFACE)
|
|
||||||
add_library(${PROJECT_NAME}::${NLOHMANN_JSON_TARGET_NAME} ALIAS ${NLOHMANN_JSON_TARGET_NAME})
|
|
||||||
if (${CMAKE_VERSION} VERSION_LESS "3.8.0")
|
|
||||||
target_compile_features(${NLOHMANN_JSON_TARGET_NAME} INTERFACE cxx_range_for)
|
|
||||||
else()
|
|
||||||
target_compile_features(${NLOHMANN_JSON_TARGET_NAME} INTERFACE cxx_std_11)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_include_directories(
|
|
||||||
${NLOHMANN_JSON_TARGET_NAME}
|
|
||||||
INTERFACE
|
|
||||||
$<BUILD_INTERFACE:${NLOHMANN_JSON_INCLUDE_BUILD_DIR}>
|
|
||||||
$<INSTALL_INTERFACE:include>
|
|
||||||
)
|
|
||||||
|
|
||||||
## add debug view definition file for msvc (natvis)
|
|
||||||
if (MSVC)
|
|
||||||
set(NLOHMANN_ADD_NATVIS TRUE)
|
|
||||||
set(NLOHMANN_NATVIS_FILE "nlohmann_json.natvis")
|
|
||||||
target_sources(
|
|
||||||
${NLOHMANN_JSON_TARGET_NAME}
|
|
||||||
INTERFACE
|
|
||||||
$<INSTALL_INTERFACE:${NLOHMANN_NATVIS_FILE}>
|
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/${NLOHMANN_NATVIS_FILE}>
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
##
|
|
||||||
## TESTS
|
|
||||||
## create and configure the unit test target
|
|
||||||
##
|
|
||||||
include(CTest) #adds option BUILD_TESTING (default ON)
|
|
||||||
|
|
||||||
if(BUILD_TESTING AND JSON_BuildTests)
|
|
||||||
enable_testing()
|
|
||||||
add_subdirectory(test)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
##
|
|
||||||
## INSTALL
|
|
||||||
## install header files, generate and install cmake config files for find_package()
|
|
||||||
##
|
|
||||||
include(CMakePackageConfigHelpers)
|
|
||||||
write_basic_package_version_file(
|
|
||||||
${NLOHMANN_JSON_CMAKE_VERSION_CONFIG_FILE} COMPATIBILITY SameMajorVersion
|
|
||||||
)
|
|
||||||
configure_file(
|
|
||||||
${NLOHMANN_JSON_CMAKE_CONFIG_TEMPLATE}
|
|
||||||
${NLOHMANN_JSON_CMAKE_PROJECT_CONFIG_FILE}
|
|
||||||
@ONLY
|
|
||||||
)
|
|
||||||
|
|
||||||
if(JSON_Install)
|
|
||||||
install(
|
|
||||||
DIRECTORY ${NLOHMANN_JSON_INCLUDE_BUILD_DIR}
|
|
||||||
DESTINATION ${NLOHMANN_JSON_INCLUDE_INSTALL_DIR}
|
|
||||||
)
|
|
||||||
install(
|
|
||||||
FILES ${NLOHMANN_JSON_CMAKE_PROJECT_CONFIG_FILE} ${NLOHMANN_JSON_CMAKE_VERSION_CONFIG_FILE}
|
|
||||||
DESTINATION ${NLOHMANN_JSON_CONFIG_INSTALL_DIR}
|
|
||||||
)
|
|
||||||
if (NLOHMANN_ADD_NATVIS)
|
|
||||||
install(
|
|
||||||
FILES ${NLOHMANN_NATVIS_FILE}
|
|
||||||
DESTINATION .
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
export(
|
|
||||||
TARGETS ${NLOHMANN_JSON_TARGET_NAME}
|
|
||||||
NAMESPACE ${PROJECT_NAME}::
|
|
||||||
FILE ${NLOHMANN_JSON_CMAKE_PROJECT_TARGETS_FILE}
|
|
||||||
)
|
|
||||||
install(
|
|
||||||
TARGETS ${NLOHMANN_JSON_TARGET_NAME}
|
|
||||||
EXPORT ${NLOHMANN_JSON_TARGETS_EXPORT_NAME}
|
|
||||||
INCLUDES DESTINATION ${NLOHMANN_JSON_INCLUDE_INSTALL_DIR}
|
|
||||||
)
|
|
||||||
install(
|
|
||||||
EXPORT ${NLOHMANN_JSON_TARGETS_EXPORT_NAME}
|
|
||||||
NAMESPACE ${PROJECT_NAME}::
|
|
||||||
DESTINATION ${NLOHMANN_JSON_CONFIG_INSTALL_DIR}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
# Contributor Covenant Code of Conduct
|
|
||||||
|
|
||||||
## Our Pledge
|
|
||||||
|
|
||||||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
|
||||||
|
|
||||||
## Our Standards
|
|
||||||
|
|
||||||
Examples of behavior that contributes to creating a positive environment include:
|
|
||||||
|
|
||||||
* Using welcoming and inclusive language
|
|
||||||
* Being respectful of differing viewpoints and experiences
|
|
||||||
* Gracefully accepting constructive criticism
|
|
||||||
* Focusing on what is best for the community
|
|
||||||
* Showing empathy towards other community members
|
|
||||||
|
|
||||||
Examples of unacceptable behavior by participants include:
|
|
||||||
|
|
||||||
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
|
||||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
||||||
* Public or private harassment
|
|
||||||
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
|
||||||
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
||||||
|
|
||||||
## Our Responsibilities
|
|
||||||
|
|
||||||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
|
||||||
|
|
||||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
|
||||||
|
|
||||||
## Scope
|
|
||||||
|
|
||||||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
|
||||||
|
|
||||||
## Enforcement
|
|
||||||
|
|
||||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at mail@nlohmann.me. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
|
||||||
|
|
||||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
|
||||||
|
|
||||||
## Attribution
|
|
||||||
|
|
||||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
|
||||||
|
|
||||||
[homepage]: http://contributor-covenant.org
|
|
||||||
[version]: http://contributor-covenant.org/version/1/4/
|
|
||||||
-1526
File diff suppressed because it is too large
Load Diff
-21
@@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2013-2019 Niels Lohmann
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
@@ -1,541 +0,0 @@
|
|||||||
.PHONY: pretty clean ChangeLog.md
|
|
||||||
|
|
||||||
SRCS = include/nlohmann/json.hpp \
|
|
||||||
include/nlohmann/json_fwd.hpp \
|
|
||||||
include/nlohmann/adl_serializer.hpp \
|
|
||||||
include/nlohmann/detail/conversions/from_json.hpp \
|
|
||||||
include/nlohmann/detail/conversions/to_chars.hpp \
|
|
||||||
include/nlohmann/detail/conversions/to_json.hpp \
|
|
||||||
include/nlohmann/detail/exceptions.hpp \
|
|
||||||
include/nlohmann/detail/input/binary_reader.hpp \
|
|
||||||
include/nlohmann/detail/input/input_adapters.hpp \
|
|
||||||
include/nlohmann/detail/input/json_sax.hpp \
|
|
||||||
include/nlohmann/detail/input/lexer.hpp \
|
|
||||||
include/nlohmann/detail/input/parser.hpp \
|
|
||||||
include/nlohmann/detail/input/position_t.hpp \
|
|
||||||
include/nlohmann/detail/iterators/internal_iterator.hpp \
|
|
||||||
include/nlohmann/detail/iterators/iter_impl.hpp \
|
|
||||||
include/nlohmann/detail/iterators/iteration_proxy.hpp \
|
|
||||||
include/nlohmann/detail/iterators/json_reverse_iterator.hpp \
|
|
||||||
include/nlohmann/detail/iterators/primitive_iterator.hpp \
|
|
||||||
include/nlohmann/detail/json_pointer.hpp \
|
|
||||||
include/nlohmann/detail/json_ref.hpp \
|
|
||||||
include/nlohmann/detail/macro_scope.hpp \
|
|
||||||
include/nlohmann/detail/macro_unscope.hpp \
|
|
||||||
include/nlohmann/detail/meta/cpp_future.hpp \
|
|
||||||
include/nlohmann/detail/meta/detected.hpp \
|
|
||||||
include/nlohmann/detail/meta/type_traits.hpp \
|
|
||||||
include/nlohmann/detail/meta/void_t.hpp \
|
|
||||||
include/nlohmann/detail/output/binary_writer.hpp \
|
|
||||||
include/nlohmann/detail/output/output_adapters.hpp \
|
|
||||||
include/nlohmann/detail/output/serializer.hpp \
|
|
||||||
include/nlohmann/detail/value_t.hpp
|
|
||||||
|
|
||||||
UNAME = $(shell uname)
|
|
||||||
CXX=clang++
|
|
||||||
|
|
||||||
AMALGAMATED_FILE=single_include/nlohmann/json.hpp
|
|
||||||
|
|
||||||
# directory to recent compiler binaries
|
|
||||||
COMPILER_DIR=/Users/niels/Documents/projects/compilers/local/bin
|
|
||||||
|
|
||||||
# main target
|
|
||||||
all:
|
|
||||||
@echo "amalgamate - amalgamate file single_include/nlohmann/json.hpp from the include/nlohmann sources"
|
|
||||||
@echo "ChangeLog.md - generate ChangeLog file"
|
|
||||||
@echo "check - compile and execute test suite"
|
|
||||||
@echo "check-amalgamation - check whether sources have been amalgamated"
|
|
||||||
@echo "check-fast - compile and execute test suite (skip long-running tests)"
|
|
||||||
@echo "clean - remove built files"
|
|
||||||
@echo "coverage - create coverage information with lcov"
|
|
||||||
@echo "cppcheck - analyze code with cppcheck"
|
|
||||||
@echo "cpplint - analyze code with cpplint"
|
|
||||||
@echo "clang_tidy - analyze code with Clang-Tidy"
|
|
||||||
@echo "clang_analyze - analyze code with Clang-Analyzer"
|
|
||||||
@echo "doctest - compile example files and check their output"
|
|
||||||
@echo "fuzz_testing - prepare fuzz testing of the JSON parser"
|
|
||||||
@echo "fuzz_testing_bson - prepare fuzz testing of the BSON parser"
|
|
||||||
@echo "fuzz_testing_cbor - prepare fuzz testing of the CBOR parser"
|
|
||||||
@echo "fuzz_testing_msgpack - prepare fuzz testing of the MessagePack parser"
|
|
||||||
@echo "fuzz_testing_ubjson - prepare fuzz testing of the UBJSON parser"
|
|
||||||
@echo "json_unit - create single-file test executable"
|
|
||||||
@echo "pedantic_clang - run Clang with maximal warning flags"
|
|
||||||
@echo "pedantic_gcc - run GCC with maximal warning flags"
|
|
||||||
@echo "pretty - beautify code with Artistic Style"
|
|
||||||
@echo "run_benchmarks - build and run benchmarks"
|
|
||||||
|
|
||||||
##########################################################################
|
|
||||||
# unit tests
|
|
||||||
##########################################################################
|
|
||||||
|
|
||||||
# build unit tests
|
|
||||||
json_unit:
|
|
||||||
@$(MAKE) json_unit -C test
|
|
||||||
|
|
||||||
# run unit tests
|
|
||||||
check:
|
|
||||||
$(MAKE) check -C test
|
|
||||||
|
|
||||||
check-fast:
|
|
||||||
$(MAKE) check -C test TEST_PATTERN=""
|
|
||||||
|
|
||||||
# clean up
|
|
||||||
clean:
|
|
||||||
rm -fr json_unit json_benchmarks fuzz fuzz-testing *.dSYM test/*.dSYM
|
|
||||||
rm -fr benchmarks/files/numbers/*.json
|
|
||||||
rm -fr build_coverage build_benchmarks
|
|
||||||
$(MAKE) clean -Cdoc
|
|
||||||
$(MAKE) clean -Ctest
|
|
||||||
|
|
||||||
|
|
||||||
##########################################################################
|
|
||||||
# coverage
|
|
||||||
##########################################################################
|
|
||||||
|
|
||||||
coverage:
|
|
||||||
mkdir build_coverage
|
|
||||||
cd build_coverage ; CXX=g++-7 cmake .. -GNinja -DJSON_Coverage=ON -DJSON_MultipleHeaders=ON
|
|
||||||
cd build_coverage ; ninja
|
|
||||||
cd build_coverage ; ctest -E '.*_default' -j10
|
|
||||||
cd build_coverage ; ninja lcov_html
|
|
||||||
open build_coverage/test/html/index.html
|
|
||||||
|
|
||||||
|
|
||||||
##########################################################################
|
|
||||||
# documentation tests
|
|
||||||
##########################################################################
|
|
||||||
|
|
||||||
# compile example files and check output
|
|
||||||
doctest:
|
|
||||||
$(MAKE) check_output -C doc
|
|
||||||
|
|
||||||
|
|
||||||
##########################################################################
|
|
||||||
# warning detector
|
|
||||||
##########################################################################
|
|
||||||
|
|
||||||
# calling Clang with all warnings, except:
|
|
||||||
# -Wno-documentation-unknown-command: code uses user-defined commands like @complexity
|
|
||||||
# -Wno-exit-time-destructors: warning in Catch code
|
|
||||||
# -Wno-keyword-macro: unit-tests use "#define private public"
|
|
||||||
# -Wno-deprecated-declarations: the library deprecated some functions
|
|
||||||
# -Wno-weak-vtables: exception class is defined inline, but has virtual method
|
|
||||||
# -Wno-range-loop-analysis: items tests "for(const auto i...)"
|
|
||||||
# -Wno-float-equal: not all comparisons in the tests can be replaced by Approx
|
|
||||||
# -Wno-switch-enum -Wno-covered-switch-default: pedantic/contradicting warnings about switches
|
|
||||||
# -Wno-c++2a-compat: u8 literals will behave differently in C++20...
|
|
||||||
# -Wno-padded: padding is nothing to warn about
|
|
||||||
pedantic_clang:
|
|
||||||
$(MAKE) json_unit CXX=$(COMPILER_DIR)/clang++ CXXFLAGS=" \
|
|
||||||
-std=c++11 -Wno-c++98-compat -Wno-c++98-compat-pedantic \
|
|
||||||
-Werror \
|
|
||||||
-Weverything \
|
|
||||||
-Wno-documentation-unknown-command \
|
|
||||||
-Wno-exit-time-destructors \
|
|
||||||
-Wno-keyword-macro \
|
|
||||||
-Wno-deprecated-declarations \
|
|
||||||
-Wno-weak-vtables \
|
|
||||||
-Wno-range-loop-analysis \
|
|
||||||
-Wno-float-equal \
|
|
||||||
-Wno-switch-enum -Wno-covered-switch-default \
|
|
||||||
-Wno-c++2a-compat \
|
|
||||||
-Wno-c++17-extensions \
|
|
||||||
-Wno-padded"
|
|
||||||
|
|
||||||
# calling GCC with most warnings
|
|
||||||
pedantic_gcc:
|
|
||||||
$(MAKE) json_unit CXX=$(COMPILER_DIR)/g++ CXXFLAGS=" \
|
|
||||||
-std=c++11 \
|
|
||||||
-Waddress \
|
|
||||||
-Waddress-of-packed-member \
|
|
||||||
-Waggressive-loop-optimizations \
|
|
||||||
-Waligned-new=all \
|
|
||||||
-Wall \
|
|
||||||
-Walloc-zero \
|
|
||||||
-Walloca \
|
|
||||||
-Warray-bounds \
|
|
||||||
-Warray-bounds=2 \
|
|
||||||
-Wattribute-alias=2 \
|
|
||||||
-Wattribute-warning \
|
|
||||||
-Wattributes \
|
|
||||||
-Wbool-compare \
|
|
||||||
-Wbool-operation \
|
|
||||||
-Wbuiltin-declaration-mismatch \
|
|
||||||
-Wbuiltin-macro-redefined \
|
|
||||||
-Wcannot-profile \
|
|
||||||
-Wcast-align \
|
|
||||||
-Wcast-function-type \
|
|
||||||
-Wcast-qual \
|
|
||||||
-Wcatch-value=3 \
|
|
||||||
-Wchar-subscripts \
|
|
||||||
-Wclass-conversion \
|
|
||||||
-Wclass-memaccess \
|
|
||||||
-Wclobbered \
|
|
||||||
-Wcomment \
|
|
||||||
-Wcomments \
|
|
||||||
-Wconditionally-supported \
|
|
||||||
-Wconversion \
|
|
||||||
-Wconversion-null \
|
|
||||||
-Wcoverage-mismatch \
|
|
||||||
-Wcpp \
|
|
||||||
-Wctor-dtor-privacy \
|
|
||||||
-Wdangling-else \
|
|
||||||
-Wdate-time \
|
|
||||||
-Wdelete-incomplete \
|
|
||||||
-Wdelete-non-virtual-dtor \
|
|
||||||
-Wdeprecated \
|
|
||||||
-Wdeprecated-copy \
|
|
||||||
-Wdeprecated-copy-dtor \
|
|
||||||
-Wdeprecated-declarations \
|
|
||||||
-Wdisabled-optimization \
|
|
||||||
-Wdiv-by-zero \
|
|
||||||
-Wdouble-promotion \
|
|
||||||
-Wduplicated-branches \
|
|
||||||
-Wduplicated-cond \
|
|
||||||
-Weffc++ \
|
|
||||||
-Wempty-body \
|
|
||||||
-Wendif-labels \
|
|
||||||
-Wenum-compare \
|
|
||||||
-Wexpansion-to-defined \
|
|
||||||
-Werror \
|
|
||||||
-Wextra \
|
|
||||||
-Wextra-semi \
|
|
||||||
-Wfloat-conversion \
|
|
||||||
-Wfloat-equal \
|
|
||||||
-Wformat \
|
|
||||||
-Wformat-contains-nul \
|
|
||||||
-Wformat-extra-args \
|
|
||||||
-Wformat-nonliteral \
|
|
||||||
-Wformat-overflow=2 \
|
|
||||||
-Wformat-security \
|
|
||||||
-Wformat-signedness \
|
|
||||||
-Wformat-truncation=2 \
|
|
||||||
-Wformat-y2k \
|
|
||||||
-Wformat-zero-length \
|
|
||||||
-Wformat=2 \
|
|
||||||
-Wframe-address \
|
|
||||||
-Wfree-nonheap-object \
|
|
||||||
-Whsa \
|
|
||||||
-Wif-not-aligned \
|
|
||||||
-Wignored-attributes \
|
|
||||||
-Wignored-qualifiers \
|
|
||||||
-Wimplicit-fallthrough=5 \
|
|
||||||
-Winherited-variadic-ctor \
|
|
||||||
-Winit-list-lifetime \
|
|
||||||
-Winit-self \
|
|
||||||
-Winline \
|
|
||||||
-Wint-in-bool-context \
|
|
||||||
-Wint-to-pointer-cast \
|
|
||||||
-Winvalid-memory-model \
|
|
||||||
-Winvalid-offsetof \
|
|
||||||
-Winvalid-pch \
|
|
||||||
-Wliteral-suffix \
|
|
||||||
-Wlogical-not-parentheses \
|
|
||||||
-Wlogical-op \
|
|
||||||
-Wlto-type-mismatch \
|
|
||||||
-Wmain \
|
|
||||||
-Wmaybe-uninitialized \
|
|
||||||
-Wmemset-elt-size \
|
|
||||||
-Wmemset-transposed-args \
|
|
||||||
-Wmisleading-indentation \
|
|
||||||
-Wmissing-attributes \
|
|
||||||
-Wmissing-braces \
|
|
||||||
-Wmissing-declarations \
|
|
||||||
-Wmissing-field-initializers \
|
|
||||||
-Wmissing-format-attribute \
|
|
||||||
-Wmissing-include-dirs \
|
|
||||||
-Wmissing-noreturn \
|
|
||||||
-Wmissing-profile \
|
|
||||||
-Wmultichar \
|
|
||||||
-Wmultiple-inheritance \
|
|
||||||
-Wmultistatement-macros \
|
|
||||||
-Wnarrowing \
|
|
||||||
-Wno-deprecated-declarations \
|
|
||||||
-Wno-long-long \
|
|
||||||
-Wno-namespaces \
|
|
||||||
-Wno-padded \
|
|
||||||
-Wno-switch-enum \
|
|
||||||
-Wno-system-headers \
|
|
||||||
-Wno-templates \
|
|
||||||
-Wno-undef \
|
|
||||||
-Wnoexcept \
|
|
||||||
-Wnoexcept-type \
|
|
||||||
-Wnon-template-friend \
|
|
||||||
-Wnon-virtual-dtor \
|
|
||||||
-Wnonnull \
|
|
||||||
-Wnonnull-compare \
|
|
||||||
-Wnonportable-cfstrings \
|
|
||||||
-Wnormalized \
|
|
||||||
-Wnull-dereference \
|
|
||||||
-Wodr \
|
|
||||||
-Wold-style-cast \
|
|
||||||
-Wopenmp-simd \
|
|
||||||
-Woverflow \
|
|
||||||
-Woverlength-strings \
|
|
||||||
-Woverloaded-virtual \
|
|
||||||
-Wpacked \
|
|
||||||
-Wpacked-bitfield-compat \
|
|
||||||
-Wpacked-not-aligned \
|
|
||||||
-Wparentheses \
|
|
||||||
-Wpedantic \
|
|
||||||
-Wpessimizing-move \
|
|
||||||
-Wplacement-new=2 \
|
|
||||||
-Wpmf-conversions \
|
|
||||||
-Wpointer-arith \
|
|
||||||
-Wpointer-compare \
|
|
||||||
-Wpragmas \
|
|
||||||
-Wprio-ctor-dtor \
|
|
||||||
-Wpsabi \
|
|
||||||
-Wredundant-decls \
|
|
||||||
-Wredundant-move \
|
|
||||||
-Wregister \
|
|
||||||
-Wreorder \
|
|
||||||
-Wrestrict \
|
|
||||||
-Wreturn-local-addr \
|
|
||||||
-Wreturn-type \
|
|
||||||
-Wscalar-storage-order \
|
|
||||||
-Wsequence-point \
|
|
||||||
-Wshadow \
|
|
||||||
-Wshadow-compatible-local \
|
|
||||||
-Wshadow-local \
|
|
||||||
-Wshadow=compatible-local \
|
|
||||||
-Wshadow=global \
|
|
||||||
-Wshadow=local \
|
|
||||||
-Wshift-count-negative \
|
|
||||||
-Wshift-count-overflow \
|
|
||||||
-Wshift-negative-value \
|
|
||||||
-Wshift-overflow=2 \
|
|
||||||
-Wsign-compare \
|
|
||||||
-Wsign-conversion \
|
|
||||||
-Wsign-promo \
|
|
||||||
-Wsized-deallocation \
|
|
||||||
-Wsizeof-array-argument \
|
|
||||||
-Wsizeof-pointer-div \
|
|
||||||
-Wsizeof-pointer-memaccess \
|
|
||||||
-Wstack-protector \
|
|
||||||
-Wstrict-aliasing=3 \
|
|
||||||
-Wstrict-null-sentinel \
|
|
||||||
-Wstrict-overflow=5 \
|
|
||||||
-Wstringop-overflow=4 \
|
|
||||||
-Wstringop-truncation \
|
|
||||||
-Wsubobject-linkage \
|
|
||||||
-Wsuggest-attribute=cold \
|
|
||||||
-Wsuggest-attribute=const \
|
|
||||||
-Wsuggest-attribute=format \
|
|
||||||
-Wsuggest-attribute=malloc \
|
|
||||||
-Wsuggest-attribute=noreturn \
|
|
||||||
-Wsuggest-attribute=pure \
|
|
||||||
-Wsuggest-final-methods \
|
|
||||||
-Wsuggest-final-types \
|
|
||||||
-Wsuggest-override \
|
|
||||||
-Wswitch \
|
|
||||||
-Wswitch-bool \
|
|
||||||
-Wswitch-default \
|
|
||||||
-Wswitch-unreachable \
|
|
||||||
-Wsync-nand \
|
|
||||||
-Wsynth \
|
|
||||||
-Wtautological-compare \
|
|
||||||
-Wterminate \
|
|
||||||
-Wtrampolines \
|
|
||||||
-Wtrigraphs \
|
|
||||||
-Wtype-limits \
|
|
||||||
-Wuninitialized \
|
|
||||||
-Wunknown-pragmas \
|
|
||||||
-Wunreachable-code \
|
|
||||||
-Wunsafe-loop-optimizations \
|
|
||||||
-Wunused \
|
|
||||||
-Wunused-but-set-parameter \
|
|
||||||
-Wunused-but-set-variable \
|
|
||||||
-Wunused-const-variable=2 \
|
|
||||||
-Wunused-function \
|
|
||||||
-Wunused-label \
|
|
||||||
-Wunused-local-typedefs \
|
|
||||||
-Wunused-macros \
|
|
||||||
-Wunused-parameter \
|
|
||||||
-Wunused-result \
|
|
||||||
-Wunused-value \
|
|
||||||
-Wunused-variable \
|
|
||||||
-Wuseless-cast \
|
|
||||||
-Wvarargs \
|
|
||||||
-Wvariadic-macros \
|
|
||||||
-Wvector-operation-performance \
|
|
||||||
-Wvirtual-inheritance \
|
|
||||||
-Wvirtual-move-assign \
|
|
||||||
-Wvla \
|
|
||||||
-Wvolatile-register-var \
|
|
||||||
-Wwrite-strings \
|
|
||||||
-Wzero-as-null-pointer-constant \
|
|
||||||
"
|
|
||||||
|
|
||||||
##########################################################################
|
|
||||||
# benchmarks
|
|
||||||
##########################################################################
|
|
||||||
|
|
||||||
run_benchmarks:
|
|
||||||
mkdir build_benchmarks
|
|
||||||
cd build_benchmarks ; cmake ../benchmarks
|
|
||||||
cd build_benchmarks ; make
|
|
||||||
cd build_benchmarks ; ./json_benchmarks
|
|
||||||
|
|
||||||
##########################################################################
|
|
||||||
# fuzzing
|
|
||||||
##########################################################################
|
|
||||||
|
|
||||||
# the overall fuzz testing target
|
|
||||||
fuzz_testing:
|
|
||||||
rm -fr fuzz-testing
|
|
||||||
mkdir -p fuzz-testing fuzz-testing/testcases fuzz-testing/out
|
|
||||||
$(MAKE) parse_afl_fuzzer -C test CXX=afl-clang++
|
|
||||||
mv test/parse_afl_fuzzer fuzz-testing/fuzzer
|
|
||||||
find test/data/json_tests -size -5k -name *json | xargs -I{} cp "{}" fuzz-testing/testcases
|
|
||||||
@echo "Execute: afl-fuzz -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer"
|
|
||||||
|
|
||||||
fuzz_testing_bson:
|
|
||||||
rm -fr fuzz-testing
|
|
||||||
mkdir -p fuzz-testing fuzz-testing/testcases fuzz-testing/out
|
|
||||||
$(MAKE) parse_bson_fuzzer -C test CXX=afl-clang++
|
|
||||||
mv test/parse_bson_fuzzer fuzz-testing/fuzzer
|
|
||||||
find test/data -size -5k -name *.bson | xargs -I{} cp "{}" fuzz-testing/testcases
|
|
||||||
@echo "Execute: afl-fuzz -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer"
|
|
||||||
|
|
||||||
fuzz_testing_cbor:
|
|
||||||
rm -fr fuzz-testing
|
|
||||||
mkdir -p fuzz-testing fuzz-testing/testcases fuzz-testing/out
|
|
||||||
$(MAKE) parse_cbor_fuzzer -C test CXX=afl-clang++
|
|
||||||
mv test/parse_cbor_fuzzer fuzz-testing/fuzzer
|
|
||||||
find test/data -size -5k -name *.cbor | xargs -I{} cp "{}" fuzz-testing/testcases
|
|
||||||
@echo "Execute: afl-fuzz -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer"
|
|
||||||
|
|
||||||
fuzz_testing_msgpack:
|
|
||||||
rm -fr fuzz-testing
|
|
||||||
mkdir -p fuzz-testing fuzz-testing/testcases fuzz-testing/out
|
|
||||||
$(MAKE) parse_msgpack_fuzzer -C test CXX=afl-clang++
|
|
||||||
mv test/parse_msgpack_fuzzer fuzz-testing/fuzzer
|
|
||||||
find test/data -size -5k -name *.msgpack | xargs -I{} cp "{}" fuzz-testing/testcases
|
|
||||||
@echo "Execute: afl-fuzz -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer"
|
|
||||||
|
|
||||||
fuzz_testing_ubjson:
|
|
||||||
rm -fr fuzz-testing
|
|
||||||
mkdir -p fuzz-testing fuzz-testing/testcases fuzz-testing/out
|
|
||||||
$(MAKE) parse_ubjson_fuzzer -C test CXX=afl-clang++
|
|
||||||
mv test/parse_ubjson_fuzzer fuzz-testing/fuzzer
|
|
||||||
find test/data -size -5k -name *.ubjson | xargs -I{} cp "{}" fuzz-testing/testcases
|
|
||||||
@echo "Execute: afl-fuzz -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer"
|
|
||||||
|
|
||||||
fuzzing-start:
|
|
||||||
afl-fuzz -S fuzzer1 -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer > /dev/null &
|
|
||||||
afl-fuzz -S fuzzer2 -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer > /dev/null &
|
|
||||||
afl-fuzz -S fuzzer3 -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer > /dev/null &
|
|
||||||
afl-fuzz -S fuzzer4 -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer > /dev/null &
|
|
||||||
afl-fuzz -S fuzzer5 -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer > /dev/null &
|
|
||||||
afl-fuzz -S fuzzer6 -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer > /dev/null &
|
|
||||||
afl-fuzz -S fuzzer7 -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer > /dev/null &
|
|
||||||
afl-fuzz -M fuzzer0 -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer
|
|
||||||
|
|
||||||
fuzzing-stop:
|
|
||||||
-killall fuzzer
|
|
||||||
-killall afl-fuzz
|
|
||||||
|
|
||||||
##########################################################################
|
|
||||||
# static analyzer
|
|
||||||
##########################################################################
|
|
||||||
|
|
||||||
# call cppcheck on the main header file
|
|
||||||
cppcheck:
|
|
||||||
cppcheck --enable=warning --inline-suppr --inconclusive --force --std=c++11 $(SRCS) --error-exitcode=1
|
|
||||||
|
|
||||||
# compile and check with Clang Static Analyzer
|
|
||||||
clang_analyze:
|
|
||||||
rm -fr clang_analyze_build
|
|
||||||
mkdir clang_analyze_build
|
|
||||||
cd clang_analyze_build ; CCC_CXX=$(COMPILER_DIR)/clang++ CXX=$(COMPILER_DIR)/clang++ $(COMPILER_DIR)/scan-build cmake .. -GNinja
|
|
||||||
cd clang_analyze_build ; $(COMPILER_DIR)/scan-build -enable-checker alpha.core.BoolAssignment,alpha.core.CallAndMessageUnInitRefArg,alpha.core.CastSize,alpha.core.CastToStruct,alpha.core.Conversion,alpha.core.DynamicTypeChecker,alpha.core.FixedAddr,alpha.core.PointerArithm,alpha.core.PointerSub,alpha.core.SizeofPtr,alpha.core.StackAddressAsyncEscape,alpha.core.TestAfterDivZero,alpha.deadcode.UnreachableCode,core.builtin.BuiltinFunctions,core.builtin.NoReturnFunctions,core.CallAndMessage,core.DivideZero,core.DynamicTypePropagation,core.NonnilStringConstants,core.NonNullParamChecker,core.NullDereference,core.StackAddressEscape,core.UndefinedBinaryOperatorResult,core.uninitialized.ArraySubscript,core.uninitialized.Assign,core.uninitialized.Branch,core.uninitialized.CapturedBlockVariable,core.uninitialized.UndefReturn,core.VLASize,cplusplus.InnerPointer,cplusplus.Move,cplusplus.NewDelete,cplusplus.NewDeleteLeaks,cplusplus.SelfAssignment,deadcode.DeadStores,nullability.NullableDereferenced,nullability.NullablePassedToNonnull,nullability.NullableReturnedFromNonnull,nullability.NullPassedToNonnull,nullability.NullReturnedFromNonnull --use-c++=$(COMPILER_DIR)/clang++ --view -analyze-headers -o clang_analyze_build/report.html ninja
|
|
||||||
|
|
||||||
# call cpplint (some errors expected due to false positives)
|
|
||||||
cpplint:
|
|
||||||
third_party/cpplint/cpplint.py --filter=-whitespace,-legal,-readability/alt_tokens,-runtime/references,-runtime/explicit --quiet --recursive include
|
|
||||||
|
|
||||||
clang_tidy:
|
|
||||||
$(COMPILER_DIR)/clang-tidy $(SRCS) -- -Iinclude -std=c++11
|
|
||||||
|
|
||||||
pvs_studio:
|
|
||||||
rm -fr pvs_studio_build
|
|
||||||
mkdir pvs_studio_build
|
|
||||||
cd pvs_studio_build ; cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=On
|
|
||||||
cd pvs_studio_build ; pvs-studio-analyzer analyze -j 10
|
|
||||||
cd pvs_studio_build ; plog-converter -a'GA:1,2;64:1;CS' -t fullhtml PVS-Studio.log -o pvs
|
|
||||||
open pvs_studio_build/pvs/index.html
|
|
||||||
|
|
||||||
infer:
|
|
||||||
rm -fr infer_build
|
|
||||||
mkdir infer_build
|
|
||||||
cd infer_build ; infer compile -- cmake .. ; infer run -- make -j 4
|
|
||||||
|
|
||||||
oclint:
|
|
||||||
oclint $(SRCS) -report-type html -enable-global-analysis -o oclint_report.html -max-priority-1=10000 -max-priority-2=10000 -max-priority-3=10000 -- -std=c++11 -Iinclude
|
|
||||||
open oclint_report.html
|
|
||||||
|
|
||||||
##########################################################################
|
|
||||||
# maintainer targets
|
|
||||||
##########################################################################
|
|
||||||
|
|
||||||
# pretty printer
|
|
||||||
pretty:
|
|
||||||
astyle --style=allman --indent=spaces=4 --indent-modifiers \
|
|
||||||
--indent-switches --indent-preproc-block --indent-preproc-define \
|
|
||||||
--indent-col1-comments --pad-oper --pad-header --align-pointer=type \
|
|
||||||
--align-reference=type --add-brackets --convert-tabs --close-templates \
|
|
||||||
--lineend=linux --preserve-date --suffix=none --formatted \
|
|
||||||
$(SRCS) $(AMALGAMATED_FILE) test/src/*.cpp \
|
|
||||||
benchmarks/src/benchmarks.cpp doc/examples/*.cpp
|
|
||||||
|
|
||||||
# create single header file
|
|
||||||
amalgamate: $(AMALGAMATED_FILE)
|
|
||||||
|
|
||||||
$(AMALGAMATED_FILE): $(SRCS)
|
|
||||||
third_party/amalgamate/amalgamate.py -c third_party/amalgamate/config.json -s . --verbose=yes
|
|
||||||
$(MAKE) pretty
|
|
||||||
|
|
||||||
# check if single_include/nlohmann/json.hpp has been amalgamated from the nlohmann sources
|
|
||||||
check-amalgamation:
|
|
||||||
@mv $(AMALGAMATED_FILE) $(AMALGAMATED_FILE)~
|
|
||||||
@$(MAKE) amalgamate
|
|
||||||
@diff $(AMALGAMATED_FILE) $(AMALGAMATED_FILE)~ || (echo "===================================================================\n Amalgamation required! Please read the contribution guidelines\n in file .github/CONTRIBUTING.md.\n===================================================================" ; mv $(AMALGAMATED_FILE)~ $(AMALGAMATED_FILE) ; false)
|
|
||||||
@mv $(AMALGAMATED_FILE)~ $(AMALGAMATED_FILE)
|
|
||||||
|
|
||||||
# check if every header in nlohmann includes sufficient headers to be compiled
|
|
||||||
# individually
|
|
||||||
check-single-includes:
|
|
||||||
@for x in $(SRCS); do \
|
|
||||||
echo "Checking self-sufficiency of $$x..." ; \
|
|
||||||
echo "#include <$$x>\nint main() {}\n" | sed 's|include/||' > single_include_test.cpp; \
|
|
||||||
$(CXX) $(CXXFLAGS) -Iinclude -std=c++11 single_include_test.cpp -o single_include_test; \
|
|
||||||
rm -f single_include_test.cpp single_include_test; \
|
|
||||||
done
|
|
||||||
|
|
||||||
##########################################################################
|
|
||||||
# changelog
|
|
||||||
##########################################################################
|
|
||||||
|
|
||||||
NEXT_VERSION ?= "unreleased"
|
|
||||||
|
|
||||||
ChangeLog.md:
|
|
||||||
github_changelog_generator -o ChangeLog.md --simple-list --release-url https://github.com/nlohmann/json/releases/tag/%s --future-release $(NEXT_VERSION)
|
|
||||||
gsed -i 's|https://github.com/nlohmann/json/releases/tag/HEAD|https://github.com/nlohmann/json/tree/HEAD|' ChangeLog.md
|
|
||||||
gsed -i '2i All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).' ChangeLog.md
|
|
||||||
|
|
||||||
|
|
||||||
##########################################################################
|
|
||||||
# release
|
|
||||||
##########################################################################
|
|
||||||
|
|
||||||
release:
|
|
||||||
mkdir release_files
|
|
||||||
zip -9 -r include.zip include/*
|
|
||||||
gpg --armor --detach-sig include.zip
|
|
||||||
mv include.zip include.zip.asc release_files
|
|
||||||
gpg --armor --detach-sig single_include/nlohmann/json.hpp
|
|
||||||
cp single_include/nlohmann/json.hpp release_files
|
|
||||||
mv single_include/nlohmann/json.hpp.asc release_files
|
|
||||||
cd release_files ; shasum -a 256 json.hpp > hashes.txt
|
|
||||||
cd release_files ; shasum -a 256 include.zip >> hashes.txt
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user