mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 08:42:39 +01:00 
			
		
		
		
	Remove ARDUINOJSON_EMBEDDED_MODE
				
					
				
			This commit is contained in:
		
							
								
								
									
										6
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.github/workflows/ci.yml
									
									
									
									
										vendored
									
									
								
							| @@ -135,11 +135,11 @@ jobs: | ||||
|       - name: Checkout | ||||
|         uses: actions/checkout@v2 | ||||
|       - name: GCC 32-bit | ||||
|         run: g++ -std=c++11 -m32 -Isrc extras/conf_test/x86-linux.cpp | ||||
|         run: g++ -std=c++11 -m32 -Isrc extras/conf_test/x86.cpp | ||||
|       - name: GCC 64-bit | ||||
|         run: g++ -std=c++11 -m64 -Isrc extras/conf_test/x64.cpp | ||||
|       - name: Clang 32-bit | ||||
|         run: clang++ -std=c++11 -m32 -Isrc extras/conf_test/x86-linux.cpp | ||||
|         run: clang++ -std=c++11 -m32 -Isrc extras/conf_test/x86.cpp | ||||
|       - name: Clang 64-bit | ||||
|         run: clang++ -std=c++11 -m64 -Isrc extras/conf_test/x64.cpp | ||||
|  | ||||
| @@ -153,7 +153,7 @@ jobs: | ||||
|       - name: 32-bit | ||||
|         run: | | ||||
|           call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars32.bat" | ||||
|           cl /Isrc extras/conf_test/x86-windows.cpp | ||||
|           cl /Isrc extras/conf_test/x86.cpp | ||||
|         shell: cmd | ||||
|       - name: 64-bit | ||||
|         run: | | ||||
|   | ||||
| @@ -1,6 +1,12 @@ | ||||
| ArduinoJson: change log | ||||
| ======================= | ||||
|  | ||||
| HEAD | ||||
| ---- | ||||
|  | ||||
| * Remove `ARDUINOJSON_EMBEDDED_MODE` and assume we run on an embedded platform.   | ||||
|   Dependent settings (like `ARDUINOJSON_DEFAULT_NESTING_LIMIT`) must be set individually. | ||||
|  | ||||
| v6.18.5 (2021-09-28) | ||||
| ------- | ||||
|  | ||||
|   | ||||
| @@ -7,7 +7,6 @@ cmake_minimum_required(VERSION 3.3) | ||||
| if(ESP_PLATFORM) | ||||
|    # Build ArduinoJson as an ESP-IDF component | ||||
|    idf_component_register(INCLUDE_DIRS src) | ||||
|    target_compile_definitions(${COMPONENT_LIB} INTERFACE ARDUINOJSON_EMBEDDED_MODE=1) | ||||
|    return() | ||||
| endif() | ||||
|  | ||||
|   | ||||
| @@ -1,15 +0,0 @@ | ||||
| #include <ArduinoJson.h> | ||||
|  | ||||
| static_assert(ARDUINOJSON_USE_LONG_LONG == 1, "ARDUINOJSON_USE_LONG_LONG"); | ||||
|  | ||||
| static_assert(ARDUINOJSON_SLOT_OFFSET_SIZE == 4, | ||||
|               "ARDUINOJSON_SLOT_OFFSET_SIZE"); | ||||
|  | ||||
| static_assert(ARDUINOJSON_LITTLE_ENDIAN == 1, "ARDUINOJSON_LITTLE_ENDIAN"); | ||||
|  | ||||
| static_assert(ARDUINOJSON_USE_DOUBLE == 1, "ARDUINOJSON_USE_DOUBLE"); | ||||
|  | ||||
| static_assert(sizeof(ARDUINOJSON_NAMESPACE::VariantSlot) == 24, | ||||
|               "sizeof(VariantSlot)"); | ||||
|  | ||||
| int main() {} | ||||
| @@ -2,14 +2,14 @@ | ||||
| 
 | ||||
| static_assert(ARDUINOJSON_USE_LONG_LONG == 1, "ARDUINOJSON_USE_LONG_LONG"); | ||||
| 
 | ||||
