From b508d1f1c4b1b282cf56d7880a31519fce82268b Mon Sep 17 00:00:00 2001 From: Niels Date: Mon, 6 Jun 2016 18:50:39 +0200 Subject: [PATCH 01/38] fix proposal for #260 --- src/json.hpp | 4 ++-- src/json.hpp.re2c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/json.hpp b/src/json.hpp index 43646763..a8902bdb 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -8497,13 +8497,13 @@ basic_json_parser_63: if (*curptr == '-') { type = value_t::number_integer; - max = static_cast(std::numeric_limits::max()) + 1; + max = static_cast((std::numeric_limits::max)()) + 1; curptr++; } else { type = value_t::number_unsigned; - max = static_cast(std::numeric_limits::max()); + max = static_cast((std::numeric_limits::max())); } // count the significant figures diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index ba4fc007..9fe8ca68 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -7807,13 +7807,13 @@ class basic_json if (*curptr == '-') { type = value_t::number_integer; - max = static_cast(std::numeric_limits::max()) + 1; + max = static_cast((std::numeric_limits::max)()) + 1; curptr++; } else { type = value_t::number_unsigned; - max = static_cast(std::numeric_limits::max()); + max = static_cast((std::numeric_limits::max())); } // count the significant figures From 9e2dfd19e8429356b9941d61afc03d7d4ab2cb28 Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 7 Jun 2016 00:20:53 +0200 Subject: [PATCH 02/38] minor cleanup --- src/json.hpp | 17 +++++++++-------- src/json.hpp.re2c | 17 +++++++++-------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/json.hpp b/src/json.hpp index 43646763..9312c4f4 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -1461,13 +1461,13 @@ class basic_json @since version 2.0.0 */ - template < typename CompatibleNumberUnsignedType, typename - std::enable_if < - std::is_constructible::value and - std::numeric_limits::is_integer and - !std::numeric_limits::is_signed, - CompatibleNumberUnsignedType >::type - = 0 > + template ::value and + std::numeric_limits::is_integer and + not std::numeric_limits::is_signed, + CompatibleNumberUnsignedType>::type + = 0> basic_json(const CompatibleNumberUnsignedType val) noexcept : m_type(value_t::number_unsigned), m_value(static_cast(val)) @@ -5079,6 +5079,7 @@ class basic_json throw std::domain_error("iterator does not fit current value"); } + // check if range iterators belong to the same JSON object if (first.m_object != last.m_object) { throw std::domain_error("iterators do not fit"); @@ -7332,7 +7333,7 @@ class basic_json @return string representation of the code point - @throw std::out_of_range if code point is >0x10ffff; example: `"code + @throw std::out_of_range if code point is > 0x10ffff; example: `"code points above 0x10FFFF are invalid"` @throw std::invalid_argument if the low surrogate is invalid; example: `""missing or wrong low surrogate""` diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index ba4fc007..2ab300ec 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -1461,13 +1461,13 @@ class basic_json @since version 2.0.0 */ - template < typename CompatibleNumberUnsignedType, typename - std::enable_if < - std::is_constructible::value and - std::numeric_limits::is_integer and - !std::numeric_limits::is_signed, - CompatibleNumberUnsignedType >::type - = 0 > + template ::value and + std::numeric_limits::is_integer and + not std::numeric_limits::is_signed, + CompatibleNumberUnsignedType>::type + = 0> basic_json(const CompatibleNumberUnsignedType val) noexcept : m_type(value_t::number_unsigned), m_value(static_cast(val)) @@ -5079,6 +5079,7 @@ class basic_json throw std::domain_error("iterator does not fit current value"); } + // check if range iterators belong to the same JSON object if (first.m_object != last.m_object) { throw std::domain_error("iterators do not fit"); @@ -7332,7 +7333,7 @@ class basic_json @return string representation of the code point - @throw std::out_of_range if code point is >0x10ffff; example: `"code + @throw std::out_of_range if code point is > 0x10ffff; example: `"code points above 0x10FFFF are invalid"` @throw std::invalid_argument if the low surrogate is invalid; example: `""missing or wrong low surrogate""` From 744bae7fc4eac70d01f83bdcd055880234b8ad37 Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 7 Jun 2016 07:00:31 +0200 Subject: [PATCH 03/38] trying to fix Travis --- .travis.yml | 65 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 27 deletions(-) diff --git a/.travis.yml b/.travis.yml index 249a8757..ccba5fd1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,6 +44,17 @@ matrix: branch_pattern: coverity_scan env: COMPILER=g++-5 + # from https://github.com/travis-ci/travis-ci/issues/6120 + - os: linux + before_install: + - LLVM_VERSION=3.7.0 + - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz + - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH + - mkdir $HOME/clang+llvm + - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang+llvm --strip-components 1 + - export PATH=$HOME/clang+llvm/bin:$PATH + env: COMPILER=clang++ + # - os: linux # compiler: gcc # addons: @@ -55,29 +66,29 @@ matrix: # Clang 3.5 is not able to compile the code, # see https://travis-ci.org/nlohmann/json/jobs/126720186 - - os: linux - compiler: clang - addons: - apt: - sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.6'] - packages: ['clang-3.6', 'valgrind'] - env: COMPILER=clang++-3.6 - - - os: linux - compiler: clang - addons: - apt: - sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.7'] - packages: ['clang-3.7', 'valgrind'] - env: COMPILER=clang++-3.7 - - - os: linux - compiler: clang - addons: - apt: - sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.8'] - packages: ['clang-3.8', 'valgrind'] - env: COMPILER=clang++-3.8 +# - os: linux +# compiler: clang +# addons: +# apt: +# sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.6'] +# packages: ['clang-3.6', 'valgrind'] +# env: COMPILER=clang++-3.6 +# +# - os: linux +# compiler: clang +# addons: +# apt: +# sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.7'] +# packages: ['clang-3.7', 'valgrind'] +# env: COMPILER=clang++-3.7 +# +# - os: linux +# compiler: clang +# addons: +# apt: +# sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.8'] +# packages: ['clang-3.8', 'valgrind'] +# env: COMPILER=clang++-3.8 # - os: linux # compiler: clang @@ -97,10 +108,10 @@ matrix: compiler: clang env: COMPILER=clang - # - os: osx - # osx_image: beta-xcode6.3 - # compiler: clang - # env: COMPILER=clang + - os: osx + osx_image: beta-xcode6.3 + compiler: clang + env: COMPILER=clang - os: osx osx_image: xcode6.4 From 5173c1622282abef3c0aaccf6d52b72a3398e5b5 Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 7 Jun 2016 07:07:42 +0200 Subject: [PATCH 04/38] another try --- .travis.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index ccba5fd1..007d6bb0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,10 +50,18 @@ matrix: - LLVM_VERSION=3.7.0 - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH - - mkdir $HOME/clang+llvm - - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang+llvm --strip-components 1 - - export PATH=$HOME/clang+llvm/bin:$PATH - env: COMPILER=clang++ + - mkdir $HOME/clang-$LLVM_VERSION + - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 + env: COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ + + - os: linux + before_install: + - LLVM_VERSION=3.8.0 + - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz + - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH + - mkdir $HOME/clang-$LLVM_VERSION + - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 + env: COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ # - os: linux # compiler: gcc From e772f06f0d391782f8c1dbf27f1f2e839fa99220 Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 7 Jun 2016 07:14:54 +0200 Subject: [PATCH 05/38] another try --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 007d6bb0..f577ce8c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,8 +47,8 @@ matrix: # from https://github.com/travis-ci/travis-ci/issues/6120 - os: linux before_install: - - LLVM_VERSION=3.7.0 - - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz + - export LLVM_VERSION=3.7.0 + - export LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH - mkdir $HOME/clang-$LLVM_VERSION - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 @@ -56,8 +56,8 @@ matrix: - os: linux before_install: - - LLVM_VERSION=3.8.0 - - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz + - export LLVM_VERSION=3.8.0 + - export LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH - mkdir $HOME/clang-$LLVM_VERSION - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 From f4ae8f8e2e9ceeab02b8be6549f1bca51b28eb87 Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 7 Jun 2016 07:21:17 +0200 Subject: [PATCH 06/38] another try --- .travis.yml | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index f577ce8c..29fc4459 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,22 +46,14 @@ matrix: # from https://github.com/travis-ci/travis-ci/issues/6120 - os: linux + env: + - LLVM_VERSION=3.7.0 + - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz + - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ before_install: - - export LLVM_VERSION=3.7.0 - - export LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH - mkdir $HOME/clang-$LLVM_VERSION - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 - env: COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ - - - os: linux - before_install: - - export LLVM_VERSION=3.8.0 - - export LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz - - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH - - mkdir $HOME/clang-$LLVM_VERSION - - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 - env: COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ # - os: linux # compiler: gcc From 32f6682177e31fa7b25d21615c44cde219ae3ba3 Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 7 Jun 2016 07:25:11 +0200 Subject: [PATCH 07/38] another try --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 29fc4459..8fe3cf6d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,7 +47,7 @@ matrix: # from https://github.com/travis-ci/travis-ci/issues/6120 - os: linux env: - - LLVM_VERSION=3.7.0 + - LLVM_VERSION=3.8.0 - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ before_install: From dfc39b95ab9becac9385c1569ce1c05bd6a2d723 Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 7 Jun 2016 07:54:00 +0200 Subject: [PATCH 08/38] clang does not work with travis right now --- .travis.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8fe3cf6d..7f2dd9b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,16 +44,16 @@ matrix: branch_pattern: coverity_scan env: COMPILER=g++-5 - # from https://github.com/travis-ci/travis-ci/issues/6120 - - os: linux - env: - - LLVM_VERSION=3.8.0 - - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz - - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ - before_install: - - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH - - mkdir $HOME/clang-$LLVM_VERSION - - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 +# # from https://github.com/travis-ci/travis-ci/issues/6120 +# - os: linux +# env: +# - LLVM_VERSION=3.8.0 +# - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz +# - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ +# before_install: +# - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH +# - mkdir $HOME/clang-$LLVM_VERSION +# - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 # - os: linux # compiler: gcc From 1826d12a22e14f6ce00c1218685011eea982c83e Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 7 Jun 2016 08:28:50 +0200 Subject: [PATCH 09/38] added CPATH --- .travis.yml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7f2dd9b6..3bfe5eaa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,16 +44,17 @@ matrix: branch_pattern: coverity_scan env: COMPILER=g++-5 -# # from https://github.com/travis-ci/travis-ci/issues/6120 -# - os: linux -# env: -# - LLVM_VERSION=3.8.0 -# - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz -# - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ -# before_install: -# - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH -# - mkdir $HOME/clang-$LLVM_VERSION -# - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 + # from https://github.com/travis-ci/travis-ci/issues/6120 + - os: linux + env: + - LLVM_VERSION=3.8.0 + - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz + - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ + - CPATH=$HOME/clang-$LLVM_VERSION/include + before_install: + - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH + - mkdir $HOME/clang-$LLVM_VERSION + - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 # - os: linux # compiler: gcc From 761880f5b746f3d7040dd8b0da3e9121d573fc14 Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 7 Jun 2016 08:32:56 +0200 Subject: [PATCH 10/38] CPATH does not work... --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3bfe5eaa..26517d5c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,8 +49,7 @@ matrix: env: - LLVM_VERSION=3.8.0 - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz - - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ - - CPATH=$HOME/clang-$LLVM_VERSION/include + - COMPILER="$HOME/clang-$LLVM_VERSION/bin/clang++ -I$HOME/clang-$LLVM_VERSION/include" before_install: - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH - mkdir $HOME/clang-$LLVM_VERSION From dd542aae7d1e157a49de0748d8347756890e3b88 Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 7 Jun 2016 08:40:25 +0200 Subject: [PATCH 11/38] another try --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 26517d5c..76eeafba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,7 +49,8 @@ matrix: env: - LLVM_VERSION=3.8.0 - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz - - COMPILER="$HOME/clang-$LLVM_VERSION/bin/clang++ -I$HOME/clang-$LLVM_VERSION/include" + - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ + - CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include" before_install: - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH - mkdir $HOME/clang-$LLVM_VERSION From dd10c89a3e8e0de8e995dc923e764ee5a6f6d2f4 Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 7 Jun 2016 08:53:36 +0200 Subject: [PATCH 12/38] another try --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 76eeafba..ce29a41b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,7 +50,7 @@ matrix: - LLVM_VERSION=3.8.0 - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ - - CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include" + - CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include/c++/v1" before_install: - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH - mkdir $HOME/clang-$LLVM_VERSION From fbbdcb19bce6eadd0a675b560fdcb7dc4080eafc Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 7 Jun 2016 09:01:49 +0200 Subject: [PATCH 13/38] another try --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ce29a41b..9871b7d4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -137,7 +137,7 @@ matrix: script: - uname -a - $COMPILER --version - - make CXX=$COMPILER CXXFLAGS="-lstdc++" + - make CXX=$COMPILER - ./json_unit "*" - if [ `which valgrind` ]; then valgrind --error-exitcode=1 --leak-check=full ./json_unit ; From 32cc6fefcc1c377d3a215f0c595f1f621e100070 Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 7 Jun 2016 09:12:53 +0200 Subject: [PATCH 14/38] another try --- .travis.yml | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9871b7d4..76054da8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,6 +51,7 @@ matrix: - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ - CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include/c++/v1" + - CXXFLAGS=-lc++ before_install: - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH - mkdir $HOME/clang-$LLVM_VERSION @@ -102,37 +103,51 @@ matrix: - os: osx osx_image: beta-xcode6.1 compiler: clang - env: COMPILER=clang + env: + - COMPILER=clang + - CXXFLAGS=-lstdc++ - os: osx osx_image: beta-xcode6.2 compiler: clang - env: COMPILER=clang + env: + - COMPILER=clang + - CXXFLAGS=-lstdc++ - os: osx osx_image: beta-xcode6.3 compiler: clang - env: COMPILER=clang + env: + - COMPILER=clang + - CXXFLAGS=-lstdc++ - os: osx osx_image: xcode6.4 compiler: clang - env: COMPILER=clang + env: + - COMPILER=clang + - CXXFLAGS=-lstdc++ - os: osx osx_image: xcode7.1 compiler: clang - env: COMPILER=clang + env: + - COMPILER=clang + - CXXFLAGS=-lstdc++ - os: osx osx_image: xcode7.2 compiler: clang - env: COMPILER=clang + env: + - COMPILER=clang + - CXXFLAGS=-lstdc++ - os: osx osx_image: xcode7.3 compiler: clang - env: COMPILER=clang + env: + - COMPILER=clang + - CXXFLAGS=-lstdc++ script: - uname -a From f63317dce34ae34a9a26809ae277f867ac6b4348 Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 7 Jun 2016 09:34:46 +0200 Subject: [PATCH 15/38] another try --- .travis.yml | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 76054da8..205606be 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,10 +23,10 @@ matrix: after_success: - make clean - touch src/json.hpp - - make json_unit CXXFLAGS="-fprofile-arcs -ftest-coverage -std=c++11 -lstdc++" CXX=$COMPILER + - make json_unit CXXFLAGS="-fprofile-arcs -ftest-coverage -std=c++11 -lstdc++" - ./json_unit "*" - coveralls --exclude test/src/catch.hpp --exclude test/src/unit.cpp --include src/json.hpp --gcov-options '\-lp' --gcov 'gcov-4.9' - env: COMPILER=g++-4.9 + env: CXX=g++-4.9 - os: linux compiler: gcc @@ -42,16 +42,15 @@ matrix: build_command_prepend: "make clean ; sudo cp $(which g++-5) $(which g++)" build_command: "make" branch_pattern: coverity_scan - env: COMPILER=g++-5 + env: CXX=g++-5 # from https://github.com/travis-ci/travis-ci/issues/6120 - os: linux env: - LLVM_VERSION=3.8.0 - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz - - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ + - CXX=$HOME/clang-$LLVM_VERSION/bin/clang++ - CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include/c++/v1" - - CXXFLAGS=-lc++ before_install: - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH - mkdir $HOME/clang-$LLVM_VERSION @@ -104,55 +103,55 @@ matrix: osx_image: beta-xcode6.1 compiler: clang env: - - COMPILER=clang + - CXX=clang - CXXFLAGS=-lstdc++ - os: osx osx_image: beta-xcode6.2 compiler: clang env: - - COMPILER=clang + - CXX=clang - CXXFLAGS=-lstdc++ - os: osx osx_image: beta-xcode6.3 compiler: clang env: - - COMPILER=clang + - CXX=clang - CXXFLAGS=-lstdc++ - os: osx osx_image: xcode6.4 compiler: clang env: - - COMPILER=clang + - CXX=clang - CXXFLAGS=-lstdc++ - os: osx osx_image: xcode7.1 compiler: clang env: - - COMPILER=clang + - CXX=clang - CXXFLAGS=-lstdc++ - os: osx osx_image: xcode7.2 compiler: clang env: - - COMPILER=clang + - CXX=clang - CXXFLAGS=-lstdc++ - os: osx osx_image: xcode7.3 compiler: clang env: - - COMPILER=clang + - CXX=clang - CXXFLAGS=-lstdc++ script: - uname -a - - $COMPILER --version - - make CXX=$COMPILER + - $CXX --version + - make - ./json_unit "*" - if [ `which valgrind` ]; then valgrind --error-exitcode=1 --leak-check=full ./json_unit ; From 6d19bd1108551b1b4c41cb9e83e6b7f025cc5c7f Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 7 Jun 2016 09:49:11 +0200 Subject: [PATCH 16/38] Revert "another try" This reverts commit f63317dce34ae34a9a26809ae277f867ac6b4348. --- .travis.yml | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 205606be..76054da8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,10 +23,10 @@ matrix: after_success: - make clean - touch src/json.hpp - - make json_unit CXXFLAGS="-fprofile-arcs -ftest-coverage -std=c++11 -lstdc++" + - make json_unit CXXFLAGS="-fprofile-arcs -ftest-coverage -std=c++11 -lstdc++" CXX=$COMPILER - ./json_unit "*" - coveralls --exclude test/src/catch.hpp --exclude test/src/unit.cpp --include src/json.hpp --gcov-options '\-lp' --gcov 'gcov-4.9' - env: CXX=g++-4.9 + env: COMPILER=g++-4.9 - os: linux compiler: gcc @@ -42,15 +42,16 @@ matrix: build_command_prepend: "make clean ; sudo cp $(which g++-5) $(which g++)" build_command: "make" branch_pattern: coverity_scan - env: CXX=g++-5 + env: COMPILER=g++-5 # from https://github.com/travis-ci/travis-ci/issues/6120 - os: linux env: - LLVM_VERSION=3.8.0 - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz - - CXX=$HOME/clang-$LLVM_VERSION/bin/clang++ + - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ - CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include/c++/v1" + - CXXFLAGS=-lc++ before_install: - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH - mkdir $HOME/clang-$LLVM_VERSION @@ -103,55 +104,55 @@ matrix: osx_image: beta-xcode6.1 compiler: clang env: - - CXX=clang + - COMPILER=clang - CXXFLAGS=-lstdc++ - os: osx osx_image: beta-xcode6.2 compiler: clang env: - - CXX=clang + - COMPILER=clang - CXXFLAGS=-lstdc++ - os: osx osx_image: beta-xcode6.3 compiler: clang env: - - CXX=clang + - COMPILER=clang - CXXFLAGS=-lstdc++ - os: osx osx_image: xcode6.4 compiler: clang env: - - CXX=clang + - COMPILER=clang - CXXFLAGS=-lstdc++ - os: osx osx_image: xcode7.1 compiler: clang env: - - CXX=clang + - COMPILER=clang - CXXFLAGS=-lstdc++ - os: osx osx_image: xcode7.2 compiler: clang env: - - CXX=clang + - COMPILER=clang - CXXFLAGS=-lstdc++ - os: osx osx_image: xcode7.3 compiler: clang env: - - CXX=clang + - COMPILER=clang - CXXFLAGS=-lstdc++ script: - uname -a - - $CXX --version - - make + - $COMPILER --version + - make CXX=$COMPILER - ./json_unit "*" - if [ `which valgrind` ]; then valgrind --error-exitcode=1 --leak-check=full ./json_unit ; From a97c998791fe9242763ad242585cc5050410f775 Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 7 Jun 2016 09:50:43 +0200 Subject: [PATCH 17/38] removed -lc++ --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 76054da8..ed5b5197 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,7 +51,6 @@ matrix: - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ - CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include/c++/v1" - - CXXFLAGS=-lc++ before_install: - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH - mkdir $HOME/clang-$LLVM_VERSION From 1f04c0349a85198c931c5279c9c313d2a62c2da0 Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 7 Jun 2016 10:03:18 +0200 Subject: [PATCH 18/38] readded -lc++ --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index ed5b5197..76054da8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,6 +51,7 @@ matrix: - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ - CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include/c++/v1" + - CXXFLAGS=-lc++ before_install: - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH - mkdir $HOME/clang-$LLVM_VERSION From cc5cad5b0beabde812ec30ad99132f63b7002d5b Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 7 Jun 2016 10:53:18 +0200 Subject: [PATCH 19/38] another try --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 76054da8..b9fc2766 100644 --- a/.travis.yml +++ b/.travis.yml @@ -52,6 +52,7 @@ matrix: - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ - CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include/c++/v1" - CXXFLAGS=-lc++ + - LD_LIBRARY_PATH=$HOME/clang-$LLVM_VERSION/lib:$LD_LIBRARY_PATH before_install: - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH - mkdir $HOME/clang-$LLVM_VERSION From 31b24dd5c1f8dad25456218add4db080dc904142 Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 7 Jun 2016 11:02:45 +0200 Subject: [PATCH 20/38] adding more Clang versions --- .travis.yml | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/.travis.yml b/.travis.yml index b9fc2766..82814290 100644 --- a/.travis.yml +++ b/.travis.yml @@ -58,6 +58,110 @@ matrix: - mkdir $HOME/clang-$LLVM_VERSION - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 + - os: linux + env: + - LLVM_VERSION=3.7.1 + - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz + - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ + - CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include/c++/v1" + - CXXFLAGS=-lc++ + - LD_LIBRARY_PATH=$HOME/clang-$LLVM_VERSION/lib:$LD_LIBRARY_PATH + before_install: + - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH + - mkdir $HOME/clang-$LLVM_VERSION + - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 + + - os: linux + env: + - LLVM_VERSION=3.7.0 + - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz + - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ + - CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include/c++/v1" + - CXXFLAGS=-lc++ + - LD_LIBRARY_PATH=$HOME/clang-$LLVM_VERSION/lib:$LD_LIBRARY_PATH + before_install: + - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH + - mkdir $HOME/clang-$LLVM_VERSION + - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 + + - os: linux + env: + - LLVM_VERSION=3.6.2 + - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz + - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ + - CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include/c++/v1" + - CXXFLAGS=-lc++ + - LD_LIBRARY_PATH=$HOME/clang-$LLVM_VERSION/lib:$LD_LIBRARY_PATH + before_install: + - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH + - mkdir $HOME/clang-$LLVM_VERSION + - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 + + - os: linux + env: + - LLVM_VERSION=3.6.1 + - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz + - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ + - CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include/c++/v1" + - CXXFLAGS=-lc++ + - LD_LIBRARY_PATH=$HOME/clang-$LLVM_VERSION/lib:$LD_LIBRARY_PATH + before_install: + - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH + - mkdir $HOME/clang-$LLVM_VERSION + - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 + + - os: linux + env: + - LLVM_VERSION=3.6.0 + - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz + - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ + - CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include/c++/v1" + - CXXFLAGS=-lc++ + - LD_LIBRARY_PATH=$HOME/clang-$LLVM_VERSION/lib:$LD_LIBRARY_PATH + before_install: + - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH + - mkdir $HOME/clang-$LLVM_VERSION + - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 + + - os: linux + env: + - LLVM_VERSION=3.5.2 + - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz + - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ + - CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include/c++/v1" + - CXXFLAGS=-lc++ + - LD_LIBRARY_PATH=$HOME/clang-$LLVM_VERSION/lib:$LD_LIBRARY_PATH + before_install: + - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH + - mkdir $HOME/clang-$LLVM_VERSION + - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 + + - os: linux + env: + - LLVM_VERSION=3.5.1 + - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz + - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ + - CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include/c++/v1" + - CXXFLAGS=-lc++ + - LD_LIBRARY_PATH=$HOME/clang-$LLVM_VERSION/lib:$LD_LIBRARY_PATH + before_install: + - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH + - mkdir $HOME/clang-$LLVM_VERSION + - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 + + - os: linux + env: + - LLVM_VERSION=3.5.0 + - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz + - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ + - CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include/c++/v1" + - CXXFLAGS=-lc++ + - LD_LIBRARY_PATH=$HOME/clang-$LLVM_VERSION/lib:$LD_LIBRARY_PATH + before_install: + - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH + - mkdir $HOME/clang-$LLVM_VERSION + - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 + # - os: linux # compiler: gcc # addons: From ff8f196ca323e4624a27ec61bbd1a01fecec719c Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 7 Jun 2016 11:13:15 +0200 Subject: [PATCH 21/38] a test --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 82814290..7d2837f4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -155,8 +155,6 @@ matrix: - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ - CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include/c++/v1" - - CXXFLAGS=-lc++ - - LD_LIBRARY_PATH=$HOME/clang-$LLVM_VERSION/lib:$LD_LIBRARY_PATH before_install: - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH - mkdir $HOME/clang-$LLVM_VERSION From a4058b88ecc9d6a8aaff4374031514d40673364a Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 7 Jun 2016 11:14:02 +0200 Subject: [PATCH 22/38] another test --- .travis.yml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7d2837f4..7f0f6ed7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -136,19 +136,6 @@ matrix: - mkdir $HOME/clang-$LLVM_VERSION - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 - - os: linux - env: - - LLVM_VERSION=3.5.1 - - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz - - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ - - CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include/c++/v1" - - CXXFLAGS=-lc++ - - LD_LIBRARY_PATH=$HOME/clang-$LLVM_VERSION/lib:$LD_LIBRARY_PATH - before_install: - - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH - - mkdir $HOME/clang-$LLVM_VERSION - - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 - - os: linux env: - LLVM_VERSION=3.5.0 From c425dc9e04f9a0ad08eb5c2e38abf537ff026bcc Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 7 Jun 2016 11:25:00 +0200 Subject: [PATCH 23/38] trying to install clang --- .travis.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.travis.yml b/.travis.yml index 7f0f6ed7..71d69037 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,6 +45,18 @@ matrix: env: COMPILER=g++-5 # from https://github.com/travis-ci/travis-ci/issues/6120 + - os: linux + env: + - LLVM_VERSION=3.8.0 + - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz + - COMPILER=clang++ + - CXXFLAGS=-lc++ + before_install: + - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH + - mkdir $HOME/clang-$LLVM_VERSION + - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 + - cd $HOME/clang-$LLVM_VERSION ; sudo cp -R * /usr/local/ + - os: linux env: - LLVM_VERSION=3.8.0 From 62f39c41ecaf5e90e891a772d3e4b40b1cda8fe5 Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 7 Jun 2016 11:29:37 +0200 Subject: [PATCH 24/38] another try --- .travis.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 71d69037..f3a074be 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,14 +48,11 @@ matrix: - os: linux env: - LLVM_VERSION=3.8.0 - - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz - COMPILER=clang++ - CXXFLAGS=-lc++ before_install: - - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH - - mkdir $HOME/clang-$LLVM_VERSION - - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 - - cd $HOME/clang-$LLVM_VERSION ; sudo cp -R * /usr/local/ + - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz + - sudo tar xf clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -C /usr/local --strip-components 1 - os: linux env: From 3f23e7059883198afbe00d6d3fc777227f2e63e3 Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 7 Jun 2016 11:36:03 +0200 Subject: [PATCH 25/38] another try --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f3a074be..446981c9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -52,7 +52,7 @@ matrix: - CXXFLAGS=-lc++ before_install: - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz - - sudo tar xf clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -C /usr/local --strip-components 1 + - sudo tar xf clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -C /usr --strip-components 1 - os: linux env: From 19be324f8780dbbf15e97fdc1eee0927fa451df5 Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 7 Jun 2016 11:38:56 +0200 Subject: [PATCH 26/38] ? --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 446981c9..df9e9007 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,6 +53,8 @@ matrix: before_install: - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz - sudo tar xf clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -C /usr --strip-components 1 + - echo $PATH + - which $COMPILER - os: linux env: From 439563eb04aae069079fda361fe1f306fade293e Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 7 Jun 2016 11:42:34 +0200 Subject: [PATCH 27/38] export --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index df9e9007..c105dd67 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,8 +53,7 @@ matrix: before_install: - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz - sudo tar xf clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -C /usr --strip-components 1 - - echo $PATH - - which $COMPILER + - export - os: linux env: From 97648314a493c474802571d5e2e5584c9937e80b Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 7 Jun 2016 11:52:12 +0200 Subject: [PATCH 28/38] setting explicit path to compiler --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index c105dd67..5746514b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,12 +48,11 @@ matrix: - os: linux env: - LLVM_VERSION=3.8.0 - - COMPILER=clang++ + - COMPILER=/usr/bin/clang++ - CXXFLAGS=-lc++ before_install: - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz - sudo tar xf clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -C /usr --strip-components 1 - - export - os: linux env: From 48f69f40e75bbe9384151b556315e53f910ea977 Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 7 Jun 2016 12:04:57 +0200 Subject: [PATCH 29/38] enough for today... --- .travis.yml | 101 ++-------------------------------------------------- 1 file changed, 2 insertions(+), 99 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5746514b..eb00f6fc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,117 +45,20 @@ matrix: env: COMPILER=g++-5 # from https://github.com/travis-ci/travis-ci/issues/6120 - - os: linux - env: - - LLVM_VERSION=3.8.0 - - COMPILER=/usr/bin/clang++ - - CXXFLAGS=-lc++ - before_install: - - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz - - sudo tar xf clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -C /usr --strip-components 1 - - os: linux env: - LLVM_VERSION=3.8.0 - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz - - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ + - COMPILER=clang++ - CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include/c++/v1" - CXXFLAGS=-lc++ + - PATH=$HOME/clang-$LLVM_VERSION/bin:$PATH - LD_LIBRARY_PATH=$HOME/clang-$LLVM_VERSION/lib:$LD_LIBRARY_PATH before_install: - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH - mkdir $HOME/clang-$LLVM_VERSION - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 - - os: linux - env: - - LLVM_VERSION=3.7.1 - - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz - - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ - - CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include/c++/v1" - - CXXFLAGS=-lc++ - - LD_LIBRARY_PATH=$HOME/clang-$LLVM_VERSION/lib:$LD_LIBRARY_PATH - before_install: - - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH - - mkdir $HOME/clang-$LLVM_VERSION - - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 - - - os: linux - env: - - LLVM_VERSION=3.7.0 - - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz - - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ - - CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include/c++/v1" - - CXXFLAGS=-lc++ - - LD_LIBRARY_PATH=$HOME/clang-$LLVM_VERSION/lib:$LD_LIBRARY_PATH - before_install: - - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH - - mkdir $HOME/clang-$LLVM_VERSION - - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 - - - os: linux - env: - - LLVM_VERSION=3.6.2 - - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz - - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ - - CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include/c++/v1" - - CXXFLAGS=-lc++ - - LD_LIBRARY_PATH=$HOME/clang-$LLVM_VERSION/lib:$LD_LIBRARY_PATH - before_install: - - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH - - mkdir $HOME/clang-$LLVM_VERSION - - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 - - - os: linux - env: - - LLVM_VERSION=3.6.1 - - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz - - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ - - CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include/c++/v1" - - CXXFLAGS=-lc++ - - LD_LIBRARY_PATH=$HOME/clang-$LLVM_VERSION/lib:$LD_LIBRARY_PATH - before_install: - - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH - - mkdir $HOME/clang-$LLVM_VERSION - - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 - - - os: linux - env: - - LLVM_VERSION=3.6.0 - - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz - - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ - - CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include/c++/v1" - - CXXFLAGS=-lc++ - - LD_LIBRARY_PATH=$HOME/clang-$LLVM_VERSION/lib:$LD_LIBRARY_PATH - before_install: - - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH - - mkdir $HOME/clang-$LLVM_VERSION - - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 - - - os: linux - env: - - LLVM_VERSION=3.5.2 - - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz - - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ - - CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include/c++/v1" - - CXXFLAGS=-lc++ - - LD_LIBRARY_PATH=$HOME/clang-$LLVM_VERSION/lib:$LD_LIBRARY_PATH - before_install: - - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH - - mkdir $HOME/clang-$LLVM_VERSION - - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 - - - os: linux - env: - - LLVM_VERSION=3.5.0 - - LLVM_ARCHIVE_PATH=$HOME/clang+llvm.tar.xz - - COMPILER=$HOME/clang-$LLVM_VERSION/bin/clang++ - - CPPFLAGS="-I $HOME/clang-$LLVM_VERSION/include/c++/v1" - before_install: - - wget http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-x86_64-linux-gnu-ubuntu-14.04.tar.xz -O $LLVM_ARCHIVE_PATH - - mkdir $HOME/clang-$LLVM_VERSION - - tar xf $LLVM_ARCHIVE_PATH -C $HOME/clang-$LLVM_VERSION --strip-components 1 - # - os: linux # compiler: gcc # addons: From 947db6ffe3b7546bef932b814a2d86eaf973c38a Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 14 Jun 2016 08:02:29 +0200 Subject: [PATCH 30/38] added Xcode 8 beta --- .travis.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.travis.yml b/.travis.yml index eb00f6fc..9c4029b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -151,6 +151,13 @@ matrix: - COMPILER=clang - CXXFLAGS=-lstdc++ + - os: osx + osx_image: xcode8 + compiler: clang + env: + - COMPILER=clang + - CXXFLAGS=-lstdc++ + script: - uname -a - $COMPILER --version From c744d59f2d2a69cb410b9e2ba060e0feb9b8cdf2 Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 14 Jun 2016 08:14:25 +0200 Subject: [PATCH 31/38] adjusted README file to reality in Travis --- README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 76894387..71eea31b 100644 --- a/README.md +++ b/README.md @@ -72,12 +72,9 @@ The following compilers are currently used in [continuous integration](https://t | Compiler | Operating System | Version String | |-----------------|------------------------------|----------------| -| GCC 4.9.3 | Ubuntu 14.04.3 LTS | g++-4.9 (Ubuntu 4.9.3-8ubuntu2~14.04) 4.9.3 | -| GCC 5.3.0 | Ubuntu 14.04.3 LTS | g++-5 (Ubuntu 5.3.0-3ubuntu1~14.04) 5.3.0 20151204 | -| Clang 3.6.2 | Ubuntu 14.04.3 LTS | Ubuntu clang version 3.6.2-svn240577-1~exp1 (branches/release_36) (based on LLVM 3.6.2) | -| Clang 3.7.1 | Ubuntu 14.04.3 LTS | Ubuntu clang version 3.7.1-svn253571-1~exp1 (branches/release_37) (based on LLVM 3.7.1) | -| Clang 3.8.1 | Ubuntu 14.04.3 LTS | clang version 3.8.1-svn265380-1~exp1 (branches/release_38) | -| Clang 3.9.0 | Ubuntu 14.04.3 LTS | clang version 3.9.0-svn267478-1~exp1 (trunk) | +| GCC 4.9.3 | Ubuntu 14.04.4 LTS | g++-4.9 (Ubuntu 4.9.3-8ubuntu2~14.04) 4.9.3 | +| GCC 5.3.0 | Ubuntu 14.04.4 LTS | g++-5 (Ubuntu 5.3.0-3ubuntu1~14.04) 5.3.0 20151204 | +| Clang 3.8.0 | Ubuntu 14.04.4 LTS | clang version 3.8.0 (tags/RELEASE_380/final) | | Clang Xcode 6.1 | Darwin Kernel Version 13.4.0 (OSX 10.9.5) | Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn) | | Clang Xcode 6.2 | Darwin Kernel Version 13.4.0 (OSX 10.9.5) | Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn) | | Clang Xcode 6.3 | Darwin Kernel Version 14.3.0 (OSX 10.10.3) | Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn) | @@ -85,6 +82,7 @@ The following compilers are currently used in [continuous integration](https://t | Clang Xcode 7.1 | Darwin Kernel Version 14.5.0 (OSX 10.10.5) | Apple LLVM version 7.0.0 (clang-700.1.76) | | Clang Xcode 7.2 | Darwin Kernel Version 15.0.0 (OSX 10.10.5) | Apple LLVM version 7.0.2 (clang-700.1.81) | | Clang Xcode 7.3 | Darwin Kernel Version 14.5.0 (OSX 10.11.1) | Apple LLVM version 7.3.0 (clang-703.0.29) | +| Clang Xcode 8.0 | Darwin Kernel Version 15.5.0 (OSX 10.11.5) | Apple LLVM version 8.0.0 (clang-800.0.24.1) | | Visual Studio 14 2015 | Windows Server 2012 R2 (x64) | Microsoft (R) Build Engine version 14.0.25123.0 | ## Examples From fb90388af5aa7ad67418573554af18a13bcb148f Mon Sep 17 00:00:00 2001 From: Tom Needham <06needhamt@gmail.com> Date: Tue, 14 Jun 2016 09:59:50 +0100 Subject: [PATCH 32/38] Fix Issue #265 --- src/json.hpp | 2 +- src/json.hpp.re2c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/json.hpp b/src/json.hpp index f66d0b59..cbb9e5f0 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -8504,7 +8504,7 @@ basic_json_parser_63: else { type = value_t::number_unsigned; - max = static_cast((std::numeric_limits::max())); + max = static_cast((std::numeric_limits::max)()); } // count the significant figures diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index f893aac0..c60207f6 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -7814,7 +7814,7 @@ class basic_json else { type = value_t::number_unsigned; - max = static_cast((std::numeric_limits::max())); + max = static_cast((std::numeric_limits::max)()); } // count the significant figures From 1eced269e3eb166b6e04f6505c3167157a708d25 Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 14 Jun 2016 15:27:16 +0200 Subject: [PATCH 33/38] update after PR #266 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 71eea31b..411c0139 100644 --- a/README.md +++ b/README.md @@ -434,6 +434,7 @@ I deeply appreciate the help of the following people. - [zewt](https://github.com/zewt) added useful notes to the README file about Android. - [Róbert Márki](https://github.com/robertmrk) added a fix to use move iterators and improved the integration via CMake. - [Chris Kitching](https://github.com/ChrisKitching) cleaned up the CMake files. +- [Tom Needham](https://github.com/06needhamt) fixed a subtle bug with MSVC 2015 which was also proposed by [Michael K.](https://github.com/Epidal). Thanks a lot for helping out! From bb8c7b1f4596d45c3fbac1be1ba46ee4527857ca Mon Sep 17 00:00:00 2001 From: Niels Date: Wed, 15 Jun 2016 21:28:27 +0200 Subject: [PATCH 34/38] mentioning Homebrew's `--HEAD` parameter --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 411c0139..6ef3539c 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ using json = nlohmann::json; to the files you want to use JSON objects. That's it. Do not forget to set the necessary switches to enable C++11 (e.g., `-std=c++11` for GCC and Clang). -:beer: If you are using OS X and [Homebrew](http://brew.sh), just type `brew tap nlohmann/json` and `brew install nlohmann_json` and you're set. +:beer: If you are using OS X and [Homebrew](http://brew.sh), just type `brew tap nlohmann/json` and `brew install nlohmann_json` and you're set. If you want the bleeding edge rather than the latest release, use `brew install nlohmann_json --HEAD`. ## Supported compilers From 039565b9f5a8bbe0b9706190c0847c0a5273a653 Mon Sep 17 00:00:00 2001 From: Niels Date: Sat, 18 Jun 2016 14:33:27 +0200 Subject: [PATCH 35/38] trying codecov --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 9c4029b5..aee8874f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,6 +26,7 @@ matrix: - make json_unit CXXFLAGS="-fprofile-arcs -ftest-coverage -std=c++11 -lstdc++" CXX=$COMPILER - ./json_unit "*" - coveralls --exclude test/src/catch.hpp --exclude test/src/unit.cpp --include src/json.hpp --gcov-options '\-lp' --gcov 'gcov-4.9' + - bash <(curl -s https://codecov.io/bash) env: COMPILER=g++-4.9 - os: linux From 4e31a0e852907dae6e1366027c816b2512e08cbd Mon Sep 17 00:00:00 2001 From: Niels Date: Sun, 19 Jun 2016 16:17:53 +0200 Subject: [PATCH 36/38] minor doc changes --- .gitignore | 3 ++- doc/Doxyfile | 2 +- src/json.hpp | 18 +++++++++--------- src/json.hpp.re2c | 18 +++++++++--------- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index c610519e..d5bd2f7c 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,5 @@ working html me.nlohmann.json.docset -android \ No newline at end of file +android +doc/xml diff --git a/doc/Doxyfile b/doc/Doxyfile index 11faf6d0..e74a8a85 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -236,7 +236,7 @@ MAN_LINKS = NO #--------------------------------------------------------------------------- # Configuration options related to the XML output #--------------------------------------------------------------------------- -GENERATE_XML = NO +GENERATE_XML = YES XML_OUTPUT = xml XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- diff --git a/src/json.hpp b/src/json.hpp index cbb9e5f0..9d6687dd 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -7278,17 +7278,17 @@ class basic_json enum class token_type { uninitialized, ///< indicating the scanner is uninitialized - literal_true, ///< the "true" literal - literal_false, ///< the "false" literal - literal_null, ///< the "null" literal + literal_true, ///< the `true` literal + literal_false, ///< the `false` literal + literal_null, ///< the `null` literal value_string, ///< a string -- use get_string() for actual value value_number, ///< a number -- use get_number() for actual value - begin_array, ///< the character for array begin "[" - begin_object, ///< the character for object begin "{" - end_array, ///< the character for array end "]" - end_object, ///< the character for object end "}" - name_separator, ///< the name separator ":" - value_separator, ///< the value separator "," + begin_array, ///< the character for array begin `[` + begin_object, ///< the character for object begin `{` + end_array, ///< the character for array end `]` + end_object, ///< the character for object end `}` + name_separator, ///< the name separator `:` + value_separator, ///< the value separator `,` parse_error, ///< indicating a parse error end_of_input ///< indicating the end of the input buffer }; diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index c60207f6..9681bed2 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -7278,17 +7278,17 @@ class basic_json enum class token_type { uninitialized, ///< indicating the scanner is uninitialized - literal_true, ///< the "true" literal - literal_false, ///< the "false" literal - literal_null, ///< the "null" literal + literal_true, ///< the `true` literal + literal_false, ///< the `false` literal + literal_null, ///< the `null` literal value_string, ///< a string -- use get_string() for actual value value_number, ///< a number -- use get_number() for actual value - begin_array, ///< the character for array begin "[" - begin_object, ///< the character for object begin "{" - end_array, ///< the character for array end "]" - end_object, ///< the character for object end "}" - name_separator, ///< the name separator ":" - value_separator, ///< the value separator "," + begin_array, ///< the character for array begin `[` + begin_object, ///< the character for object begin `{` + end_array, ///< the character for array end `]` + end_object, ///< the character for object end `}` + name_separator, ///< the name separator `:` + value_separator, ///< the value separator `,` parse_error, ///< indicating a parse error end_of_input ///< indicating the end of the input buffer }; From 4ff27b207ed0ee52bae6abf07f40c23edcf17509 Mon Sep 17 00:00:00 2001 From: Niels Date: Sun, 19 Jun 2016 17:56:58 +0200 Subject: [PATCH 37/38] fixed two typos --- test/src/unit.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/src/unit.cpp b/test/src/unit.cpp index 0a2bdd10..609e1be9 100644 --- a/test/src/unit.cpp +++ b/test/src/unit.cpp @@ -1285,7 +1285,7 @@ TEST_CASE("constructors") SECTION("create a JSON value from an input stream") { - SECTION("sts::stringstream") + SECTION("std::stringstream") { std::stringstream ss; ss << "[\"foo\",1,2,3,false,{\"one\":1}]"; @@ -14065,7 +14065,7 @@ TEST_CASE("regression tests") CHECK(dest == expected); } - SECTION("issue ##235 - ambiguous overload for 'push_back' and 'operator+='") + SECTION("issue #235 - ambiguous overload for 'push_back' and 'operator+='") { json data = {{"key", "value"}}; data.push_back({"key2", "value2"}); From 8c48ef1f73f6bf392d7fd66132c5e74b0739892e Mon Sep 17 00:00:00 2001 From: Niels Date: Sun, 19 Jun 2016 18:25:43 +0200 Subject: [PATCH 38/38] updated to Catch v1.5.6 --- test/src/catch.hpp | 452 ++++++++++++++++++++++++++++++--------------- 1 file changed, 301 insertions(+), 151 deletions(-) diff --git a/test/src/catch.hpp b/test/src/catch.hpp index 5cc33a83..879fc5b1 100644 --- a/test/src/catch.hpp +++ b/test/src/catch.hpp @@ -1,6 +1,6 @@ /* - * Catch v1.3.4 - * Generated: 2016-02-10 19:24:03.089683 + * Catch v1.5.6 + * Generated: 2016-06-09 19:20:41.460328 * ---------------------------------------------------------- * This file has been merged from multiple headers. Please don't edit it directly * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. @@ -62,7 +62,11 @@ #define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line #define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) -#define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ ) +#ifdef CATCH_CONFIG_COUNTER +# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ ) +#else +# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ ) +#endif #define INTERNAL_CATCH_STRINGIFY2( expr ) #expr #define INTERNAL_CATCH_STRINGIFY( expr ) INTERNAL_CATCH_STRINGIFY2( expr ) @@ -89,7 +93,7 @@ // CATCH_CONFIG_CPP11_OR_GREATER : Is C++11 supported? // CATCH_CONFIG_VARIADIC_MACROS : are variadic macros supported? - +// CATCH_CONFIG_COUNTER : is the __COUNTER__ macro supported? // **************** // Note to maintainers: if new toggles are added please document them // in configuration.md, too @@ -102,6 +106,18 @@ // All the C++11 features can be disabled with CATCH_CONFIG_NO_CPP11 +#ifdef __cplusplus + +# if __cplusplus >= 201103L +# define CATCH_CPP11_OR_GREATER +# endif + +# if __cplusplus >= 201402L +# define CATCH_CPP14_OR_GREATER +# endif + +#endif + #ifdef __clang__ # if __has_feature(cxx_nullptr) @@ -112,6 +128,10 @@ # define CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT # endif +# if defined(CATCH_CPP11_OR_GREATER) +# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS _Pragma( "clang diagnostic ignored \"-Wparentheses\"" ) +# endif + #endif // __clang__ //////////////////////////////////////////////////////////////////////////////// @@ -136,9 +156,13 @@ // GCC #ifdef __GNUC__ -#if __GNUC__ == 4 && __GNUC_MINOR__ >= 6 && defined(__GXX_EXPERIMENTAL_CXX0X__) -# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR -#endif +# if __GNUC__ == 4 && __GNUC_MINOR__ >= 6 && defined(__GXX_EXPERIMENTAL_CXX0X__) +# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR +# endif + +# if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS) && defined(CATCH_CPP11_OR_GREATER) +# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS _Pragma( "GCC diagnostic ignored \"-Wparentheses\"" ) +# endif // - otherwise more recent versions define __cplusplus >= 201103L // and will get picked up below @@ -173,13 +197,20 @@ #endif +// Use __COUNTER__ if the compiler supports it +#if ( defined _MSC_VER && _MSC_VER >= 1300 ) || \ + ( defined __GNUC__ && __GNUC__ >= 4 && __GNUC_MINOR__ >= 3 ) || \ + ( defined __clang__ && __clang_major__ >= 3 ) + +#define CATCH_INTERNAL_CONFIG_COUNTER + +#endif + //////////////////////////////////////////////////////////////////////////////// // C++ language feature support // catch all support for C++11 -#if defined(__cplusplus) && __cplusplus >= 201103L - -# define CATCH_CPP11_OR_GREATER +#if defined(CATCH_CPP11_OR_GREATER) # if !defined(CATCH_INTERNAL_CONFIG_CPP11_NULLPTR) # define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR @@ -246,6 +277,13 @@ #if defined(CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR) && !defined(CATCH_CONFIG_NO_UNIQUE_PTR) && !defined(CATCH_CONFIG_CPP11_UNIQUE_PTR) && !defined(CATCH_CONFIG_NO_CPP11) # define CATCH_CONFIG_CPP11_UNIQUE_PTR #endif +#if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER) +# define CATCH_CONFIG_COUNTER +#endif + +#if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS) +# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS +#endif // noexcept support: #if defined(CATCH_CONFIG_CPP11_NOEXCEPT) && !defined(CATCH_NOEXCEPT) @@ -672,24 +710,28 @@ void registerTestCaseFunction #ifdef CATCH_CONFIG_VARIADIC_MACROS /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \ + static void TestName(); \ + namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &TestName, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( __VA_ARGS__ ) ); }\ + static void TestName() #define INTERNAL_CATCH_TESTCASE( ... ) \ - static void INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )(); \ - namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( __VA_ARGS__ ) ); }\ - static void INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )() + INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), __VA_ARGS__ ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \ namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &QualifiedMethod, "&" #QualifiedMethod, Catch::NameAndDesc( __VA_ARGS__ ), CATCH_INTERNAL_LINEINFO ); } /////////////////////////////////////////////////////////////////////////////// - #define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... )\ + #define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\ namespace{ \ - struct INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ) : ClassName{ \ + struct TestName : ClassName{ \ void test(); \ }; \ - Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( &INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )::test, #ClassName, Catch::NameAndDesc( __VA_ARGS__ ), CATCH_INTERNAL_LINEINFO ); \ + Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( &TestName::test, #ClassName, Catch::NameAndDesc( __VA_ARGS__ ), CATCH_INTERNAL_LINEINFO ); \ } \ - void INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )::test() + void TestName::test() + #define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... ) \ + INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), ClassName, __VA_ARGS__ ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \ @@ -697,24 +739,28 @@ void registerTestCaseFunction #else /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_TESTCASE2( TestName, Name, Desc ) \ + static void TestName(); \ + namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &TestName, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( Name, Desc ) ); }\ + static void TestName() #define INTERNAL_CATCH_TESTCASE( Name, Desc ) \ - static void INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )(); \ - namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( Name, Desc ) ); }\ - static void INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )() + INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), Name, Desc ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, Name, Desc ) \ namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &QualifiedMethod, "&" #QualifiedMethod, Catch::NameAndDesc( Name, Desc ), CATCH_INTERNAL_LINEINFO ); } /////////////////////////////////////////////////////////////////////////////// - #define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, TestName, Desc )\ + #define INTERNAL_CATCH_TEST_CASE_METHOD2( TestCaseName, ClassName, TestName, Desc )\ namespace{ \ - struct INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ) : ClassName{ \ + struct TestCaseName : ClassName{ \ void test(); \ }; \ - Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( &INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )::test, #ClassName, Catch::NameAndDesc( TestName, Desc ), CATCH_INTERNAL_LINEINFO ); \ + Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( &TestCaseName::test, #ClassName, Catch::NameAndDesc( TestName, Desc ), CATCH_INTERNAL_LINEINFO ); \ } \ - void INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )::test() + void TestCaseName::test() + #define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, TestName, Desc )\ + INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), ClassName, TestName, Desc ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_REGISTER_TESTCASE( Function, Name, Desc ) \ @@ -1287,37 +1333,37 @@ namespace Internal { template struct Evaluator { static bool evaluate( T1 const& lhs, T2 const& rhs) { - return opCast( lhs ) == opCast( rhs ); + return bool( opCast( lhs ) == opCast( rhs ) ); } }; template struct Evaluator { static bool evaluate( T1 const& lhs, T2 const& rhs ) { - return opCast( lhs ) != opCast( rhs ); + return bool( opCast( lhs ) != opCast( rhs ) ); } }; template struct Evaluator { static bool evaluate( T1 const& lhs, T2 const& rhs ) { - return opCast( lhs ) < opCast( rhs ); + return bool( opCast( lhs ) < opCast( rhs ) ); } }; template struct Evaluator { static bool evaluate( T1 const& lhs, T2 const& rhs ) { - return opCast( lhs ) > opCast( rhs ); + return bool( opCast( lhs ) > opCast( rhs ) ); } }; template struct Evaluator { static bool evaluate( T1 const& lhs, T2 const& rhs ) { - return opCast( lhs ) >= opCast( rhs ); + return bool( opCast( lhs ) >= opCast( rhs ) ); } }; template struct Evaluator { static bool evaluate( T1 const& lhs, T2 const& rhs ) { - return opCast( lhs ) <= opCast( rhs ); + return bool( opCast( lhs ) <= opCast( rhs ) ); } }; @@ -2020,13 +2066,14 @@ namespace Catch { do { \ Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \ try { \ + CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ ( __catchResult <= expr ).endExpression(); \ } \ catch( ... ) { \ __catchResult.useActiveException( Catch::ResultDisposition::Normal ); \ } \ INTERNAL_CATCH_REACT( __catchResult ) \ - } while( Catch::isTrue( false && static_cast(expr) ) ) // expr here is never evaluated at runtime but it forces the compiler to give it a look + } while( Catch::isTrue( false && !!(expr) ) ) // expr here is never evaluated at runtime but it forces the compiler to give it a look /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_IF( expr, resultDisposition, macroName ) \ @@ -2563,10 +2610,12 @@ namespace Catch { } /////////////////////////////////////////////////////////////////////////////// -#define INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) \ - static std::string INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator )( signature ); \ - namespace{ Catch::ExceptionTranslatorRegistrar INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionRegistrar )( &INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ) ); }\ - static std::string INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator )( signature ) +#define INTERNAL_CATCH_TRANSLATE_EXCEPTION2( translatorName, signature ) \ + static std::string translatorName( signature ); \ + namespace{ Catch::ExceptionTranslatorRegistrar INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionRegistrar )( &translatorName ); }\ + static std::string translatorName( signature ) + +#define INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION2( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature ) // #included from: internal/catch_approx.hpp #define TWOBLUECUBES_CATCH_APPROX_HPP_INCLUDED @@ -3331,6 +3380,11 @@ namespace Catch { InLexicographicalOrder, InRandomOrder }; }; + struct UseColour { enum YesOrNo { + Auto, + Yes, + No + }; }; class TestSpec; @@ -3350,7 +3404,7 @@ namespace Catch { virtual TestSpec const& testSpec() const = 0; virtual RunTests::InWhatOrder runOrder() const = 0; virtual unsigned int rngSeed() const = 0; - virtual bool forceColour() const = 0; + virtual UseColour::YesOrNo useColour() const = 0; }; } @@ -3404,7 +3458,7 @@ namespace Catch { }; class DebugOutStream : public IStream { - std::auto_ptr m_streamBuf; + CATCH_AUTO_PTR( StreamBufBase ) m_streamBuf; mutable std::ostream m_os; public: DebugOutStream(); @@ -3439,14 +3493,14 @@ namespace Catch { noThrow( false ), showHelp( false ), showInvisibles( false ), - forceColour( false ), filenamesAsTags( false ), abortAfter( -1 ), rngSeed( 0 ), verbosity( Verbosity::Normal ), warnings( WarnAbout::Nothing ), showDurations( ShowDurations::DefaultForReporter ), - runOrder( RunTests::InDeclarationOrder ) + runOrder( RunTests::InDeclarationOrder ), + useColour( UseColour::Auto ) {} bool listTests; @@ -3459,7 +3513,6 @@ namespace Catch { bool noThrow; bool showHelp; bool showInvisibles; - bool forceColour; bool filenamesAsTags; int abortAfter; @@ -3469,6 +3522,7 @@ namespace Catch { WarnAbout::What warnings; ShowDurations::OrNot showDurations; RunTests::InWhatOrder runOrder; + UseColour::YesOrNo useColour; std::string outputFilename; std::string name; @@ -3534,7 +3588,7 @@ namespace Catch { virtual ShowDurations::OrNot showDurations() const { return m_data.showDurations; } virtual RunTests::InWhatOrder runOrder() const { return m_data.runOrder; } virtual unsigned int rngSeed() const { return m_data.rngSeed; } - virtual bool forceColour() const { return m_data.forceColour; } + virtual UseColour::YesOrNo useColour() const { return m_data.useColour; } private: @@ -3552,7 +3606,7 @@ namespace Catch { } ConfigData m_data; - std::auto_ptr m_stream; + CATCH_AUTO_PTR( IStream const ) m_stream; TestSpec m_testSpec; }; @@ -3572,7 +3626,7 @@ namespace Catch { #define STITCH_CLARA_OPEN_NAMESPACE namespace Catch { // #included from: ../external/clara.h -// Version 0.0.1.1 +// Version 0.0.2.4 // Only use header guard if we are not using an outer namespace #if !defined(TWOBLUECUBES_CLARA_H_INCLUDED) || defined(STITCH_CLARA_OPEN_NAMESPACE) @@ -3888,6 +3942,10 @@ namespace Tbc { #include #include +#if defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) +#define CLARA_PLATFORM_WINDOWS +#endif + // Use optional outer namespace #ifdef STITCH_CLARA_OPEN_NAMESPACE STITCH_CLARA_OPEN_NAMESPACE @@ -3911,9 +3969,6 @@ namespace Clara { const unsigned int consoleWidth = 80; #endif - // Use this to try and stop compiler from warning about unreachable code - inline bool isTrue( bool value ) { return value; } - using namespace Tbc; inline bool startsWith( std::string const& str, std::string const& prefix ) { @@ -3949,14 +4004,6 @@ namespace Clara { else throw std::runtime_error( "Expected a boolean value but did not recognise:\n '" + _source + "'" ); } - inline void convertInto( bool _source, bool& _dest ) { - _dest = _source; - } - template - inline void convertInto( bool, T& ) { - if( isTrue( true ) ) - throw std::runtime_error( "Invalid conversion" ); - } template struct IArgFunction { @@ -3966,7 +4013,6 @@ namespace Clara { IArgFunction( IArgFunction const& ) = default; #endif virtual void set( ConfigT& config, std::string const& value ) const = 0; - virtual void setFlag( ConfigT& config ) const = 0; virtual bool takesArg() const = 0; virtual IArgFunction* clone() const = 0; }; @@ -3988,9 +4034,6 @@ namespace Clara { void set( ConfigT& config, std::string const& value ) const { functionObj->set( config, value ); } - void setFlag( ConfigT& config ) const { - functionObj->setFlag( config ); - } bool takesArg() const { return functionObj->takesArg(); } bool isSet() const { @@ -4003,7 +4046,6 @@ namespace Clara { template struct NullBinder : IArgFunction{ virtual void set( C&, std::string const& ) const {} - virtual void setFlag( C& ) const {} virtual bool takesArg() const { return true; } virtual IArgFunction* clone() const { return new NullBinder( *this ); } }; @@ -4014,9 +4056,6 @@ namespace Clara { virtual void set( C& p, std::string const& stringValue ) const { convertInto( stringValue, p.*member ); } - virtual void setFlag( C& p ) const { - convertInto( true, p.*member ); - } virtual bool takesArg() const { return !IsBool::value; } virtual IArgFunction* clone() const { return new BoundDataMember( *this ); } M C::* member; @@ -4029,11 +4068,6 @@ namespace Clara { convertInto( stringValue, value ); (p.*member)( value ); } - virtual void setFlag( C& p ) const { - typename RemoveConstRef::type value; - convertInto( true, value ); - (p.*member)( value ); - } virtual bool takesArg() const { return !IsBool::value; } virtual IArgFunction* clone() const { return new BoundUnaryMethod( *this ); } void (C::*member)( M ); @@ -4047,9 +4081,6 @@ namespace Clara { if( value ) (p.*member)(); } - virtual void setFlag( C& p ) const { - (p.*member)(); - } virtual bool takesArg() const { return false; } virtual IArgFunction* clone() const { return new BoundNullaryMethod( *this ); } void (C::*member)(); @@ -4064,9 +4095,6 @@ namespace Clara { if( value ) function( obj ); } - virtual void setFlag( C& p ) const { - function( p ); - } virtual bool takesArg() const { return false; } virtual IArgFunction* clone() const { return new BoundUnaryFunction( *this ); } void (*function)( C& ); @@ -4080,11 +4108,6 @@ namespace Clara { convertInto( stringValue, value ); function( obj, value ); } - virtual void setFlag( C& obj ) const { - typename RemoveConstRef::type value; - convertInto( true, value ); - function( obj, value ); - } virtual bool takesArg() const { return !IsBool::value; } virtual IArgFunction* clone() const { return new BoundBinaryFunction( *this ); } void (*function)( C&, T ); @@ -4092,8 +4115,20 @@ namespace Clara { } // namespace Detail - struct Parser { - Parser() : separators( " \t=:" ) {} + inline std::vector argsToVector( int argc, char const* const* const argv ) { + std::vector args( static_cast( argc ) ); + for( std::size_t i = 0; i < static_cast( argc ); ++i ) + args[i] = argv[i]; + + return args; + } + + class Parser { + enum Mode { None, MaybeShortOpt, SlashOpt, ShortOpt, LongOpt, Positional }; + Mode mode; + std::size_t from; + bool inQuotes; + public: struct Token { enum Type { Positional, ShortOpt, LongOpt }; @@ -4102,38 +4137,75 @@ namespace Clara { std::string data; }; - void parseIntoTokens( int argc, char const* const argv[], std::vector& tokens ) const { + Parser() : mode( None ), from( 0 ), inQuotes( false ){} + + void parseIntoTokens( std::vector const& args, std::vector& tokens ) { const std::string doubleDash = "--"; - for( int i = 1; i < argc && argv[i] != doubleDash; ++i ) - parseIntoTokens( argv[i] , tokens); + for( std::size_t i = 1; i < args.size() && args[i] != doubleDash; ++i ) + parseIntoTokens( args[i], tokens); } - void parseIntoTokens( std::string arg, std::vector& tokens ) const { - while( !arg.empty() ) { - Parser::Token token( Parser::Token::Positional, arg ); - arg = ""; - if( token.data[0] == '-' ) { - if( token.data.size() > 1 && token.data[1] == '-' ) { - token = Parser::Token( Parser::Token::LongOpt, token.data.substr( 2 ) ); - } - else { - token = Parser::Token( Parser::Token::ShortOpt, token.data.substr( 1 ) ); - if( token.data.size() > 1 && separators.find( token.data[1] ) == std::string::npos ) { - arg = "-" + token.data.substr( 1 ); - token.data = token.data.substr( 0, 1 ); - } - } - } - if( token.type != Parser::Token::Positional ) { - std::size_t pos = token.data.find_first_of( separators ); - if( pos != std::string::npos ) { - arg = token.data.substr( pos+1 ); - token.data = token.data.substr( 0, pos ); - } - } - tokens.push_back( token ); + + void parseIntoTokens( std::string const& arg, std::vector& tokens ) { + for( std::size_t i = 0; i <= arg.size(); ++i ) { + char c = arg[i]; + if( c == '"' ) + inQuotes = !inQuotes; + mode = handleMode( i, c, arg, tokens ); } } - std::string separators; + Mode handleMode( std::size_t i, char c, std::string const& arg, std::vector& tokens ) { + switch( mode ) { + case None: return handleNone( i, c ); + case MaybeShortOpt: return handleMaybeShortOpt( i, c ); + case ShortOpt: + case LongOpt: + case SlashOpt: return handleOpt( i, c, arg, tokens ); + case Positional: return handlePositional( i, c, arg, tokens ); + default: throw std::logic_error( "Unknown mode" ); + } + } + + Mode handleNone( std::size_t i, char c ) { + if( inQuotes ) { + from = i; + return Positional; + } + switch( c ) { + case '-': return MaybeShortOpt; +#ifdef CLARA_PLATFORM_WINDOWS + case '/': from = i+1; return SlashOpt; +#endif + default: from = i; return Positional; + } + } + Mode handleMaybeShortOpt( std::size_t i, char c ) { + switch( c ) { + case '-': from = i+1; return LongOpt; + default: from = i; return ShortOpt; + } + } + Mode handleOpt( std::size_t i, char c, std::string const& arg, std::vector& tokens ) { + if( std::string( ":=\0", 3 ).find( c ) == std::string::npos ) + return mode; + + std::string optName = arg.substr( from, i-from ); + if( mode == ShortOpt ) + for( std::size_t j = 0; j < optName.size(); ++j ) + tokens.push_back( Token( Token::ShortOpt, optName.substr( j, 1 ) ) ); + else if( mode == SlashOpt && optName.size() == 1 ) + tokens.push_back( Token( Token::ShortOpt, optName ) ); + else + tokens.push_back( Token( Token::LongOpt, optName ) ); + return None; + } + Mode handlePositional( std::size_t i, char c, std::string const& arg, std::vector& tokens ) { + if( inQuotes || std::string( "\0", 1 ).find( c ) == std::string::npos ) + return mode; + + std::string data = arg.substr( from, i-from ); + tokens.push_back( Token( Token::Positional, data ) ); + return None; + } }; template @@ -4436,21 +4508,21 @@ namespace Clara { return oss.str(); } - ConfigT parse( int argc, char const* const argv[] ) const { + ConfigT parse( std::vector const& args ) const { ConfigT config; - parseInto( argc, argv, config ); + parseInto( args, config ); return config; } - std::vector parseInto( int argc, char const* argv[], ConfigT& config ) const { - std::string processName = argv[0]; + std::vector parseInto( std::vector const& args, ConfigT& config ) const { + std::string processName = args[0]; std::size_t lastSlash = processName.find_last_of( "/\\" ); if( lastSlash != std::string::npos ) processName = processName.substr( lastSlash+1 ); m_boundProcessName.set( config, processName ); std::vector tokens; Parser parser; - parser.parseIntoTokens( argc, argv, tokens ); + parser.parseIntoTokens( args, tokens ); return populate( tokens, config ); } @@ -4481,7 +4553,7 @@ namespace Clara { arg.boundField.set( config, tokens[++i].data ); } else { - arg.boundField.setFlag( config ); + arg.boundField.set( config, "true" ); } break; } @@ -4624,6 +4696,21 @@ namespace Catch { ? ShowDurations::Always : ShowDurations::Never; } + inline void setUseColour( ConfigData& config, std::string const& value ) { + std::string mode = toLower( value ); + + if( mode == "yes" ) + config.useColour = UseColour::Yes; + else if( mode == "no" ) + config.useColour = UseColour::No; + else if( mode == "auto" ) + config.useColour = UseColour::Auto; + else + throw std::runtime_error( "colour mode must be one of: auto, yes or no" ); + } + inline void forceColour( ConfigData& config ) { + config.useColour = UseColour::Yes; + } inline void loadTestNamesFromFile( ConfigData& config, std::string const& _filename ) { std::ifstream f( _filename.c_str() ); if( !f.is_open() ) @@ -4710,7 +4797,7 @@ namespace Catch { cli["-d"]["--durations"] .describe( "show test durations" ) - .bind( &setShowDurations, "yes/no" ); + .bind( &setShowDurations, "yes|no" ); cli["-f"]["--input-file"] .describe( "load test names to run from a file" ) @@ -4738,8 +4825,12 @@ namespace Catch { .bind( &setRngSeed, "'time'|number" ); cli["--force-colour"] - .describe( "force colourised output" ) - .bind( &ConfigData::forceColour ); + .describe( "force colourised output (deprecated)" ) + .bind( &forceColour ); + + cli["--use-colour"] + .describe( "should output be colourised" ) + .bind( &setUseColour, "yes|no" ); return cli; } @@ -5170,6 +5261,8 @@ namespace Catch bool aborting; }; + class MultipleReporters; + struct IStreamingReporter : IShared { virtual ~IStreamingReporter(); @@ -5197,6 +5290,8 @@ namespace Catch virtual void testRunEnded( TestRunStats const& testRunStats ) = 0; virtual void skipTest( TestCaseInfo const& testInfo ) = 0; + + virtual MultipleReporters* tryAsMulti() { return CATCH_NULL; } }; struct IReporterFactory : IShared { @@ -5414,6 +5509,10 @@ namespace TestCaseTracking { virtual void addChild( Ptr const& child ) = 0; virtual ITracker* findChild( std::string const& name ) = 0; virtual void openChild() = 0; + + // Debug/ checking + virtual bool isSectionTracker() const = 0; + virtual bool isIndexTracker() const = 0; }; class TrackerContext { @@ -5538,6 +5637,10 @@ namespace TestCaseTracking { m_parent->openChild(); } } + + virtual bool isSectionTracker() const CATCH_OVERRIDE { return false; } + virtual bool isIndexTracker() const CATCH_OVERRIDE { return false; } + void open() { m_runState = Executing; moveToThis(); @@ -5601,13 +5704,16 @@ namespace TestCaseTracking { {} virtual ~SectionTracker(); + virtual bool isSectionTracker() const CATCH_OVERRIDE { return true; } + static SectionTracker& acquire( TrackerContext& ctx, std::string const& name ) { SectionTracker* section = CATCH_NULL; ITracker& currentTracker = ctx.currentTracker(); if( ITracker* childTracker = currentTracker.findChild( name ) ) { - section = dynamic_cast( childTracker ); - assert( section ); + assert( childTracker ); + assert( childTracker->isSectionTracker() ); + section = static_cast( childTracker ); } else { section = new SectionTracker( name, ctx, ¤tTracker ); @@ -5632,13 +5738,16 @@ namespace TestCaseTracking { {} virtual ~IndexTracker(); + virtual bool isIndexTracker() const CATCH_OVERRIDE { return true; } + static IndexTracker& acquire( TrackerContext& ctx, std::string const& name, int size ) { IndexTracker* tracker = CATCH_NULL; ITracker& currentTracker = ctx.currentTracker(); if( ITracker* childTracker = currentTracker.findChild( name ) ) { - tracker = dynamic_cast( childTracker ); - assert( tracker ); + assert( childTracker ); + assert( childTracker->isIndexTracker() ); + tracker = static_cast( childTracker ); } else { tracker = new IndexTracker( name, ctx, ¤tTracker, size ); @@ -5845,6 +5954,11 @@ namespace Catch { while( getCurrentContext().advanceGeneratorsForCurrentTest() && !aborting() ); Totals deltaTotals = m_totals.delta( prevTotals ); + if( testInfo.expectedToFail() && deltaTotals.testCases.passed > 0 ) { + deltaTotals.assertions.failed++; + deltaTotals.testCases.passed--; + deltaTotals.testCases.failed++; + } m_totals.testCases += deltaTotals.testCases; m_reporter->testCaseEnded( TestCaseStats( testInfo, deltaTotals, @@ -6236,10 +6350,10 @@ namespace Catch { Catch::cout() << "For more detail usage please see the project docs\n" << std::endl; } - int applyCommandLine( int argc, char const* argv[], OnUnusedOptions::DoWhat unusedOptionBehaviour = OnUnusedOptions::Fail ) { + int applyCommandLine( int argc, char const* const* const argv, OnUnusedOptions::DoWhat unusedOptionBehaviour = OnUnusedOptions::Fail ) { try { m_cli.setThrowOnUnrecognisedTokens( unusedOptionBehaviour == OnUnusedOptions::Fail ); - m_unusedTokens = m_cli.parseInto( argc, argv, m_configData ); + m_unusedTokens = m_cli.parseInto( Clara::argsToVector( argc, argv ), m_configData ); if( m_configData.showHelp ) showHelp( m_configData.processName ); m_config.reset(); @@ -6263,16 +6377,13 @@ namespace Catch { m_config.reset(); } - int run( int argc, char const* argv[] ) { + int run( int argc, char const* const* const argv ) { int returnCode = applyCommandLine( argc, argv ); if( returnCode == 0 ) returnCode = run(); return returnCode; } - int run( int argc, char* argv[] ) { - return run( argc, const_cast( argv ) ); - } int run() { if( m_configData.showHelp ) @@ -6336,13 +6447,31 @@ namespace Catch { #include #include +#ifdef CATCH_CPP14_OR_GREATER +#include +#endif + namespace Catch { - struct LexSort { - bool operator() (TestCase i,TestCase j) const { return (i + static void shuffle( V& vector ) { + RandomNumberGenerator rng; +#ifdef CATCH_CPP14_OR_GREATER + std::shuffle( vector.begin(), vector.end(), rng ); +#else + std::random_shuffle( vector.begin(), vector.end(), rng ); +#endif + } }; inline std::vector sortTests( IConfig const& config, std::vector const& unsortedTestCases ) { @@ -6351,14 +6480,12 @@ namespace Catch { switch( config.runOrder() ) { case RunTests::InLexicographicalOrder: - std::sort( sorted.begin(), sorted.end(), LexSort() ); + std::sort( sorted.begin(), sorted.end() ); break; case RunTests::InRandomOrder: { seedRng( config ); - - RandomNumberGenerator rng; - std::random_shuffle( sorted.begin(), sorted.end(), rng ); + RandomNumberGenerator::shuffle( sorted ); } break; case RunTests::InDeclarationOrder: @@ -6377,13 +6504,15 @@ namespace Catch { it != itEnd; ++it ) { std::pair::const_iterator, bool> prev = seenFunctions.insert( *it ); - if( !prev.second ){ - Catch::cerr() - << Colour( Colour::Red ) - << "error: TEST_CASE( \"" << it->name << "\" ) already defined.\n" - << "\tFirst seen at " << prev.first->getTestCaseInfo().lineInfo << "\n" - << "\tRedefined at " << it->getTestCaseInfo().lineInfo << std::endl; - exit(1); + if( !prev.second ) { + std::ostringstream ss; + + ss << Colour( Colour::Red ) + << "error: TEST_CASE( \"" << it->name << "\" ) already defined.\n" + << "\tFirst seen at " << prev.first->getTestCaseInfo().lineInfo << "\n" + << "\tRedefined at " << it->getTestCaseInfo().lineInfo << std::endl; + + throw std::runtime_error(ss.str()); } } } @@ -6971,7 +7100,18 @@ namespace { IColourImpl* platformColourInstance() { static Win32ColourImpl s_instance; - return &s_instance; + + Ptr config = getCurrentContext().getConfig(); + UseColour::YesOrNo colourMode = config + ? config->useColour() + : UseColour::Auto; + if( colourMode == UseColour::Auto ) + colourMode = !isDebuggerActive() + ? UseColour::Yes + : UseColour::No; + return colourMode == UseColour::Yes + ? &s_instance + : NoColourImpl::instance(); } } // end anon namespace @@ -7022,7 +7162,14 @@ namespace { IColourImpl* platformColourInstance() { Ptr config = getCurrentContext().getConfig(); - return (config && config->forceColour()) || isatty(STDOUT_FILENO) + UseColour::YesOrNo colourMode = config + ? config->useColour() + : UseColour::Auto; + if( colourMode == UseColour::Auto ) + colourMode = (!isDebuggerActive() && isatty(STDOUT_FILENO) ) + ? UseColour::Yes + : UseColour::No; + return colourMode == UseColour::Yes ? PosixColourImpl::instance() : NoColourImpl::instance(); } @@ -7047,9 +7194,7 @@ namespace Catch { Colour::~Colour(){ if( !m_moved ) use( None ); } void Colour::use( Code _colourCode ) { - static IColourImpl* impl = isDebuggerActive() - ? NoColourImpl::instance() - : platformColourInstance(); + static IColourImpl* impl = platformColourInstance(); impl->use( _colourCode ); } @@ -7426,7 +7571,7 @@ namespace Catch { return os; } - Version libraryVersion( 1, 3, 4, "", 0 ); + Version libraryVersion( 1, 5, 6, "", 0 ); } @@ -8405,13 +8550,18 @@ public: // IStreamingReporter ++it ) (*it)->skipTest( testInfo ); } + + virtual MultipleReporters* tryAsMulti() CATCH_OVERRIDE { + return this; + } + }; Ptr addReporter( Ptr const& existingReporter, Ptr const& additionalReporter ) { Ptr resultingReporter; if( existingReporter ) { - MultipleReporters* multi = dynamic_cast( existingReporter.get() ); + MultipleReporters* multi = existingReporter->tryAsMulti(); if( !multi ) { multi = new MultipleReporters; resultingReporter = Ptr( multi ); @@ -8591,7 +8741,7 @@ namespace Catch { virtual void assertionStarting( AssertionInfo const& ) CATCH_OVERRIDE {} - virtual bool assertionEnded( AssertionStats const& assertionStats ) { + virtual bool assertionEnded( AssertionStats const& assertionStats ) CATCH_OVERRIDE { assert( !m_sectionStack.empty() ); SectionNode& sectionNode = *m_sectionStack.back(); sectionNode.assertions.push_back( assertionStats ); @@ -9722,7 +9872,7 @@ namespace Catch { if( totals.testCases.total() == 0 ) { stream << Colour( Colour::Warning ) << "No tests ran\n"; } - else if( totals.assertions.total() > 0 && totals.assertions.allPassed() ) { + else if( totals.assertions.total() > 0 && totals.testCases.allPassed() ) { stream << Colour( Colour::ResultSuccess ) << "All tests passed"; stream << " (" << pluralise( totals.assertions.passed, "assertion" ) << " in "