mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-29 18:27:37 +02: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 "maybe uninitialized" (issue #909)
|
||||
|
||||
v5.13.4
|
||||
-------
|
||||
|
@ -23,6 +23,7 @@ inline JsonVariant::JsonVariant(const JsonArray &array) {
|
||||
_content.asArray = const_cast<JsonArray *>(&array);
|
||||
} else {
|
||||
_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);
|
||||
} else {
|
||||
_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)
|
||||
add_compile_options(-Wnoexcept)
|
||||
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()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
|
Reference in New Issue
Block a user