mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 16:14:11 +01:00 
			
		
		
		
	Remove ARDUINOJSON_HAS_LONG_LONG (#1820)
				
					
				
			This commit is contained in:
		| @@ -9,10 +9,6 @@ | |||||||
| #  error This test requires sizeof(long) < 8 | #  error This test requires sizeof(long) < 8 | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #if !ARDUINOJSON_HAS_LONG_LONG |  | ||||||
| #  error This test requires C++11 |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| int main() { | int main() { | ||||||
|   DynamicJsonDocument doc(1024); |   DynamicJsonDocument doc(1024); | ||||||
|   doc["dummy"] = static_cast<long long>(42); |   doc["dummy"] = static_cast<long long>(42); | ||||||
|   | |||||||
| @@ -99,7 +99,6 @@ TEST_CASE("canConvertNumber<TOut, TIn>()") { | |||||||
|     CHECK(canConvertNumber<uint32_t, float>(4.294967296e+9f) == false); |     CHECK(canConvertNumber<uint32_t, float>(4.294967296e+9f) == false); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| #if ARDUINOJSON_HAS_LONG_LONG |  | ||||||
|   SECTION("float -> int64_t") { |   SECTION("float -> int64_t") { | ||||||
|     CHECK(canConvertNumber<int64_t, float>(0) == true); |     CHECK(canConvertNumber<int64_t, float>(0) == true); | ||||||
|     CHECK(canConvertNumber<int64_t, float>(-9.22337204e+18f) == true); |     CHECK(canConvertNumber<int64_t, float>(-9.22337204e+18f) == true); | ||||||
| @@ -129,5 +128,4 @@ TEST_CASE("canConvertNumber<TOut, TIn>()") { | |||||||
|     CHECK(canConvertNumber<uint64_t, double>(1.844674407370955166e+19) == |     CHECK(canConvertNumber<uint64_t, double>(1.844674407370955166e+19) == | ||||||
|           false); |           false); | ||||||
|   } |   } | ||||||
| #endif |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -5,10 +5,8 @@ | |||||||
| #pragma once | #pragma once | ||||||
|  |  | ||||||
| #if __cplusplus >= 201103L | #if __cplusplus >= 201103L | ||||||
| #  define ARDUINOJSON_HAS_LONG_LONG 1 |  | ||||||
| #  define ARDUINOJSON_HAS_RVALUE_REFERENCES 1 | #  define ARDUINOJSON_HAS_RVALUE_REFERENCES 1 | ||||||
| #else | #else | ||||||
| #  define ARDUINOJSON_HAS_LONG_LONG 0 |  | ||||||
| #  define ARDUINOJSON_HAS_RVALUE_REFERENCES 0 | #  define ARDUINOJSON_HAS_RVALUE_REFERENCES 0 | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| @@ -77,8 +75,7 @@ | |||||||
|  |  | ||||||
| // Store integral values with long (0) or long long (1) | // Store integral values with long (0) or long long (1) | ||||||
| #ifndef ARDUINOJSON_USE_LONG_LONG | #ifndef ARDUINOJSON_USE_LONG_LONG | ||||||
| #  if ARDUINOJSON_HAS_LONG_LONG && defined(__SIZEOF_POINTER__) && \ | #  if defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ >= 4 || \ | ||||||
|           __SIZEOF_POINTER__ >= 4 ||                              \ |  | ||||||
|       defined(_MSC_VER) |       defined(_MSC_VER) | ||||||
| #    define ARDUINOJSON_USE_LONG_LONG 1 | #    define ARDUINOJSON_USE_LONG_LONG 1 | ||||||
| #  endif | #  endif | ||||||
|   | |||||||
| @@ -21,12 +21,8 @@ typedef unsigned long JsonUInt; | |||||||
|  |  | ||||||
| }  // namespace ARDUINOJSON_NAMESPACE | }  // namespace ARDUINOJSON_NAMESPACE | ||||||
|  |  | ||||||
| #if ARDUINOJSON_HAS_LONG_LONG && !ARDUINOJSON_USE_LONG_LONG |  | ||||||
| #define ARDUINOJSON_ASSERT_INTEGER_TYPE_IS_SUPPORTED(T)                  \ | #define ARDUINOJSON_ASSERT_INTEGER_TYPE_IS_SUPPORTED(T)                  \ | ||||||
|   static_assert(sizeof(T) <= sizeof(ARDUINOJSON_NAMESPACE::JsonInteger), \ |   static_assert(sizeof(T) <= sizeof(ARDUINOJSON_NAMESPACE::JsonInteger), \ | ||||||
|                 "To use 64-bit integers with ArduinoJson, you must set " \ |                 "To use 64-bit integers with ArduinoJson, you must set " \ | ||||||
|                 "ARDUINOJSON_USE_LONG_LONG to 1. See "                   \ |                 "ARDUINOJSON_USE_LONG_LONG to 1. See "                   \ | ||||||
|                 "https://arduinojson.org/v6/api/config/use_long_long/"); |                 "https://arduinojson.org/v6/api/config/use_long_long/"); | ||||||
| #else |  | ||||||
| #  define ARDUINOJSON_ASSERT_INTEGER_TYPE_IS_SUPPORTED(T) |  | ||||||
| #endif |  | ||||||
|   | |||||||
| @@ -23,10 +23,8 @@ struct is_integral : integral_constant<bool, | |||||||
|     is_same<typename remove_cv<T>::type, unsigned int>::value || |     is_same<typename remove_cv<T>::type, unsigned int>::value || | ||||||
|     is_same<typename remove_cv<T>::type, signed long>::value || |     is_same<typename remove_cv<T>::type, signed long>::value || | ||||||
|     is_same<typename remove_cv<T>::type, unsigned long>::value || |     is_same<typename remove_cv<T>::type, unsigned long>::value || | ||||||
| #if ARDUINOJSON_HAS_LONG_LONG |  | ||||||
|     is_same<typename remove_cv<T>::type, signed long long>::value || |     is_same<typename remove_cv<T>::type, signed long long>::value || | ||||||
|     is_same<typename remove_cv<T>::type, unsigned long long>::value || |     is_same<typename remove_cv<T>::type, unsigned long long>::value || | ||||||
| #endif |  | ||||||
|     is_same<typename remove_cv<T>::type, char>::value || |     is_same<typename remove_cv<T>::type, char>::value || | ||||||
|     is_same<typename remove_cv<T>::type, bool>::value> {}; |     is_same<typename remove_cv<T>::type, bool>::value> {}; | ||||||
| // clang-format on | // clang-format on | ||||||
|   | |||||||
| @@ -18,9 +18,7 @@ struct is_signed : integral_constant<bool, | |||||||
|     is_same<typename remove_cv<T>::type, signed short>::value || |     is_same<typename remove_cv<T>::type, signed short>::value || | ||||||
|     is_same<typename remove_cv<T>::type, signed int>::value || |     is_same<typename remove_cv<T>::type, signed int>::value || | ||||||
|     is_same<typename remove_cv<T>::type, signed long>::value || |     is_same<typename remove_cv<T>::type, signed long>::value || | ||||||
| #if ARDUINOJSON_HAS_LONG_LONG |  | ||||||
|     is_same<typename remove_cv<T>::type, signed long long>::value || |     is_same<typename remove_cv<T>::type, signed long long>::value || | ||||||
| #endif |  | ||||||
|     is_same<typename remove_cv<T>::type, float>::value || |     is_same<typename remove_cv<T>::type, float>::value || | ||||||
|     is_same<typename remove_cv<T>::type, double>::value> {}; |     is_same<typename remove_cv<T>::type, double>::value> {}; | ||||||
| // clang-format on | // clang-format on | ||||||
|   | |||||||
| @@ -17,9 +17,7 @@ struct is_unsigned : integral_constant<bool, | |||||||
|     is_same<typename remove_cv<T>::type, unsigned short>::value || |     is_same<typename remove_cv<T>::type, unsigned short>::value || | ||||||
|     is_same<typename remove_cv<T>::type, unsigned int>::value || |     is_same<typename remove_cv<T>::type, unsigned int>::value || | ||||||
|     is_same<typename remove_cv<T>::type, unsigned long>::value || |     is_same<typename remove_cv<T>::type, unsigned long>::value || | ||||||
| #if ARDUINOJSON_HAS_LONG_LONG |  | ||||||
|     is_same<typename remove_cv<T>::type, unsigned long long>::value || |     is_same<typename remove_cv<T>::type, unsigned long long>::value || | ||||||
| #endif |  | ||||||
|     is_same<typename remove_cv<T>::type, bool>::value> {}; |     is_same<typename remove_cv<T>::type, bool>::value> {}; | ||||||
| // clang-format on | // clang-format on | ||||||
| }  // namespace ARDUINOJSON_NAMESPACE | }  // namespace ARDUINOJSON_NAMESPACE | ||||||
|   | |||||||
| @@ -33,10 +33,8 @@ struct make_unsigned<signed long> : type_identity<unsigned long> {}; | |||||||
| template <> | template <> | ||||||
| struct make_unsigned<unsigned long> : type_identity<unsigned long> {}; | struct make_unsigned<unsigned long> : type_identity<unsigned long> {}; | ||||||
|  |  | ||||||
| #if ARDUINOJSON_HAS_LONG_LONG |  | ||||||
| template <> | template <> | ||||||
| struct make_unsigned<signed long long> : type_identity<unsigned long long> {}; | struct make_unsigned<signed long long> : type_identity<unsigned long long> {}; | ||||||
| template <> | template <> | ||||||
| struct make_unsigned<unsigned long long> : type_identity<unsigned long long> {}; | struct make_unsigned<unsigned long long> : type_identity<unsigned long long> {}; | ||||||
| #endif |  | ||||||
| }  // namespace ARDUINOJSON_NAMESPACE | }  // namespace ARDUINOJSON_NAMESPACE | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user