| static_assert(ARDUINOJSON_SLOT_OFFSET_SIZE == 4, | ||||
| static_assert(ARDUINOJSON_SLOT_OFFSET_SIZE == 2, | ||||
|               "ARDUINOJSON_SLOT_OFFSET_SIZE"); | ||||
| 
 | ||||
| static_assert(ARDUINOJSON_LITTLE_ENDIAN == 1, "ARDUINOJSON_LITTLE_ENDIAN"); | ||||
| 
 | ||||
| static_assert(ARDUINOJSON_USE_DOUBLE == 1, "ARDUINOJSON_USE_DOUBLE"); | ||||
| 
 | ||||
| static_assert(sizeof(ARDUINOJSON_NAMESPACE::VariantSlot) == 20, | ||||
| static_assert(sizeof(ARDUINOJSON_NAMESPACE::VariantSlot) == 16, | ||||
|               "sizeof(VariantSlot)"); | ||||
| 
 | ||||
| int main() {} | ||||
| @@ -26,23 +26,9 @@ | ||||
| #  define ARDUINOJSON_HAS_INT64 0 | ||||
| #endif | ||||
|  | ||||
| // Small or big machine? | ||||
| #ifndef ARDUINOJSON_EMBEDDED_MODE | ||||
| #  if defined(ARDUINO)                /* Arduino*/                 \ | ||||
|       || defined(__IAR_SYSTEMS_ICC__) /* IAR Embedded Workbench */ \ | ||||
|       || defined(__XC)                /* MPLAB XC compiler */      \ | ||||
|       || defined(__ARMCC_VERSION)     /* Keil ARM Compiler */      \ | ||||
|       || defined(__NIOS2__)           /* Altera Nios II EDS */     \ | ||||
|       || defined(__AVR)               /* Atmel AVR8/GNU C Compiler */ | ||||
| #    define ARDUINOJSON_EMBEDDED_MODE 1 | ||||
| #  else | ||||
| #    define ARDUINOJSON_EMBEDDED_MODE 0 | ||||
| #  endif | ||||
| #endif | ||||
|  | ||||
| // Auto enable std::stream if the right headers are here and no conflicting | ||||
| // macro is defined | ||||
| #if !defined(ARDUINOJSON_ENABLE_STD_STREAM) && defined(__has_include) | ||||
| // Support std::istream and std::ostream | ||||
| #ifndef ARDUINOJSON_ENABLE_STD_STREAM | ||||
| #  ifdef __has_include | ||||
| #    if __has_include(<istream>) && \ | ||||
|     __has_include(<ostream>) && \ | ||||
|     !defined(min) && \ | ||||
| @@ -51,105 +37,75 @@ | ||||
| #    else | ||||
| #      define ARDUINOJSON_ENABLE_STD_STREAM 0 | ||||
| #    endif | ||||
| #  else | ||||
| #    ifdef ARDUINO | ||||
| #      define ARDUINOJSON_ENABLE_STD_STREAM 0 | ||||
| #    else | ||||
| #      define ARDUINOJSON_ENABLE_STD_STREAM 1 | ||||
| #    endif | ||||
| #  endif | ||||
| #endif | ||||
|  | ||||
| // Auto enable std::string if the right header is here and no conflicting | ||||
| // macro is defined | ||||
| #if !defined(ARDUINOJSON_ENABLE_STD_STRING) && defined(__has_include) | ||||
| // Support std::string | ||||
| #ifndef ARDUINOJSON_ENABLE_STD_STRING | ||||
| #  ifdef __has_include | ||||
| #    if __has_include(<string>) && !defined(min) && !defined(max) | ||||
| #      define ARDUINOJSON_ENABLE_STD_STRING 1 | ||||
| #    else | ||||
| #      define ARDUINOJSON_ENABLE_STD_STRING 0 | ||||
| #    endif | ||||
| #  else | ||||
| #    ifdef ARDUINO | ||||
| #      define ARDUINOJSON_ENABLE_STD_STRING 0 | ||||
| #    else | ||||
| #      define ARDUINOJSON_ENABLE_STD_STRING 1 | ||||
| #    endif | ||||
| #  endif | ||||
| #endif | ||||
|  | ||||
| // Support for std::string_view | ||||
| #ifndef ARDUINOJSON_ENABLE_STRING_VIEW | ||||
| #  ifdef __has_include | ||||
| #    if __has_include(<string_view>) && __cplusplus >= 201703L | ||||
| #      define ARDUINOJSON_ENABLE_STRING_VIEW 1 | ||||
| #    endif | ||||
| #  endif | ||||
| #endif | ||||
| #ifndef ARDUINOJSON_ENABLE_STRING_VIEW | ||||
| #    else | ||||
| #      define ARDUINOJSON_ENABLE_STRING_VIEW 0 | ||||
| #    endif | ||||
| #  else | ||||
| #    define ARDUINOJSON_ENABLE_STRING_VIEW 0 | ||||
| #  endif | ||||
| #endif | ||||
|  | ||||
| #if ARDUINOJSON_EMBEDDED_MODE | ||||
|  | ||||
| // Store floats by default to reduce the memory usage (issue #134) | ||||
| #  ifndef ARDUINOJSON_USE_DOUBLE | ||||
| // Store floating-point values with float (0) or double (1) | ||||
| #ifndef ARDUINOJSON_USE_DOUBLE | ||||
| #  define ARDUINOJSON_USE_DOUBLE 0 | ||||
| #  endif | ||||
| #endif | ||||
|  | ||||
| // Store longs by default, because they usually match the size of a float. | ||||
| #  ifndef ARDUINOJSON_USE_LONG_LONG | ||||
| // Store integral values with long (0) or long long (1) | ||||
| #ifndef ARDUINOJSON_USE_LONG_LONG | ||||
| #  define ARDUINOJSON_USE_LONG_LONG 0 | ||||
| #  endif | ||||
|  | ||||
| // Embedded systems usually don't have std::string | ||||
| #  ifndef ARDUINOJSON_ENABLE_STD_STRING | ||||
| #    define ARDUINOJSON_ENABLE_STD_STRING 0 | ||||
| #  endif | ||||
|  | ||||
| // Embedded systems usually don't have std::stream | ||||
| #  ifndef ARDUINOJSON_ENABLE_STD_STREAM | ||||
| #    define ARDUINOJSON_ENABLE_STD_STREAM 0 | ||||
| #  endif | ||||
| #endif | ||||
|  | ||||
| // Limit nesting as the stack is likely to be small | ||||
| #  ifndef ARDUINOJSON_DEFAULT_NESTING_LIMIT | ||||
| #ifndef ARDUINOJSON_DEFAULT_NESTING_LIMIT | ||||
| #  define ARDUINOJSON_DEFAULT_NESTING_LIMIT 10 | ||||
| #  endif | ||||
| #endif | ||||
|  | ||||
| // Number of bits to store the pointer to next node | ||||
| // (saves RAM but limits the number of values in a document) | ||||
| #  ifndef ARDUINOJSON_SLOT_OFFSET_SIZE | ||||
| #    if defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ == 2 | ||||
| #ifndef ARDUINOJSON_SLOT_OFFSET_SIZE | ||||
| #  if defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ <= 2 | ||||
| // Address space == 16-bit => max 127 values | ||||
| #    define ARDUINOJSON_SLOT_OFFSET_SIZE 1 | ||||
| #  elif defined(__SIZEOF_POINTER__) && __SIZEOF_POINTER__ >= 8 || \ | ||||
|       defined(_WIN64) && _WIN64 | ||||
| // Address space == 64-bit => max 2147483647 values | ||||
| #    define ARDUINOJSON_SLOT_OFFSET_SIZE 4 | ||||
| #  else | ||||
| // Address space > 16-bit => max 32767 values | ||||
| // Address space == 32-bit => max 32767 values | ||||
| #    define ARDUINOJSON_SLOT_OFFSET_SIZE 2 | ||||
| #  endif | ||||
| #  endif | ||||
|  | ||||
| #else  // ARDUINOJSON_EMBEDDED_MODE | ||||
|  | ||||
| // On a computer we have plenty of memory so we can use doubles | ||||
| #  ifndef ARDUINOJSON_USE_DOUBLE | ||||
| #    define ARDUINOJSON_USE_DOUBLE 1 | ||||
| #  endif | ||||
|  | ||||
| // Use long long when available | ||||
| #  ifndef ARDUINOJSON_USE_LONG_LONG | ||||
| #    if ARDUINOJSON_HAS_LONG_LONG || ARDUINOJSON_HAS_INT64 | ||||
| #      define ARDUINOJSON_USE_LONG_LONG 1 | ||||
| #    else | ||||
| #      define ARDUINOJSON_USE_LONG_LONG 0 | ||||
| #    endif | ||||
| #  endif | ||||
|  | ||||
| // On a computer, we can use std::string | ||||
| #  ifndef ARDUINOJSON_ENABLE_STD_STRING | ||||
| #    define ARDUINOJSON_ENABLE_STD_STRING 1 | ||||
| #  endif | ||||
|  | ||||
| // On a computer, we can assume std::stream | ||||
| #  ifndef ARDUINOJSON_ENABLE_STD_STREAM | ||||
| #    define ARDUINOJSON_ENABLE_STD_STREAM 1 | ||||
| #  endif | ||||
|  | ||||
| // On a computer, the stack is large so we can increase nesting limit | ||||
| #  ifndef ARDUINOJSON_DEFAULT_NESTING_LIMIT | ||||
| #    define ARDUINOJSON_DEFAULT_NESTING_LIMIT 50 | ||||
| #  endif | ||||
|  | ||||
| // Number of bits to store the pointer to next node | ||||
| #  ifndef ARDUINOJSON_SLOT_OFFSET_SIZE | ||||
| #    define ARDUINOJSON_SLOT_OFFSET_SIZE 4 | ||||
| #  endif | ||||
|  | ||||
| #endif  // ARDUINOJSON_EMBEDDED_MODE | ||||
| #endif | ||||
|  | ||||
| #ifdef ARDUINO | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user