forked from bblanchon/ArduinoJson
Add stubs for JSON_ARRAY_SIZE
, JSON_OBJECT_SIZE
, and JSON_STRING_SIZE
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
|
||||
add_compile_options(
|
||||
-Wno-deprecated-declarations
|
||||
-w
|
||||
)
|
||||
endif()
|
||||
|
||||
@ -20,6 +20,7 @@ add_executable(DeprecatedTests
|
||||
createNestedObject.cpp
|
||||
BasicJsonDocument.cpp
|
||||
DynamicJsonDocument.cpp
|
||||
macros.cpp
|
||||
memoryUsage.cpp
|
||||
shallowCopy.cpp
|
||||
StaticJsonDocument.cpp
|
||||
|
18
extras/tests/Deprecated/macros.cpp
Normal file
18
extras/tests/Deprecated/macros.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
// ArduinoJson - https://arduinojson.org
|
||||
// Copyright © 2014-2023, Benoit BLANCHON
|
||||
// MIT License
|
||||
|
||||
#include <ArduinoJson.h>
|
||||
#include <catch.hpp>
|
||||
|
||||
TEST_CASE("JSON_ARRAY_SIZE") {
|
||||
REQUIRE(JSON_ARRAY_SIZE(10) == ArduinoJson::detail::sizeofArray(10));
|
||||
}
|
||||
|
||||
TEST_CASE("JSON_OBJECT_SIZE") {
|
||||
REQUIRE(JSON_OBJECT_SIZE(10) == ArduinoJson::detail::sizeofObject(10));
|
||||
}
|
||||
|
||||
TEST_CASE("JSON_STRING_SIZE") {
|
||||
REQUIRE(JSON_STRING_SIZE(10) == ArduinoJson::detail::sizeofString(10));
|
||||
}
|
@ -24,6 +24,26 @@
|
||||
|
||||
#define ARDUINOJSON_NAMESPACE _Pragma ("GCC warning \"ARDUINOJSON_NAMESPACE is deprecated, use ArduinoJson instead\"") ArduinoJson
|
||||
|
||||
// DEPRECATED: you don't need to compute the size anymore
|
||||
#define JSON_ARRAY_SIZE(N) _Pragma ("GCC warning \"JSON_ARRAY_SIZE is deprecated, you don't need to compute the size anymore\"") (ArduinoJson::detail::sizeofArray(N))
|
||||
|
||||
// DEPRECATED: you don't need to compute the size anymore
|
||||
#define JSON_OBJECT_SIZE(N) _Pragma ("GCC warning \"JSON_OBJECT_SIZE is deprecated, you don't need to compute the size anymore\"") (ArduinoJson::detail::sizeofObject(N))
|
||||
|
||||
// DEPRECATED: you don't need to compute the size anymore
|
||||
#define JSON_STRING_SIZE(N) _Pragma ("GCC warning \"JSON_STRING_SIZE is deprecated, you don't need to compute the size anymore\"") (ArduinoJson::detail::sizeofString(N))
|
||||
|
||||
#else
|
||||
|
||||
// DEPRECATED: you don't need to compute the size anymore
|
||||
#define JSON_ARRAY_SIZE(N) (ArduinoJson::detail::sizeofArray(N))
|
||||
|
||||
// DEPRECATED: you don't need to compute the size anymore
|
||||
#define JSON_OBJECT_SIZE(N) (ArduinoJson::detail::sizeofObject(N))
|
||||
|
||||
// DEPRECATED: you don't need to compute the size anymore
|
||||
#define JSON_STRING_SIZE(N) (ArduinoJson::detail::sizeofString(N))
|
||||
|
||||
#endif
|
||||
|
||||
// clang-format on
|
||||
|
Reference in New Issue
Block a user