From dc479b3f9de06dea12105c6ea21ee263dcfd8d6a Mon Sep 17 00:00:00 2001 From: Niels Date: Tue, 28 Jun 2016 22:09:22 +0200 Subject: [PATCH 1/4] check for unsupported compilers --- src/json.hpp | 14 ++++++++++++++ src/json.hpp.re2c | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/json.hpp b/src/json.hpp index 35bdd293..1673fb17 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -53,6 +53,20 @@ SOFTWARE. #include #include +// exclude unsupported compilers +#if defined(__clang__) + #define CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) + #if CLANG_VERSION < 34000 + #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers" + #endif +#endif +#if defined(__GNUC__) + #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) + #if GCC_VERSION < 48000 + #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers" + #endif +#endif + // disable float-equal warnings on GCC/clang #if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) #pragma GCC diagnostic push diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index 016ff0c5..2672c1d0 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -53,6 +53,20 @@ SOFTWARE. #include #include +// exclude unsupported compilers +#if defined(__clang__) + #define CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) + #if CLANG_VERSION < 34000 + #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers" + #endif +#endif +#if defined(__GNUC__) + #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) + #if GCC_VERSION < 48000 + #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers" + #endif +#endif + // disable float-equal warnings on GCC/clang #if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) #pragma GCC diagnostic push From d456dec320b198c1376cd10cb1697038f341de08 Mon Sep 17 00:00:00 2001 From: Niels Date: Wed, 29 Jun 2016 09:16:18 +0200 Subject: [PATCH 2/4] overlapping defines --- src/json.hpp | 3 +-- src/json.hpp.re2c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/json.hpp b/src/json.hpp index 1673fb17..eaa3a44e 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -59,8 +59,7 @@ SOFTWARE. #if CLANG_VERSION < 34000 #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers" #endif -#endif -#if defined(__GNUC__) +#elif defined(__GNUC__) #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) #if GCC_VERSION < 48000 #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers" diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index 2672c1d0..9c94a2ba 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -59,8 +59,7 @@ SOFTWARE. #if CLANG_VERSION < 34000 #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers" #endif -#endif -#if defined(__GNUC__) +#elif defined(__GNUC__) #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) #if GCC_VERSION < 48000 #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers" From 7cb8ee42d52bd773bdd55bd873c3f48565060ed0 Mon Sep 17 00:00:00 2001 From: Niels Date: Wed, 29 Jun 2016 09:22:28 +0200 Subject: [PATCH 3/4] wrong GCC version --- 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 eaa3a44e..92b913a8 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -61,7 +61,7 @@ SOFTWARE. #endif #elif defined(__GNUC__) #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) - #if GCC_VERSION < 48000 + #if GCC_VERSION < 49000 #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers" #endif #endif diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index 9c94a2ba..cc4df5de 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -61,7 +61,7 @@ SOFTWARE. #endif #elif defined(__GNUC__) #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) - #if GCC_VERSION < 48000 + #if GCC_VERSION < 49000 #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers" #endif #endif From 924f78119b6160cd26daec2b5eeb4837483d4e43 Mon Sep 17 00:00:00 2001 From: Niels Date: Wed, 29 Jun 2016 09:34:14 +0200 Subject: [PATCH 4/4] math... --- 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 92b913a8..d73abe0c 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -56,12 +56,12 @@ SOFTWARE. // exclude unsupported compilers #if defined(__clang__) #define CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) - #if CLANG_VERSION < 34000 + #if CLANG_VERSION < 30400 #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers" #endif #elif defined(__GNUC__) #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) - #if GCC_VERSION < 49000 + #if GCC_VERSION < 40900 #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers" #endif #endif diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index cc4df5de..2d573258 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -56,12 +56,12 @@ SOFTWARE. // exclude unsupported compilers #if defined(__clang__) #define CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) - #if CLANG_VERSION < 34000 + #if CLANG_VERSION < 30400 #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers" #endif #elif defined(__GNUC__) #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) - #if GCC_VERSION < 49000 + #if GCC_VERSION < 40900 #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers" #endif #endif