forked from bblanchon/ArduinoJson
Renamed DEPRECATED to ARDUINOJSON_DEPRECATED
This commit is contained in:
@ -2,17 +2,11 @@
|
||||
// Copyright Benoit Blanchon 2014-2021
|
||||
// MIT License
|
||||
|
||||
#define ARDUINOJSON_DEPRECATED(msg) // nothing
|
||||
|
||||
#include <ArduinoJson.h>
|
||||
#include <catch.hpp>
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4996) // deprecation warning
|
||||
#endif
|
||||
|
||||
TEST_CASE("Deprecated features") {
|
||||
StaticJsonDocument<256> doc;
|
||||
const char* s = "hello";
|
||||
|
@ -72,7 +72,8 @@ class ElementProxy : public VariantOperators<ElementProxy<TArray> >,
|
||||
|
||||
template <typename T>
|
||||
FORCE_INLINE typename enable_if<is_same<T, char*>::value, const char*>::type
|
||||
DEPRECATED("Replace as<char*>() with as<const char*>()") as() const {
|
||||
ARDUINOJSON_DEPRECATED("Replace as<char*>() with as<const char*>()")
|
||||
as() const {
|
||||
return as<const char*>();
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,8 @@ class MemberProxy : public VariantOperators<MemberProxy<TObject, TStringRef> >,
|
||||
|
||||
template <typename T>
|
||||
FORCE_INLINE typename enable_if<is_same<T, char *>::value, const char *>::type
|
||||
DEPRECATED("Replace as<char*>() with as<const char*>()") as() const {
|
||||
ARDUINOJSON_DEPRECATED("Replace as<char*>() with as<const char*>()")
|
||||
as() const {
|
||||
return as<const char *>();
|
||||
}
|
||||
|
||||
|
@ -8,23 +8,32 @@
|
||||
|
||||
#define FORCE_INLINE // __forceinline causes C4714 when returning std::string
|
||||
#define NO_INLINE __declspec(noinline)
|
||||
#define DEPRECATED(msg) __declspec(deprecated(msg))
|
||||
|
||||
#ifndef ARDUINOJSON_DEPRECATED
|
||||
#define ARDUINOJSON_DEPRECATED(msg) __declspec(deprecated(msg))
|
||||
#endif
|
||||
|
||||
#elif defined(__GNUC__) // GCC or Clang
|
||||
|
||||
#define FORCE_INLINE __attribute__((always_inline))
|
||||
#define NO_INLINE __attribute__((noinline))
|
||||
|
||||
#ifndef ARDUINOJSON_DEPRECATED
|
||||
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
|
||||
#define DEPRECATED(msg) __attribute__((deprecated(msg)))
|
||||
#define ARDUINOJSON_DEPRECATED(msg) __attribute__((deprecated(msg)))
|
||||
#else
|
||||
#define DEPRECATED(msg) __attribute__((deprecated))
|
||||
#define ARDUINOJSON_DEPRECATED(msg) __attribute__((deprecated))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#else // Other compilers
|
||||
|
||||
#define FORCE_INLINE
|
||||
#define NO_INLINE
|
||||
#define DEPRECATED(msg)
|
||||
|
||||
#ifndef ARDUINOJSON_DEPRECATED
|
||||
#define ARDUINOJSON_DEPRECATED(msg)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -101,7 +101,8 @@ class VariantRef : public VariantRefBase<VariantData>,
|
||||
|
||||
template <typename T>
|
||||
FORCE_INLINE typename enable_if<is_same<T, char *>::value, const char *>::type
|
||||
DEPRECATED("Replace as<char*>() with as<const char*>()") as() const {
|
||||
ARDUINOJSON_DEPRECATED("Replace as<char*>() with as<const char*>()")
|
||||
as() const {
|
||||
return as<const char *>();
|
||||
}
|
||||
|
||||
@ -218,7 +219,8 @@ class VariantConstRef : public VariantRefBase<const VariantData>,
|
||||
|
||||
template <typename T>
|
||||
FORCE_INLINE typename enable_if<is_same<T, char *>::value, const char *>::type
|
||||
DEPRECATED("Replace as<char*>() with as<const char*>()") as() const {
|
||||
ARDUINOJSON_DEPRECATED("Replace as<char*>() with as<const char*>()")
|
||||
as() const {
|
||||
return as<const char *>();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user