Commit Graph

1311 Commits

Author SHA1 Message Date
Hans Johnson
31d65711d6 ENH: Remove conditionals for unsupported VS compilers
Visual Studio 12 (2013) with _MSC_VER=1800 is the oldest supported
compiler with sufficient C++11 capabilities

See:
https://blogs.msdn.microsoft.com/vcblog/2013/12/02/c1114-core-language-features-in-vs-2013-and-the-nov-2013-ctp/
for details related to language features supported.
2019-01-14 16:27:52 -06:00
Hans Johnson
2853b1cdac COMP: Use C++11 override directly
The override support in C++11 is required so avoid aliasing
this feature.  Compilers that do not support the override keyword
are no longer supported.
2019-01-14 16:14:12 -06:00
terrycz126
8b31c6f0fd Fix redefined(_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES) warning 2019-01-14 16:13:21 -06:00
Hans Johnson
a3c8e86c0b ENH: Refactor and enhance the CI testing infrastructure
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
2019-01-14 16:12:43 -06:00
Hans Johnson
10a1a38b37 ENH: move travis support scripts to .travis_scripts
Move the build support scripts for travis to a hidden
subdirectory to keep the top level directory more
clean.
2019-01-12 10:35:25 -06:00
Hans Johnson
fa61a49b83 ENH: Use recommended homebrew addon for travis.
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.
2019-01-12 10:35:25 -06:00
Hans Johnson
f8ad1ab352 BUG: Fix bug in CI where failure during homebrew update occured. 2019-01-12 10:35:25 -06:00
Brad King
056850c44b reader: fix signed overflow when parsing negative value
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.
2019-01-11 14:04:41 -06:00
Stefano Fiorentino
009a3ad24c issue_836: Check if `removed' is a valid pointer before copy data to it
functions involved:
	- bool Value::removeMember(const char* key, const char* cend, Value* removed)

Signed-off-by: Stefano Fiorentino <stefano.fiore84@gmail.com>
2019-01-11 11:27:59 -06:00
fangguo
7d16e10113 fiexd “Cannot take the address of a bit field.”
```c++
 #include <iostream>

class TestBool
{
public:
    TestBool():addChildValues_(){}
    TestBool(int):addChildValues_(false){}
    bool addChildValues_ : 1;
    bool indented_ : 1;
};


