clang-cl defines _MSC_VER by default, so JSONCPP_DEPRECATED was first
defined for MSVC and then redefined for clang. Integrate the MSVC
definition into the block with clang and GCC's JSONCPP_DEPRECATED
definitions to fix this.
Older versions of cmake, according to documentation:
https://cmake.org/cmake/help/v3.5/command/if.html , do not know
VERSION_LESS_EQUAL, just VERSION_LESS.
This leads to errors:
CMake Error at somewhere/jsoncpp/CMakeLists.txt:18 (if):
if given arguments:
"3.5.1" "VERSION_LESS_EQUAL" "3.13.1"
Unknown arguments specified
Resolves: #866
This check replaces undefined special member functions with
= delete;. The explicitly deleted function declarations enable more
opportunities in optimization, because the compiler might treat
explicitly delted functions as noops.
Additionally, the C++11 use of = delete more clearly expreses the
intent for the special member functions.
SRCDIR=/Users/johnsonhj/src/jsoncpp/ #My local SRC
BLDDIR=/Users/johnsonhj/src/jsoncpp/cmake-build-debug/ #My local BLD
cd /Users/johnsonhj/src/jsoncpp/cmake-build-debug/
run-clang-tidy.py -extra-arg=-D__clang__ -checks=-*,modernize-use-equals-delete -header-filter=.* -fix
This check replaces default bodies of special member functions with
= default;. The explicitly defaulted function declarations enable more
opportunities in optimization, because the compiler might treat
explicitly defaulted functions as trivial.
Additionally, the C++11 use of = default more clearly expreses the
intent for the special member functions.
SRCDIR=/Users/johnsonhj/src/jsoncpp/ #My local SRC
BLDDIR=/Users/johnsonhj/src/jsoncpp/cmake-build-debug/ #My local BLD
cd /Users/johnsonhj/src/jsoncpp/cmake-build-debug/
run-clang-tidy.py -extra-arg=-D__clang__ -checks=-*,modernize-use-equals-default -header-filter=.* -fix
Converts a default constructor’s member initializers into the new
default member initializers in C++11. Other member initializers that match the
default member initializer are removed. This can reduce repeated code or allow
use of ‘= default’.
SRCDIR=/Users/johnsonhj/src/jsoncpp/ #My local SRC
BLDDIR=/Users/johnsonhj/src/jsoncpp/cmake-build-debug/ #My local BLD
cd /Users/johnsonhj/src/jsoncpp/cmake-build-debug/
run-clang-tidy.py -extra-arg=-D__clang__ -checks=-*,modernize-use-default-member-init -header-filter=.* -fix
With move semantics added to the language and the standard library updated with
move constructors added for many types it is now interesting to take an
argument directly by value, instead of by const-reference, and then copy. This
check allows the compiler to take care of choosing the best way to construct
the copy.
The transformation is usually beneficial when the calling code passes an rvalue
and assumes the move construction is a cheap operation. This short example
illustrates how the construction of the value happens:
SRCDIR=/Users/johnsonhj/src/jsoncpp/ #My local SRC
BLDDIR=/Users/johnsonhj/src/jsoncpp/cmake-build-debug/ #My local BLD
cd /Users/johnsonhj/src/jsoncpp/cmake-build-debug/
run-clang-tidy.py -extra-arg=-D__clang__ -checks=-*,modernize-pass-by-value -header-filter=.* -fix
This check is responsible for using the auto type specifier for variable
declarations to improve code readability and maintainability.
The auto type specifier will only be introduced in situations where the
variable type matches the type of the initializer expression. In other words
auto should deduce the same type that was originally spelled in the source
SRCDIR=/Users/johnsonhj/src/jsoncpp/ #My local SRC
BLDDIR=/Users/johnsonhj/src/jsoncpp/cmake-build-debug/ #My local BLD
cd /Users/johnsonhj/src/jsoncpp/cmake-build-debug/
run-clang-tidy.py -extra-arg=-D__clang__ -checks=-*,modernize-use-auto -header-filter = .* -fix
C++11 Range based for loops can be used in
Used as a more readable equivalent to the traditional for loop operating over a
range of values, such as all elements in a container, in the forward direction..
Range based loopes are more explicit for only computing the
end location once for containers.
SRCDIR=/Users/johnsonhj/src/jsoncpp/ #My local SRC
BLDDIR=/Users/johnsonhj/src/jsoncpp/cmake-build-debug/ #My local BLD
cd /Users/johnsonhj/src/jsoncpp/cmake-build-debug/
run-clang-tidy.py -extra-arg=-D__clang__ -checks=-*,modernize-loop-convert -header-filter=.* -fix
The emptiness of a container should be checked using the empty() method
instead of the size() method. It is not guaranteed that size() is a
constant-time function, and it is generally more efficient and also
shows clearer intent to use empty(). Furthermore some containers may
implement the empty() method but not implement the size() method. Using
empty() whenever possible makes it easier to switch to another container
in the future.
SRCDIR=/Users/johnsonhj/src/jsoncpp/ #My local SRC
BLDDIR=/Users/johnsonhj/src/jsoncpp/cmake-build-debug/ #My local BLD
cd /Users/johnsonhj/src/jsoncpp/cmake-build-debug/
run-clang-tidy.py -extra-arg=-D__clang__ -checks=-*,readability-container-size-empty -header-filter=.* -fix
1) Improve travis build script for use outside travis.
Allow the script used for CI builds to also be used
locally in a similar manner to the CI use of the scrips
2) Add ctest compatible testing and CDASH support
Report testing and building results to
https://my.cdash.org/index.php?project=jsoncpp
NOTE: The new ctest infrastructure is not yet robust on winodws
Do no yet enable the new features for running test with ctest
on windows platform. The previous behaviors are maintainted,
but enhance test reporting from windows is not yet supported.
3) Add a cmake coverage testing option
Ensure that cmake builds on linux are tested.
Ensure that code coverage is reported.
4) Move conditional environment checking into the matrix
Avoid multiple places where conditional logic is used to
change compiler behavior. As more test environments are
created fromt the travis.yml matrix, all settings should be
obvious from that one location.
5) Tests with known regressions from the jsonchecker are suppressed
Tests that are known to pass with jsoncpp more lenient
syntax enforcement are exluded from tests in test/runjsontests.py
Remove unnecessary python3 environment from osx that
made configuring the test environment slower.
Use "addon:" features for installing homebrew
packages more efficiently.
Re-organized the .travis.yml file in a standard
order so that the "before-install" and "install"
steps occur after the configurations of addons and
matrix, and language features are set.
Clang's ubsan (-fsanitize=undefined) reports:
runtime error: negation of -9223372036854775808 cannot be represented in
type 'Json::Value::LargestInt' (aka 'long'); cast to an unsigned type to
negate this value to itself
Follow its advice and update the code to remove the explicit negation.