From 89f8d4ae1235df19f49ba3167f0e4f2b4acc5c0a Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Sun, 15 May 2022 16:20:45 +0000 Subject: [PATCH] build: GCC12 warnings --- 3rdparty/libpng/CMakeLists.txt | 4 +++- 3rdparty/libtiff/CMakeLists.txt | 3 ++- apps/traincascade/cascadeclassifier.cpp | 2 +- modules/ts/src/ts_gtest.cpp | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/3rdparty/libpng/CMakeLists.txt b/3rdparty/libpng/CMakeLists.txt index efa59627eb..f72b966079 100644 --- a/3rdparty/libpng/CMakeLists.txt +++ b/3rdparty/libpng/CMakeLists.txt @@ -77,7 +77,9 @@ endif(MSVC) add_library(${PNG_LIBRARY} STATIC ${OPENCV_3RDPARTY_EXCLUDE_FROM_ALL} ${lib_srcs} ${lib_hdrs}) target_link_libraries(${PNG_LIBRARY} ${ZLIB_LIBRARIES}) -ocv_warnings_disable(CMAKE_C_FLAGS -Wundef -Wcast-align -Wimplicit-fallthrough -Wunused-parameter -Wsign-compare) +ocv_warnings_disable(CMAKE_C_FLAGS -Wundef -Wcast-align -Wimplicit-fallthrough -Wunused-parameter -Wsign-compare + -Wmaybe-uninitialized +) set_target_properties(${PNG_LIBRARY} PROPERTIES OUTPUT_NAME ${PNG_LIBRARY} diff --git a/3rdparty/libtiff/CMakeLists.txt b/3rdparty/libtiff/CMakeLists.txt index 2074888a52..99c1933d22 100644 --- a/3rdparty/libtiff/CMakeLists.txt +++ b/3rdparty/libtiff/CMakeLists.txt @@ -452,8 +452,9 @@ ocv_warnings_disable(CMAKE_C_FLAGS -Wno-unused-but-set-variable -Wmissing-protot -Wcast-align -Wshadow -Wno-maybe-uninitialized -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast -Wmisleading-indentation -Wimplicit-fallthrough + -Wunused-parameter # clang + -Warray-parameter ) -ocv_warnings_disable(CMAKE_C_FLAGS -Wunused-parameter) # clang ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-declarations -Wunused-parameter -Wmissing-prototypes -Wundef # tiffiop.h: #if __clang_major__ >= 4 ) diff --git a/apps/traincascade/cascadeclassifier.cpp b/apps/traincascade/cascadeclassifier.cpp index 3d7b383258..5a83746bc4 100644 --- a/apps/traincascade/cascadeclassifier.cpp +++ b/apps/traincascade/cascadeclassifier.cpp @@ -252,7 +252,7 @@ bool CvCascadeClassifier::train( const string _cascadeDirName, fs << "}"; } // save current stage - char buf[10]; + char buf[32]; sprintf(buf, "%s%d", "stage", i ); string stageFilename = dirName + buf + ".xml"; FileStorage fs( stageFilename, FileStorage::WRITE ); diff --git a/modules/ts/src/ts_gtest.cpp b/modules/ts/src/ts_gtest.cpp index a65ef721a2..030c56bb4f 100644 --- a/modules/ts/src/ts_gtest.cpp +++ b/modules/ts/src/ts_gtest.cpp @@ -8716,7 +8716,7 @@ static void StackLowerThanAddress(const void* ptr, bool* result) { // Make sure AddressSanitizer does not tamper with the stack here. GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_ static bool StackGrowsDown() { - int dummy; + int dummy = 0; bool result; StackLowerThanAddress(&dummy, &result); return result;