mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 08:42:39 +01:00 
			
		
		
		
	Fixed warning "maybe uninitialized" (issue #909)
This commit is contained in:
		| @@ -5,6 +5,7 @@ HEAD | |||||||
| ---- | ---- | ||||||
|  |  | ||||||
| * Fixed warning "unused variable" with GCC 4.4 (issue #912) | * Fixed warning "unused variable" with GCC 4.4 (issue #912) | ||||||
|  | * Fixed warning "maybe uninitialized" (issue #909) | ||||||
|  |  | ||||||
| v5.13.4 | v5.13.4 | ||||||
| ------- | ------- | ||||||
|   | |||||||
| @@ -23,6 +23,7 @@ inline JsonVariant::JsonVariant(const JsonArray &array) { | |||||||
|     _content.asArray = const_cast<JsonArray *>(&array); |     _content.asArray = const_cast<JsonArray *>(&array); | ||||||
|   } else { |   } else { | ||||||
|     _type = Internals::JSON_UNDEFINED; |     _type = Internals::JSON_UNDEFINED; | ||||||
|  |     _content.asArray = 0;  // <- prevent warning 'maybe-uninitialized' | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -32,6 +33,7 @@ inline JsonVariant::JsonVariant(const JsonObject &object) { | |||||||
|     _content.asObject = const_cast<JsonObject *>(&object); |     _content.asObject = const_cast<JsonObject *>(&object); | ||||||
|   } else { |   } else { | ||||||
|     _type = Internals::JSON_UNDEFINED; |     _type = Internals::JSON_UNDEFINED; | ||||||
|  |     _content.asObject = 0;  // <- prevent warning 'maybe-uninitialized' | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -46,6 +46,12 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") | |||||||
| 	if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.6) | 	if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.6) | ||||||
| 		add_compile_options(-Wnoexcept) | 		add_compile_options(-Wnoexcept) | ||||||
| 	endif() | 	endif() | ||||||
|  |  | ||||||
|  | 	if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.7 AND  | ||||||
|  | 	   CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8) | ||||||
|  | 		# avoid false positive with GCC 4.7 | ||||||
|  | 		add_compile_options(-Wno-maybe-uninitialized) | ||||||
|  | 	endif() | ||||||
| endif() | endif() | ||||||
|  |  | ||||||
| if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") | if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user