mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 16:14:11 +01:00 
			
		
		
		
	Avoid Arduino.h when all its features are disabled (fixes #1692)
				
					
				
			This commit is contained in:
		
				
					committed by
					
						 Benoit Blanchon
						Benoit Blanchon
					
				
			
			
				
	
			
			
			
						parent
						
							ada1f2a894
						
					
				
				
					commit
					ec7ffa20f2
				
			| @@ -21,6 +21,8 @@ HEAD | |||||||
| * Fix inconsistent pool capacity between `BasicJsonDocument`'s copy and move assignments | * Fix inconsistent pool capacity between `BasicJsonDocument`'s copy and move assignments | ||||||
| * Fix return type of `StaticJsonDocument::operator=` | * Fix return type of `StaticJsonDocument::operator=` | ||||||
| * Avoid pool reallocation in `BasicJsonDocument`'s copy assignment if capacity is the same | * Avoid pool reallocation in `BasicJsonDocument`'s copy assignment if capacity is the same | ||||||
|  | * Avoid including `Arduino.h` when all its features are disabled (issue #1692, PR #1693 by @paulocsanz) | ||||||
|  |  | ||||||
|  |  | ||||||
| v6.18.5 (2021-09-28) | v6.18.5 (2021-09-28) | ||||||
| ------- | ------- | ||||||
|   | |||||||
| @@ -7,3 +7,5 @@ | |||||||
| #include "api/Print.h" | #include "api/Print.h" | ||||||
| #include "api/Stream.h" | #include "api/Stream.h" | ||||||
| #include "api/String.h" | #include "api/String.h" | ||||||
|  |  | ||||||
|  | #define ARDUINO_H_INCLUDED 1 | ||||||
|   | |||||||
| @@ -8,6 +8,7 @@ add_executable(MiscTests | |||||||
| 	deprecated.cpp | 	deprecated.cpp | ||||||
| 	FloatParts.cpp | 	FloatParts.cpp | ||||||
| 	JsonString.cpp | 	JsonString.cpp | ||||||
|  | 	NoArduinoHeader.cpp | ||||||
| 	printable.cpp | 	printable.cpp | ||||||
| 	Readers.cpp | 	Readers.cpp | ||||||
| 	StringAdapters.cpp | 	StringAdapters.cpp | ||||||
|   | |||||||
							
								
								
									
										20
									
								
								extras/tests/Misc/NoArduinoHeader.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								extras/tests/Misc/NoArduinoHeader.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | |||||||
|  | // ArduinoJson - https://arduinojson.org | ||||||
|  | // Copyright Benoit Blanchon 2014-2021 | ||||||
|  | // MIT License | ||||||
|  |  | ||||||
|  | #define ARDUINO 1 | ||||||
|  | #define ARDUINOJSON_ENABLE_PROGMEM 0 | ||||||
|  | #define ARDUINOJSON_ENABLE_ARDUINO_STRING 0 | ||||||
|  | #define ARDUINOJSON_ENABLE_ARDUINO_STREAM 0 | ||||||
|  | #define ARDUINOJSON_ENABLE_ARDUINO_PRINT 0 | ||||||
|  | #include <ArduinoJson.h> | ||||||
|  |  | ||||||
|  | #include <catch.hpp> | ||||||
|  |  | ||||||
|  | TEST_CASE("Arduino.h") { | ||||||
|  | #ifdef ARDUINO_H_INCLUDED | ||||||
|  |   FAIL("Arduino.h should not be included"); | ||||||
|  | #else | ||||||
|  |   INFO("Arduino.h not included"); | ||||||
|  | #endif | ||||||
|  | } | ||||||
| @@ -116,8 +116,6 @@ | |||||||
|  |  | ||||||
| #ifdef ARDUINO | #ifdef ARDUINO | ||||||
|  |  | ||||||
| #  include <Arduino.h> |  | ||||||
|  |  | ||||||
| // Enable support for Arduino's String class | // Enable support for Arduino's String class | ||||||
| #  ifndef ARDUINOJSON_ENABLE_ARDUINO_STRING | #  ifndef ARDUINOJSON_ENABLE_ARDUINO_STRING | ||||||
| #    define ARDUINOJSON_ENABLE_ARDUINO_STRING 1 | #    define ARDUINOJSON_ENABLE_ARDUINO_STRING 1 | ||||||
|   | |||||||
| @@ -4,6 +4,8 @@ | |||||||
|  |  | ||||||
| #pragma once | #pragma once | ||||||
|  |  | ||||||
|  | #include <Arduino.h> | ||||||
|  |  | ||||||
| namespace ARDUINOJSON_NAMESPACE { | namespace ARDUINOJSON_NAMESPACE { | ||||||
|  |  | ||||||
| template <typename TSource> | template <typename TSource> | ||||||
|   | |||||||
| @@ -4,6 +4,8 @@ | |||||||
|  |  | ||||||
| #pragma once | #pragma once | ||||||
|  |  | ||||||
|  | #include <Arduino.h> | ||||||
|  |  | ||||||
| namespace ARDUINOJSON_NAMESPACE { | namespace ARDUINOJSON_NAMESPACE { | ||||||
|  |  | ||||||
| template <> | template <> | ||||||
|   | |||||||
| @@ -4,6 +4,8 @@ | |||||||
|  |  | ||||||
| #pragma once | #pragma once | ||||||
|  |  | ||||||
|  | #include <Arduino.h> | ||||||
|  |  | ||||||
| #include <ArduinoJson/Configuration.hpp> | #include <ArduinoJson/Configuration.hpp> | ||||||
| #include <ArduinoJson/Namespace.hpp> | #include <ArduinoJson/Namespace.hpp> | ||||||
| #include <ArduinoJson/Polyfills/assert.hpp> | #include <ArduinoJson/Polyfills/assert.hpp> | ||||||
|   | |||||||
| @@ -5,6 +5,7 @@ | |||||||
| #pragma once | #pragma once | ||||||
|  |  | ||||||
| #include <ArduinoJson/Namespace.hpp> | #include <ArduinoJson/Namespace.hpp> | ||||||
|  | #include <ArduinoJson/Polyfills/pgmspace.hpp> | ||||||
| #include <ArduinoJson/Polyfills/type_traits.hpp> | #include <ArduinoJson/Polyfills/type_traits.hpp> | ||||||
|  |  | ||||||
| namespace ARDUINOJSON_NAMESPACE { | namespace ARDUINOJSON_NAMESPACE { | ||||||
|   | |||||||
| @@ -4,6 +4,8 @@ | |||||||
|  |  | ||||||
| #pragma once | #pragma once | ||||||
|  |  | ||||||
|  | #include <Arduino.h> | ||||||
|  |  | ||||||
| namespace ARDUINOJSON_NAMESPACE { | namespace ARDUINOJSON_NAMESPACE { | ||||||
|  |  | ||||||
| template <typename TDestination> | template <typename TDestination> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user