int main()
{
    std::cout << "\n TestBool () addChildValues_ = " << TestBool().addChildValues_;
    std::cout << "\n TestBool false addChildValues_ = " << TestBool(3).addChildValues_;
    return 0;
}
```

```text
root@osssvr-1 # /opt/SUNWspro/prod/bin/CC  testbool.cpp -o testbool   
Error: Cannot take the address of a bit field.
1 Error(s) detected.
```
2018-12-31 07:39:04 +07:00
Orivej Desh
d8723104f3 Update removeMember docs after #693 2018-12-31 07:37:07 +07:00
Mathias L. Baumann
08ddeed927 JsonValue documentation: Rephrase confusing sentence 2018-12-30 15:33:43 -06:00
Hans Johnson
97e05c41f2 COMP: Provide C++11 feature testing during config
Test compiler feature sets early so that required features
are validated before long compilation process is started.
2018-12-30 15:32:57 -06:00
Hans Johnson
b3b92df879 ENH: Provide range for non-warned cmake versions
Allow configuring without cmake policy developer warnings
for a range of cmake versions.

This prevents the need to explicitly enumerate every new
policy for each new cmake version.

===

Moved setting of the CMAKE_CXX_STANDARD to before the project()
directive.
2018-12-30 15:32:57 -06:00
Hans Johnson
892a386018 ENH: Use cmake builtin versioning capabilities
The project directive in cmake 3.1 has a builtin
mechanism for providing consistent versioning
in a package.
2018-12-30 15:32:57 -06:00
Hans Johnson
0417e626c0 STYLE: Convert CMake-language commands to lower case
Ancient CMake versions required upper-case commands.  Later command names
became case-insensitive.  Now the preferred style is lower-case.
2018-12-30 15:32:57 -06:00
Hans Johnson
2cb1ad5d0c STYLE: Replace integer literals which are cast to bool.
Finds and replaces integer literals which are cast to bool.

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-bool-literals  -header-filter=.* -fix
2018-12-30 15:31:12 -06:00
Kostiantyn Ponomarenko
4bfa962967 Add Meson related info to README
Add information about how one can get a Meson wrap file.

Signed-off-by: Kostiantyn Ponomarenko <konstantin.ponomarenko@gmail.com>
2018-12-30 15:30:35 -06:00
Hans Johnson
e50bfefef1 COMP: Prefer the C++ headers over the C99 headers
Using the C++11 headers keeps the library cleaner and more
rigorously scoped use of namespaces.
2018-12-30 15:29:22 -06:00
Hans Johnson
5c8e539af4 ENH: MSVS 2013 snprintf compatible substitute
Simplify the backwards compatible snprintf configuration for pre
1900 version of MSVC.  Otherwise prefer C++11 syntax using std::snprintf.
2018-12-30 15:29:22 -06:00
Radoslav Atanasov
ccd077ffce Fix MSVC 15.9 (2017) warning C4866
by changing operator[] param type from JSONCPP_STRING to const JSONCPP_STRING& for CharReaderBuilder and StreamWriterBuilder (as it is already in Value).

https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/c4866?view=vs-2017
2018-12-30 15:28:09 -06:00
Hans Johnson
4abf4ec208 PERF: Replace explicit return calls of constructor
Replaces explicit calls to the constructor in a return with a braced
initializer list. This way the return type is not needlessly duplicated in the
function definition and the return statement.

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-return-braced-init-list  -header-filter=.* -fix
2018-12-30 15:26:29 -06:00
Christopher Dunn
9026a16ff5
Merge pull request #849 from hjmjohnson/modernize-use-nullptr
COMP: Use nullptr instead of 0 or NULL
2018-12-30 15:23:22 -06:00
Hans Johnson
f64244ed3f COMP: Use nullptr instead of 0 or NULL
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
2018-12-12 13:41:06 -06:00
Christopher Dunn
6219eae304
Merge pull request #843 from manang/master
Update json_writer.cpp
2018-12-03 20:20:55 -08:00
manang
b955e0f699
Update json_writer.cpp 2018-12-03 10:26:27 +01:00
Julien Schueller
d501fbe741 Set CMAKE_BUILD_TYPE default on win32 too 2018-12-02 18:37:11 -06:00
Julien Schueller
ec4251b728 Use CMAKE_CROSSCOMPILING_EMULATOR to run tests
Needed when cross-compiling
2018-12-02 18:37:11 -06:00
Julien Schueller
a72266d00b Remove useless BUILD_STATIC_LIBS option 2018-12-02 18:37:11 -06:00
Julien Schueller
010a2d04d3 Unique lib target name 2018-12-02 18:37:11 -06:00
Christopher Dunn
2baad4923e
Merge pull request #804 from yantaozhao/master
allow nullptr when not care the removed array value
2018-07-14 22:11:35 -05:00
YantaoZhao
e32ee4717c allow nullptr when not care the removed array value 2018-07-03 21:29:18 +08:00
Christopher Dunn
80bc776bae
Merge pull request #250 from cdunn2001/travis
in travis, build for osx also
2018-06-24 20:42:46 -05:00
Christopher Dunn
da498591fc In travis-ci, build for osx also
Drop gcc b/c it takes too long to install via addon.

Build only static/release, to save VMs. (No shared to debug.)
2018-06-24 20:35:49 -05:00
pavel.pimenov
745287275c "\n" -> '\n' 2018-06-24 18:51:10 -05:00
Christopher Dunn
c00a3b95c2
Merge pull request #800 from cdunn2001/patch-1
Fixes #798
Closes #799
2018-06-23 18:17:08 -05:00
Christopher Dunn
c59db80002 Try the way I build locally 2018-06-23 18:08:53 -05:00
Christopher Dunn
473afca1e3 Tell meson/ninja versions 2018-06-23 18:08:53 -05:00
Christopher Dunn
59d41de5b1 Try to avoid empty string
- g++ has a problem with ''
- clang++ does not seem to mind it.
2018-06-23 18:08:53 -05:00
Peter Spiess-Knafl
b87f6dbc8a Fix for #798
Add preprocessor definitions for MSVC dllexport/dllimport statements

(cherry picked from commit 2654b6bbbf)
2018-06-23 16:11:47 -05:00
Kamel CHAOUCHE
ee34ac1fbb Add position independent code feature to CMakeList.txt
Enable Position Independent Code for shared lib
2018-06-22 11:37:18 -05:00
Christopher Dunn
d31a5300e1
Merge pull request #788 from pavel-pimenov/fix-782
Fix #782
2018-06-22 10:29:52 -05:00
pavel.pimenov
86789e7c2f Fix #782 2018-06-05 10:17:36 +03:00
Christopher Dunn
c4103ab390
Merge pull request #784 from Nekto89/cppcheck_fix
Multiple fixes for issues found by Cppcheck
2018-06-03 13:28:53 -05:00
Marian Klymov
a5d7c714b1 Fix typo in previous fix. 2018-06-02 21:52:45 +03:00
Marian Klymov
84ca7d6f0b Apply the formatting specified in .clang-format file. 2018-06-02 20:27:31 +03:00
Marian Klymov
fc20134c92 Fix different names for parameters in declaration and definition 2018-06-02 20:15:26 +03:00
Marian Klymov
091e03979d Reduce scope of variable. 2018-06-02 19:48:10 +03:00
Marian Klymov
a7d0ffc717 Remove unused private function in TestResult class 2018-06-02 19:46:16 +03:00
Marian Klymov
48112c8b62 Make several methods static. 2018-06-02 19:43:31 +03:00