diff --git a/CHANGELOG.md b/CHANGELOG.md index cb6afb8b..ebfded34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ HEAD * Fixed warning "unused variable" with GCC 4.4 (issue #912) * Fixed warning "maybe uninitialized" (issue #909) +* Added an clear message for `StaticJsonDocument`, `DynamicJsonDocument`... v5.13.4 ------- diff --git a/src/ArduinoJson.hpp b/src/ArduinoJson.hpp index 1626a062..3b683724 100644 --- a/src/ArduinoJson.hpp +++ b/src/ArduinoJson.hpp @@ -17,3 +17,5 @@ #include "ArduinoJson/JsonObjectImpl.hpp" #include "ArduinoJson/JsonVariantImpl.hpp" #include "ArduinoJson/Serialization/JsonSerializerImpl.hpp" + +#include "ArduinoJson/compatibility.hpp" diff --git a/src/ArduinoJson/compatibility.hpp b/src/ArduinoJson/compatibility.hpp new file mode 100644 index 00000000..646a4bb1 --- /dev/null +++ b/src/ArduinoJson/compatibility.hpp @@ -0,0 +1,31 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2019 +// MIT License +// +// clang-format off + +#ifdef __GNUC__ + +#define ARDUINOJSON_PRAGMA(x) _Pragma(#x) + +#define ARDUINOJSON_COMPILE_ERROR(msg) ARDUINOJSON_PRAGMA(GCC error msg) + +#define ARDUINOJSON_STRINGIFY(S) #S + +#define ARDUINOJSON_DEPRECATION_ERROR(X, Y) \ + ARDUINOJSON_COMPILE_ERROR(ARDUINOJSON_STRINGIFY(X is a Y from ArduinoJson 6 but version 5 is installed. Visit arduinojson.org to get more information.)) + +#define StaticJsonDocument ARDUINOJSON_DEPRECATION_ERROR(StaticJsonDocument, class) +#define DynamicJsonDocument ARDUINOJSON_DEPRECATION_ERROR(DynamicJsonDocument, class) +#define JsonDocument ARDUINOJSON_DEPRECATION_ERROR(JsonDocument, class) +#define DeserializationError ARDUINOJSON_DEPRECATION_ERROR(DeserializationError, class) +#define deserializeJson ARDUINOJSON_DEPRECATION_ERROR(deserializeJson, function) +#define deserializeMsgPack ARDUINOJSON_DEPRECATION_ERROR(deserializeMsgPack, function) +#define serializeJson ARDUINOJSON_DEPRECATION_ERROR(serializeJson, function) +#define serializeMsgPack ARDUINOJSON_DEPRECATION_ERROR(serializeMsgPack, function) +#define serializeJsonPretty ARDUINOJSON_DEPRECATION_ERROR(serializeJsonPretty, function) +#define measureMsgPack ARDUINOJSON_DEPRECATION_ERROR(measureMsgPack, function) +#define measureJson ARDUINOJSON_DEPRECATION_ERROR(measureJson, function) +#define measureJsonPretty ARDUINOJSON_DEPRECATION_ERROR(measureJsonPretty, function) + +#endif