From 8f7211a50f19726a0c3698112827d92993c1cc7f Mon Sep 17 00:00:00 2001 From: Benoit Blanchon Date: Fri, 10 Feb 2023 09:05:02 +0100 Subject: [PATCH] Remove `ARDUINOJSON_HAS_NULLPTR` (#1820) --- extras/tests/JsonVariant/nullptr.cpp | 4 ---- src/ArduinoJson/Configuration.hpp | 10 +--------- src/ArduinoJson/Variant/ConverterImpl.hpp | 4 ---- src/ArduinoJson/Variant/VariantCompare.hpp | 2 -- 4 files changed, 1 insertion(+), 19 deletions(-) diff --git a/extras/tests/JsonVariant/nullptr.cpp b/extras/tests/JsonVariant/nullptr.cpp index 02fa1a4c..e26d9306 100644 --- a/extras/tests/JsonVariant/nullptr.cpp +++ b/extras/tests/JsonVariant/nullptr.cpp @@ -2,10 +2,6 @@ #include -#if !ARDUINOJSON_HAS_NULLPTR -# error ARDUINOJSON_HAS_NULLPTR must be set to 1 -#endif - TEST_CASE("nullptr") { DynamicJsonDocument doc(4096); JsonVariant variant = doc.to(); diff --git a/src/ArduinoJson/Configuration.hpp b/src/ArduinoJson/Configuration.hpp index 374cf760..82cb4bb5 100644 --- a/src/ArduinoJson/Configuration.hpp +++ b/src/ArduinoJson/Configuration.hpp @@ -4,14 +4,6 @@ #pragma once -#ifndef ARDUINOJSON_HAS_NULLPTR -# if __cplusplus >= 201103L -# define ARDUINOJSON_HAS_NULLPTR 1 -# else -# define ARDUINOJSON_HAS_NULLPTR 0 -# endif -#endif - // Support std::istream and std::ostream #ifndef ARDUINOJSON_ENABLE_STD_STREAM # ifdef __has_include @@ -215,7 +207,7 @@ # endif #endif -#if ARDUINOJSON_HAS_NULLPTR && defined(nullptr) +#if defined(nullptr) # error nullptr is defined as a macro. Remove the faulty #define or #undef nullptr // See https://github.com/bblanchon/ArduinoJson/issues/1355 #endif diff --git a/src/ArduinoJson/Variant/ConverterImpl.hpp b/src/ArduinoJson/Variant/ConverterImpl.hpp index f74bcfee..0bdd88eb 100644 --- a/src/ArduinoJson/Variant/ConverterImpl.hpp +++ b/src/ArduinoJson/Variant/ConverterImpl.hpp @@ -181,8 +181,6 @@ struct Converter, } }; -#if ARDUINOJSON_HAS_NULLPTR - template <> struct Converter : private VariantAttorney { static void toJson(decltype(nullptr), JsonVariant dst) { @@ -197,8 +195,6 @@ struct Converter : private VariantAttorney { } }; -#endif - #if ARDUINOJSON_ENABLE_ARDUINO_STREAM class MemoryPoolPrint : public Print { diff --git a/src/ArduinoJson/Variant/VariantCompare.hpp b/src/ArduinoJson/Variant/VariantCompare.hpp index b6e7ea8c..bdd40d0c 100644 --- a/src/ArduinoJson/Variant/VariantCompare.hpp +++ b/src/ArduinoJson/Variant/VariantCompare.hpp @@ -75,12 +75,10 @@ struct NullComparer : ComparerBase { } }; -#if ARDUINOJSON_HAS_NULLPTR template <> struct Comparer : NullComparer { explicit Comparer(decltype(nullptr)) : NullComparer() {} }; -#endif struct ArrayComparer : ComparerBase { const CollectionData* _rhs;