build: w/a compiler warnings for GCC 11-12 and Clang 13, reduce build output

This commit is contained in:
Maksim Shabunin 2023-07-06 19:27:16 +03:00
parent 8839bd572e
commit 09944a83d9
8 changed files with 50 additions and 25 deletions

View File

@ -26,6 +26,7 @@ else()
-Wsuggest-override -Winconsistent-missing-override -Wsuggest-override -Winconsistent-missing-override
-Wimplicit-fallthrough -Wimplicit-fallthrough
-Warray-bounds # GCC 9+ -Warray-bounds # GCC 9+
-Wstringop-overflow -Wstringop-overread # GCC 11-12
) )
endif() endif()
if(CV_ICC) if(CV_ICC)

View File

@ -21,7 +21,7 @@ macro(copy_file_ src dst prefix)
endif() endif()
if(use_symlink) if(use_symlink)
if(local_update OR NOT IS_SYMLINK "${dst}") if(local_update OR NOT IS_SYMLINK "${dst}")
message("${prefix}Symlink: '${dst_name}' ...") #message("${prefix}Symlink: '${dst_name}' ...")
endif() endif()
get_filename_component(target_path "${dst}" PATH) get_filename_component(target_path "${dst}" PATH)
file(MAKE_DIRECTORY "${target_path}") file(MAKE_DIRECTORY "${target_path}")
@ -38,7 +38,7 @@ macro(copy_file_ src dst prefix)
set(local_update 1) set(local_update 1)
endif() endif()
if(local_update) if(local_update)
message("${prefix}Copying: '${dst_name}' ...") #message("${prefix}Copying: '${dst_name}' ...")
configure_file(${src} ${dst} COPYONLY) configure_file(${src} ${dst} COPYONLY)
else() else()
#message("${prefix}Up-to-date: '${dst_name}'") #message("${prefix}Up-to-date: '${dst_name}'")
@ -55,7 +55,7 @@ if(NOT DEFINED COPYLIST_VAR)
set(COPYLIST_VAR "COPYLIST") set(COPYLIST_VAR "COPYLIST")
endif() endif()
list(LENGTH ${COPYLIST_VAR} __length) list(LENGTH ${COPYLIST_VAR} __length)
message("${prefix}... ${__length} entries (${COPYLIST_VAR})") #message("${prefix}... ${__length} entries (${COPYLIST_VAR})")
foreach(id ${${COPYLIST_VAR}}) foreach(id ${${COPYLIST_VAR}})
set(src "${${COPYLIST_VAR}_SRC_${id}}") set(src "${${COPYLIST_VAR}_SRC_${id}}")
set(dst "${${COPYLIST_VAR}_DST_${id}}") set(dst "${${COPYLIST_VAR}_DST_${id}}")
@ -80,7 +80,7 @@ foreach(id ${${COPYLIST_VAR}})
endif() endif()
file(GLOB_RECURSE _files RELATIVE "${src}" ${src_glob}) file(GLOB_RECURSE _files RELATIVE "${src}" ${src_glob})
list(LENGTH _files __length) list(LENGTH _files __length)
message("${prefix} ... directory '.../${src_name2}/${src_name}' with ${__length} files") #message("${prefix} ... directory '.../${src_name2}/${src_name}' with ${__length} files")
foreach(f ${_files}) foreach(f ${_files})
if(NOT EXISTS "${src}/${f}") if(NOT EXISTS "${src}/${f}")
message(FATAL_ERROR "COPY ERROR: Source file is missing: ${src}/${f}") message(FATAL_ERROR "COPY ERROR: Source file is missing: ${src}/${f}")
@ -98,12 +98,12 @@ else()
endif() endif()
if(NOT "${__state}" STREQUAL "${__prev_state}") if(NOT "${__state}" STREQUAL "${__prev_state}")
file(WRITE "${STATE_FILE}" "${__state}") file(WRITE "${STATE_FILE}" "${__state}")
message("${prefix}Updated!") #message("${prefix}Updated!")
set(update_dephelper 1) set(update_dephelper 1)
endif() endif()
if(NOT update_dephelper) if(NOT update_dephelper)
message("${prefix}All files are up-to-date.") #message("${prefix}All files are up-to-date.")
elseif(DEFINED DEPHELPER) elseif(DEFINED DEPHELPER)
file(WRITE "${DEPHELPER}" "") file(WRITE "${DEPHELPER}" "")
endif() endif()

