Skip to content

Commit

Permalink
Disable warning maybe-uninitialized via pragma in the Optional copy c…
Browse files Browse the repository at this point in the history
…onstructor
  • Loading branch information
yufengwangca committed Jan 27, 2022
1 parent a3369af commit bf11e62
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/all-clusters-app/esp32/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if(${IDF_TARGET} STREQUAL "esp32")
endif()

project(chip-all-clusters-app)
idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++17;-Os;-Wno-maybe-uninitialized;-DLWIP_IPV6_SCOPES=0;-DCHIP_HAVE_CONFIG_H" APPEND)
idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++17;-Os;-DLWIP_IPV6_SCOPES=0;-DCHIP_HAVE_CONFIG_H" APPEND)
idf_build_set_property(C_COMPILE_OPTIONS "-Os;-DLWIP_IPV6_SCOPES=0" APPEND)
# For the C3, project_include.cmake sets -Wno-format, but does not clear various
# flags that depend on -Wformat
Expand Down
7 changes: 7 additions & 0 deletions src/lib/core/Optional.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,14 @@ class Optional
{
if (mHasValue)
{
#pragma GCC diagnostic push
#if __GNUC__ && defined(__has_warning)
#if __has_warning("-Wmaybe-uninitialized")
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
#endif
new (&mValue.mData) T(other.mValue.mData);
#pragma GCC diagnostic pop
}
}

Expand Down

0 comments on commit bf11e62

Please sign in to comment.