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
The check converts the usage of null pointer constants (eg. NULL, 0) to
use the new C++11 nullptr keyword.
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-nullptr -header-filter=.* -fix
* Added setting precision for writers.
* Added special case for precise precision and global precision.
* Added good setting of type of precision and also added this type to BuiltStreamWriter and for its settings.
* Added some tests.
Helper private methods Value::dupPayload() and Value::dupMeta() are added.
Value copy constructor doesn't attempt to delete its data first.
* Value::dupPayload() duplicates a payload.
* Value::dupMeta() duplicates comments and an offset position with a limit.
Value copy constructor shares the same code with Value::copy() and Value::copyPayload().
New Value::releasePayload() is used to free payload memory.
Fixes: #704
* Un-deprecate removeMember overloads, return void
Sometimes we just want to remove something we don't need anymore. Having
to supply a return buffer for the removeMember function to return something
we don't care about is a nuisance. There are removeMember overloads that
don't need a return buffer but they are deprecated. This commit un-deprecates
these overloads and modifies them to return nothing (void) instead of the
object that was removed.
Further discussion: https://github.com/open-source-parsers/jsoncpp/pull/689
WARNING: Changes the return type of the formerly deprecated removeMember
overloads from Value to void. May break existing client code.
* Minor stylistic fixes
Don't explicitly return a void value from a void function. Also, convert
size_t to unsigned in the CZString ctor to avoid a compiler warning.
Without value_type, Boost.Test version 1.65.0 throws a compiler error when a Json::Value object is compared to another with BOOST_TEST. Example and further discussion are in https://github.com/open-source-parsers/jsoncpp/issues/671.
Plus some other build-related changes. I don't think there is anything
functionally different from 1.7.7, or even any binary incompatibilities, but
the cmake change is significant.
Otherwise failures like these one can happen during the configure phase
of other applications that use jsoncpp, like upmpdcli for instance:
checking jsoncpp/json/json.h usability... yes
checking jsoncpp/json/json.h presence... yes
checking for jsoncpp/json/json.h... yes
configure: error: libjsoncpp not found.
And this is the actual problem that you can see in config.log:
configure:5233: checking for jsoncpp/json/json.h
configure:5233: result: yes
configure:5259: /usr/bin/mipsel-linux-g++ -o conftest conftest.cpp
-lmicrohttpd -lmpdclient -lpthread -ljsoncpp >&5
In file included from /usr/include/jsoncpp/json/autolink.h:9:0,
from /usr/include/jsoncpp/json/json.h:9,
from conftest.cpp:26:
/usr/include/jsoncpp/json/config.h:155:9: error: 'int64_t' does not name
a type
typedef int64_t Int64;
^
/usr/include/jsoncpp/json/config.h:156:9: error: 'uint64_t' does not
name a type
typedef uint64_t UInt64;
^
Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>