View File

@ -1531,8 +1531,8 @@ TEST(Calib3d_SolvePnP, generic)
} }
else else
{ {
p3f = p3f_; p3f = vector<Point3f>(p3f_.begin(), p3f_.end());
p2f = p2f_; p2f = vector<Point2f>(p2f_.begin(), p2f_.end());
} }
vector<double> reprojectionErrors; vector<double> reprojectionErrors;

View File

@ -18,7 +18,7 @@ class Core_ReduceTest : public cvtest::BaseTest
public: public:
Core_ReduceTest() {} Core_ReduceTest() {}
protected: protected:
void run( int); void run( int) CV_OVERRIDE;
int checkOp( const Mat& src, int dstType, int opType, const Mat& opRes, int dim ); int checkOp( const Mat& src, int dstType, int opType, const Mat& opRes, int dim );
int checkCase( int srcType, int dstType, int dim, Size sz ); int checkCase( int srcType, int dstType, int dim, Size sz );
int checkDim( int dim, Size sz ); int checkDim( int dim, Size sz );
@ -495,7 +495,7 @@ public:
Core_ArrayOpTest(); Core_ArrayOpTest();
~Core_ArrayOpTest(); ~Core_ArrayOpTest();
protected: protected:
void run(int); void run(int) CV_OVERRIDE;
}; };
@ -599,6 +599,11 @@ static void setValue(SparseMat& M, const int* idx, double value, RNG& rng)
CV_Error(CV_StsUnsupportedFormat, ""); CV_Error(CV_StsUnsupportedFormat, "");
} }
#if defined(__GNUC__) && (__GNUC__ == 11 || __GNUC__ == 12)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
#endif
template<typename Pixel> template<typename Pixel>
struct InitializerFunctor{ struct InitializerFunctor{
/// Initializer for cv::Mat::forEach test /// Initializer for cv::Mat::forEach test
@ -621,6 +626,11 @@ struct InitializerFunctor5D{
} }
}; };
#if defined(__GNUC__) && (__GNUC__ == 11 || __GNUC__ == 12)
#pragma GCC diagnostic pop
#endif
template<typename Pixel> template<typename Pixel>
struct EmptyFunctor struct EmptyFunctor
{ {
@ -1023,7 +1033,7 @@ class Core_MergeSplitBaseTest : public cvtest::BaseTest
protected: protected:
virtual int run_case(int depth, size_t channels, const Size& size, RNG& rng) = 0; virtual int run_case(int depth, size_t channels, const Size& size, RNG& rng) = 0;
virtual void run(int) virtual void run(int) CV_OVERRIDE
{ {
// m is Mat // m is Mat
// mv is vector<Mat> // mv is vector<Mat>
@ -1068,7 +1078,7 @@ public:
~Core_MergeTest() {} ~Core_MergeTest() {}
protected: protected:
virtual int run_case(int depth, size_t matCount, const Size& size, RNG& rng) virtual int run_case(int depth, size_t matCount, const Size& size, RNG& rng) CV_OVERRIDE
{ {
const int maxMatChannels = 10; const int maxMatChannels = 10;
@ -1126,7 +1136,7 @@ public:
~Core_SplitTest() {} ~Core_SplitTest() {}
protected: protected:
virtual int run_case(int depth, size_t channels, const Size& size, RNG& rng) virtual int run_case(int depth, size_t channels, const Size& size, RNG& rng) CV_OVERRIDE
{ {
Mat src(size, CV_MAKETYPE(depth, (int)channels)); Mat src(size, CV_MAKETYPE(depth, (int)channels));
rng.fill(src, RNG::UNIFORM, 0, 100, true); rng.fill(src, RNG::UNIFORM, 0, 100, true);
@ -1990,7 +2000,6 @@ TEST(Core_InputArray, fetch_MatExpr)
} }
#ifdef CV_CXX11
class TestInputArrayRangeChecking { class TestInputArrayRangeChecking {
static const char *kind2str(cv::_InputArray ia) static const char *kind2str(cv::_InputArray ia)
{ {
@ -2137,8 +2146,6 @@ TEST(Core_InputArray, range_checking)
{ {
TestInputArrayRangeChecking::run(); TestInputArrayRangeChecking::run();
} }
#endif
TEST(Core_Vectors, issue_13078) TEST(Core_Vectors, issue_13078)
{ {

View File

@ -509,6 +509,11 @@ namespace util
return v.index() == util::variant<Types...>::template index_of<T>(); return v.index() == util::variant<Types...>::template index_of<T>();
} }
#if defined(__GNUC__) && (__GNUC__ == 11 || __GNUC__ == 12)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
template<typename... Us> bool operator==(const variant<Us...> &lhs, template<typename... Us> bool operator==(const variant<Us...> &lhs,
const variant<Us...> &rhs) const variant<Us...> &rhs)
{ {
@ -524,6 +529,10 @@ namespace util
return (eqs[lhs.index()])(lhs.memory, rhs.memory); return (eqs[lhs.index()])(lhs.memory, rhs.memory);
} }
#if defined(__GNUC__) && (__GNUC__ == 11 || __GNUC__ == 12)
#pragma GCC diagnostic pop
#endif
template<typename... Us> bool operator!=(const variant<Us...> &lhs, template<typename... Us> bool operator!=(const variant<Us...> &lhs,
const variant<Us...> &rhs) const variant<Us...> &rhs)
{ {

View File

@ -560,8 +560,15 @@ int cv::floodFill( InputOutputArray _image, InputOutputArray _mask,
if( depth == CV_8U ) if( depth == CV_8U )
for( i = 0; i < cn; i++ ) for( i = 0; i < cn; i++ )
{ {
#if defined(__GNUC__) && (__GNUC__ == 12)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-overflow"
#endif
ld_buf.b[i] = saturate_cast<uchar>(cvFloor(loDiff[i])); ld_buf.b[i] = saturate_cast<uchar>(cvFloor(loDiff[i]));
ud_buf.b[i] = saturate_cast<uchar>(cvFloor(upDiff[i])); ud_buf.b[i] = saturate_cast<uchar>(cvFloor(upDiff[i]));
#if defined(__GNUC__) && (__GNUC__ == 12)
#pragma GCC diagnostic pop
#endif
} }
else if( depth == CV_32S ) else if( depth == CV_32S )
for( i = 0; i < cn; i++ ) for( i = 0; i < cn; i++ )

View File

@ -686,7 +686,7 @@ class JavaWrapperGenerator(object):
msg = "// Return type '%s' is not supported, skipping the function\n\n" % fi.ctype msg = "// Return type '%s' is not supported, skipping the function\n\n" % fi.ctype
self.skipped_func_list.append(c_decl + "\n" + msg) self.skipped_func_list.append(c_decl + "\n" + msg)
j_code.write( " "*4 + msg ) j_code.write( " "*4 + msg )
logging.warning("SKIP:" + c_decl.strip() + "\t due to RET type " + fi.ctype) logging.info("SKIP:" + c_decl.strip() + "\t due to RET type " + fi.ctype)
return return
for a in fi.args: for a in fi.args:
if a.ctype not in type_dict: if a.ctype not in type_dict:
@ -698,7 +698,7 @@ class JavaWrapperGenerator(object):
msg = "// Unknown type '%s' (%s), skipping the function\n\n" % (a.ctype, a.out or "I") msg = "// Unknown type '%s' (%s), skipping the function\n\n" % (a.ctype, a.out or "I")
self.skipped_func_list.append(c_decl + "\n" + msg) self.skipped_func_list.append(c_decl + "\n" + msg)
j_code.write( " "*4 + msg ) j_code.write( " "*4 + msg )
logging.warning("SKIP:" + c_decl.strip() + "\t due to ARG type " + a.ctype + "/" + (a.out or "I")) logging.info("SKIP:" + c_decl.strip() + "\t due to ARG type " + a.ctype + "/" + (a.out or "I"))
return return
self.ported_func_list.append(c_decl) self.ported_func_list.append(c_decl)

View File

@ -17501,6 +17501,7 @@ CartesianProductHolder2(const Generator1& g1, const Generator2& g2)
static_cast<ParamGenerator<T2> >(g2_))); static_cast<ParamGenerator<T2> >(g2_)));
} }
CartesianProductHolder2(const CartesianProductHolder2 & other) = default;
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const CartesianProductHolder2& other) = delete; void operator=(const CartesianProductHolder2& other) = delete;
@ -17523,7 +17524,7 @@ CartesianProductHolder3(const Generator1& g1, const Generator2& g2,
static_cast<ParamGenerator<T2> >(g2_), static_cast<ParamGenerator<T2> >(g2_),
static_cast<ParamGenerator<T3> >(g3_))); static_cast<ParamGenerator<T3> >(g3_)));
} }
CartesianProductHolder3(const CartesianProductHolder3 &) = default;
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const CartesianProductHolder3& other) = delete; void operator=(const CartesianProductHolder3& other) = delete;
@ -17549,7 +17550,7 @@ CartesianProductHolder4(const Generator1& g1, const Generator2& g2,
static_cast<ParamGenerator<T3> >(g3_), static_cast<ParamGenerator<T3> >(g3_),
static_cast<ParamGenerator<T4> >(g4_))); static_cast<ParamGenerator<T4> >(g4_)));
} }
CartesianProductHolder4(const CartesianProductHolder4 &) = default;
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const CartesianProductHolder4& other) = delete; void operator=(const CartesianProductHolder4& other) = delete;
@ -17577,7 +17578,7 @@ CartesianProductHolder5(const Generator1& g1, const Generator2& g2,
static_cast<ParamGenerator<T4> >(g4_), static_cast<ParamGenerator<T4> >(g4_),
static_cast<ParamGenerator<T5> >(g5_))); static_cast<ParamGenerator<T5> >(g5_)));
} }
CartesianProductHolder5(const CartesianProductHolder5 &) = default;
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const CartesianProductHolder5& other) = delete; void operator=(const CartesianProductHolder5& other) = delete;
@ -17609,7 +17610,7 @@ CartesianProductHolder6(const Generator1& g1, const Generator2& g2,
static_cast<ParamGenerator<T5> >(g5_), static_cast<ParamGenerator<T5> >(g5_),
static_cast<ParamGenerator<T6> >(g6_))); static_cast<ParamGenerator<T6> >(g6_)));
} }
CartesianProductHolder6(const CartesianProductHolder6 &) = default;
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const CartesianProductHolder6& other) = delete; void operator=(const CartesianProductHolder6& other) = delete;
@ -17644,7 +17645,7 @@ CartesianProductHolder7(const Generator1& g1, const Generator2& g2,
static_cast<ParamGenerator<T6> >(g6_), static_cast<ParamGenerator<T6> >(g6_),
static_cast<ParamGenerator<T7> >(g7_))); static_cast<ParamGenerator<T7> >(g7_)));
} }
CartesianProductHolder7(const CartesianProductHolder7 &) = default;
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const CartesianProductHolder7& other) = delete; void operator=(const CartesianProductHolder7& other) = delete;
@ -17683,7 +17684,7 @@ CartesianProductHolder8(const Generator1& g1, const Generator2& g2,
static_cast<ParamGenerator<T7> >(g7_), static_cast<ParamGenerator<T7> >(g7_),
static_cast<ParamGenerator<T8> >(g8_))); static_cast<ParamGenerator<T8> >(g8_)));
} }
CartesianProductHolder8(const CartesianProductHolder8 &) = default;
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const CartesianProductHolder8& other) = delete; void operator=(const CartesianProductHolder8& other) = delete;
@ -17726,7 +17727,7 @@ CartesianProductHolder9(const Generator1& g1, const Generator2& g2,
static_cast<ParamGenerator<T8> >(g8_), static_cast<ParamGenerator<T8> >(g8_),
static_cast<ParamGenerator<T9> >(g9_))); static_cast<ParamGenerator<T9> >(g9_)));
} }
CartesianProductHolder9(const CartesianProductHolder9 &) = default;
private: private:
// No implementation - assignment is unsupported. // No implementation - assignment is unsupported.
void operator=(const CartesianProductHolder9& other) = delete; void operator=(const CartesianProductHolder9& other) = delete;