Skip to content

Commit

Permalink
Merge pull request opencv#23109 from seanm:misc-warnings
Browse files Browse the repository at this point in the history
* Fixed clang -Wnewline-eof warnings
* Fixed all trivial clang -Wextra-semi and -Wc++98-compat-extra-semi warnings
* Removed trailing semi from various macros
* Fixed various -Wunused-macros warnings
* Fixed some trivial -Wdocumentation warnings
* Fixed some -Wdocumentation-deprecated-sync warnings
* Fixed incorrect indentation
* Suppressed some clang warnings in 3rd party code
* Fixed QRCodeEncoder::Params documentation.

---------

Co-authored-by: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
  • Loading branch information
seanm and asmorkalov committed Oct 6, 2023
1 parent 24fd395 commit 5fb3869
Show file tree
Hide file tree
Showing 135 changed files with 620 additions and 534 deletions.
1 change: 1 addition & 0 deletions 3rdparty/openjpeg/CMakeLists.txt
Expand Up @@ -16,6 +16,7 @@ ocv_warnings_disable(CMAKE_C_FLAGS
-Wunused-but-set-variable # clang15
-Wmissing-prototypes # clang, function opj_t1_ht_decode_cblk
-Wmissing-declarations # gcc, function opj_t1_ht_decode_cblk
-Wdocumentation # clang
)

#-----------------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions 3rdparty/protobuf/CMakeLists.txt
Expand Up @@ -27,6 +27,8 @@ else()
-Wimplicit-fallthrough
-Warray-bounds # GCC 9+
-Wstringop-overflow -Wstringop-overread # GCC 11-12
-Wextra-semi # clang
-Wcomma # clang
)
endif()
if(CV_ICC)
Expand Down
2 changes: 1 addition & 1 deletion modules/calib3d/perf/perf_stereosgbm.cpp
Expand Up @@ -43,7 +43,7 @@ using namespace testing;

static void MakeArtificialExample(Mat& dst_left_view, Mat& dst_view);

CV_ENUM(SGBMModes, StereoSGBM::MODE_SGBM, StereoSGBM::MODE_SGBM_3WAY, StereoSGBM::MODE_HH4);
CV_ENUM(SGBMModes, StereoSGBM::MODE_SGBM, StereoSGBM::MODE_SGBM_3WAY, StereoSGBM::MODE_HH4)
typedef tuple<Size, int, SGBMModes> SGBMParams;
typedef TestBaseWithParam<SGBMParams> TestStereoCorrespSGBM;

Expand Down
14 changes: 7 additions & 7 deletions modules/calib3d/src/chessboard.hpp
Expand Up @@ -203,12 +203,12 @@ class Chessboard: public cv::Feature2D
* d12/d34 = d13/d24
*
* point order on the line:
* pt1 --> pt2 --> pt3 --> pt4
* p0 --> p1 --> p2 --> p3
*
* \param[in] pt1 First point coordinate
* \param[in] pt2 Second point coordinate
* \param[in] pt3 Third point coordinate
* \param[out] pt4 Forth point coordinate
* \param[in] p0 First point coordinate
* \param[in] p1 Second point coordinate
* \param[in] p2 Third point coordinate
* \param[out] p3 Forth point coordinate
*
*/
static bool estimatePoint(const cv::Point2f &p0,const cv::Point2f &p1,const cv::Point2f &p2,cv::Point2f &p3);
Expand Down Expand Up @@ -309,7 +309,7 @@ class Chessboard: public cv::Feature2D
* \brief Draws the corners into the given image
*
* \param[in] m The image
* \param[out] m The resulting image
* \param[out] out The resulting image
* \param[in] H optional homography to calculate search area
*
*/
Expand Down Expand Up @@ -668,7 +668,7 @@ class Chessboard: public cv::Feature2D
* \brief Calculates the average edge sharpness for the chessboard
*
* \param[in] image The image where the chessboard was detected
* \param[in] rise_distante Rise distance 0.8 means 10% ... 90%
* \param[in] rise_distance Rise distance 0.8 means 10% ... 90%
* \param[in] vertical by default only edge response for horiontal lines are calculated
*
* \returns Scalar(sharpness, average min_val, average max_val)
Expand Down
4 changes: 2 additions & 2 deletions modules/calib3d/src/fundam.cpp
Expand Up @@ -113,7 +113,7 @@ class HomographyEstimatorCallback CV_FINAL : public PointSetRegistrator::Callbac
* 2 columns 1 channel
* @param _m2 destination points containing (x,y), depth is CV_32F with 1 column 2 channels or
* 2 columns 1 channel
* @param _model, CV_64FC1, 3x3, normalized, i.e., the last element is 1
* @param _model CV_64FC1, 3x3, normalized, i.e., the last element is 1
*/
int runKernel( InputArray _m1, InputArray _m2, OutputArray _model ) const CV_OVERRIDE
{
Expand Down Expand Up @@ -188,7 +188,7 @@ class HomographyEstimatorCallback CV_FINAL : public PointSetRegistrator::Callbac
* @param _m1 depth CV_32F, 1-channel with 2 columns or 2-channel with 1 column
* @param _m2 depth CV_32F, 1-channel with 2 columns or 2-channel with 1 column
* @param _model CV_64FC1, 3x3
* @param _err, output, CV_32FC1, square of the L2 norm
* @param _err output, CV_32FC1, square of the L2 norm
*/
void computeError( InputArray _m1, InputArray _m2, InputArray _model, OutputArray _err ) const CV_OVERRIDE
{
Expand Down
10 changes: 5 additions & 5 deletions modules/calib3d/src/ippe.hpp
Expand Up @@ -111,7 +111,7 @@ class PoseSolver {
/**
* @brief Computes the translation solution for a given rotation solution
* @param objectPoints Array of corresponding object points, 1xN/Nx1 3-channel where N is the number of points
* @param normalizedImagePoints Array of corresponding image points (undistorted), 1xN/Nx1 2-channel where N is the number of points
* @param normalizedImgPoints Array of corresponding image points (undistorted), 1xN/Nx1 2-channel where N is the number of points
* @param R Rotation solution (3x1 rotation vector)
* @param t Translation solution (3x1 rotation vector)
*/
Expand Down Expand Up @@ -220,10 +220,10 @@ class PoseSolver {

/**
* @brief Computes the average depth of an object given its pose in camera coordinates
* @param objectPoints: Object points defined in 3D object space
* @param rvec: Rotation component of pose
* @param tvec: Translation component of pose
* @return: average depth of the object
* @param objectPoints Object points defined in 3D object space
* @param rvec Rotation component of pose
* @param tvec Translation component of pose
* @return average depth of the object
*/
double meanSceneDepth(InputArray objectPoints, InputArray rvec, InputArray tvec);

Expand Down
4 changes: 2 additions & 2 deletions modules/calib3d/src/p3p.cpp
Expand Up @@ -214,8 +214,8 @@ int p3p::solve(double R[4][3][3], double t[4][3],
/// Only the solution to the main branch.
/// Reference : X.S. Gao, X.-R. Hou, J. Tang, H.-F. Chang; "Complete Solution Classification for the Perspective-Three-Point Problem"
/// IEEE Trans. on PAMI, vol. 25, No. 8, August 2003
/// \param lengths3D Lengths of line segments up to four solutions.
/// \param dist3D Distance between 3D points in pairs |BC|, |AC|, |AB|.
/// \param lengths Lengths of line segments up to four solutions.
/// \param distances Distance between 3D points in pairs |BC|, |AC|, |AB|.
/// \param cosines Cosine of the angles /_BPC, /_APC, /_APB.
/// \returns Number of solutions.
/// WARNING: NOT ALL THE DEGENERATE CASES ARE IMPLEMENTED
Expand Down
2 changes: 1 addition & 1 deletion modules/calib3d/src/precomp.hpp
Expand Up @@ -69,7 +69,7 @@ namespace cv
* @param ep outlier ratio
* @param modelPoints number of model points required for estimation
* @param maxIters maximum number of iterations
* @return
* @return The number of iterations according to the formula
* \f[
* \frac{\ln(1-p)}{\ln\left(1-(1-ep)^\mathrm{modelPoints}\right)}
* \f]
Expand Down
2 changes: 1 addition & 1 deletion modules/calib3d/src/rho.cpp
Expand Up @@ -490,7 +490,7 @@ void rhoSeed(Ptr<RHO_HEST> p, uint64_t seed){
* Estimates the homography using the given context, matches and parameters to
* PROSAC.
*
* @param [in/out] p The context to use for homography estimation. Must
* @param [in,out] p The context to use for homography estimation. Must
* be already initialized. Cannot be NULL.
* @param [in] src The pointer to the source points of the matches.
* Must be aligned to 4 bytes. Cannot be NULL.
Expand Down
2 changes: 1 addition & 1 deletion modules/calib3d/src/rho.h
Expand Up @@ -215,7 +215,7 @@ void rhoSeed(Ptr<RHO_HEST> p, uint64_t seed);
* homography with at least the minimum required support, and 0 if it was not.
*
*
* @param [in/out] p The context to use for homography estimation. Must
* @param [in,out] p The context to use for homography estimation. Must
* be already initialized. Cannot be NULL.
* @param [in] src The pointer to the source points of the matches.
* Must be aligned to 4 bytes. Cannot be NULL.
Expand Down
6 changes: 3 additions & 3 deletions modules/core/include/opencv2/core/dualquaternion.inl.hpp
Expand Up @@ -36,15 +36,15 @@
namespace cv {

template <typename T>
DualQuat<T>::DualQuat():w(0), x(0), y(0), z(0), w_(0), x_(0), y_(0), z_(0){};
DualQuat<T>::DualQuat():w(0), x(0), y(0), z(0), w_(0), x_(0), y_(0), z_(0){}

template <typename T>
DualQuat<T>::DualQuat(const T vw, const T vx, const T vy, const T vz, const T _w, const T _x, const T _y, const T _z):
w(vw), x(vx), y(vy), z(vz), w_(_w), x_(_x), y_(_y), z_(_z){};
w(vw), x(vx), y(vy), z(vz), w_(_w), x_(_x), y_(_y), z_(_z){}

template <typename T>
DualQuat<T>::DualQuat(const Vec<T, 8> &q):w(q[0]), x(q[1]), y(q[2]), z(q[3]),
w_(q[4]), x_(q[5]), y_(q[6]), z_(q[7]){};
w_(q[4]), x_(q[5]), y_(q[6]), z_(q[7]){}

template <typename T>
DualQuat<T> DualQuat<T>::createFromQuat(const Quat<T> &realPart, const Quat<T> &dualPart)
Expand Down
2 changes: 1 addition & 1 deletion modules/core/include/opencv2/core/hal/intrin_forward.hpp
Expand Up @@ -188,4 +188,4 @@ CV_CPU_OPTIMIZATION_HAL_NAMESPACE_END

//! @endcond

} // cv::
} // cv::
2 changes: 1 addition & 1 deletion modules/core/include/opencv2/core/matx.hpp
Expand Up @@ -215,7 +215,7 @@ template<typename _Tp, int m, int n> class Matx
template<int l> Matx(const Matx<_Tp, m, l>& a, const Matx<_Tp, l, n>& b, Matx_MatMulOp);
Matx(const Matx<_Tp, n, m>& a, Matx_TOp);

_Tp val[m*n]; //< matrix elements
_Tp val[m*n]; ///< matrix elements
};

typedef Matx<float, 1, 2> Matx12f;
Expand Down
2 changes: 1 addition & 1 deletion modules/core/include/opencv2/core/ocl.hpp
Expand Up @@ -779,7 +779,7 @@ class CV_EXPORTS Timer
void start();
void stop();

uint64 durationNS() const; //< duration in nanoseconds
uint64 durationNS() const; ///< duration in nanoseconds

protected:
struct Impl;
Expand Down
6 changes: 3 additions & 3 deletions modules/core/include/opencv2/core/types.hpp
Expand Up @@ -89,7 +89,7 @@ template<typename _Tp> class Complex
//! conjugation
Complex conj() const;

_Tp re, im; //< the real and the imaginary parts
_Tp re, im; ///< the real and the imaginary parts
};

typedef Complex<float> Complexf;
Expand Down Expand Up @@ -2031,8 +2031,8 @@ double jaccardDistance(const Rect_<_Tp>& a, const Rect_<_Tp>& b) {
/** @brief Finds out if there is any intersection between two rectangles
*
* mainly useful for language bindings
* @param rect1 First rectangle
* @param rect2 Second rectangle
* @param a First rectangle
* @param b Second rectangle
* @return the area of the intersection
*/
CV_EXPORTS_W inline double rectangleIntersectionArea(const Rect2d& a, const Rect2d& b) { return (a & b).area(); }
Expand Down
Expand Up @@ -47,11 +47,11 @@ class CV_EXPORTS FileLock {
explicit FileLock(const char* fname);
~FileLock();

void lock(); //< acquire exclusive (writer) lock
void unlock(); //< release exclusive (writer) lock
void lock(); ///< acquire exclusive (writer) lock
void unlock(); ///< release exclusive (writer) lock

void lock_shared(); //< acquire shareable (reader) lock
void unlock_shared(); //< release shareable (reader) lock
void lock_shared(); ///< acquire shareable (reader) lock
void unlock_shared(); ///< release shareable (reader) lock

struct Impl;
protected:
Expand Down
24 changes: 12 additions & 12 deletions modules/core/include/opencv2/core/utils/trace.hpp
Expand Up @@ -70,11 +70,11 @@ class CV_EXPORTS Region
struct LocationExtraData;
struct LocationStaticStorage
{
LocationExtraData** ppExtra; //< implementation specific data
const char* name; //< region name (function name or other custom name)
const char* filename; //< source code filename
int line; //< source code line
int flags; //< flags (implementation code path: Plain, IPP, OpenCL)
LocationExtraData** ppExtra; ///< implementation specific data
const char* name; ///< region name (function name or other custom name)
const char* filename; ///< source code filename
int line; ///< source code line
int flags; ///< flags (implementation code path: Plain, IPP, OpenCL)
};

Region(const LocationStaticStorage& location);
Expand All @@ -100,18 +100,18 @@ class CV_EXPORTS Region

//! Specify region flags
enum RegionLocationFlag {
REGION_FLAG_FUNCTION = (1 << 0), //< region is function (=1) / nested named region (=0)
REGION_FLAG_APP_CODE = (1 << 1), //< region is Application code (=1) / OpenCV library code (=0)
REGION_FLAG_SKIP_NESTED = (1 << 2), //< avoid processing of nested regions
REGION_FLAG_FUNCTION = (1 << 0), ///< region is function (=1) / nested named region (=0)
REGION_FLAG_APP_CODE = (1 << 1), ///< region is Application code (=1) / OpenCV library code (=0)
REGION_FLAG_SKIP_NESTED = (1 << 2), ///< avoid processing of nested regions

REGION_FLAG_IMPL_IPP = (1 << 16), //< region is part of IPP code path
REGION_FLAG_IMPL_OPENCL = (2 << 16), //< region is part of OpenCL code path
REGION_FLAG_IMPL_OPENVX = (3 << 16), //< region is part of OpenVX code path
REGION_FLAG_IMPL_IPP = (1 << 16), ///< region is part of IPP code path
REGION_FLAG_IMPL_OPENCL = (2 << 16), ///< region is part of OpenCL code path
REGION_FLAG_IMPL_OPENVX = (3 << 16), ///< region is part of OpenVX code path

REGION_FLAG_IMPL_MASK = (15 << 16),

REGION_FLAG_REGION_FORCE = (1 << 30),
REGION_FLAG_REGION_NEXT = (1 << 31), //< close previous region (see #CV_TRACE_REGION_NEXT macro)
REGION_FLAG_REGION_NEXT = (1 << 31), ///< close previous region (see #CV_TRACE_REGION_NEXT macro)

ENUM_REGION_FLAG_FORCE_INT = INT_MAX
};
Expand Down
4 changes: 2 additions & 2 deletions modules/core/misc/python/pyopencv_async.hpp
Expand Up @@ -2,7 +2,7 @@

#include "opencv2/core/async.hpp"

CV_PY_TO_CLASS(AsyncArray);
CV_PY_FROM_CLASS(AsyncArray);
CV_PY_TO_CLASS(AsyncArray)
CV_PY_FROM_CLASS(AsyncArray)

#endif
20 changes: 10 additions & 10 deletions modules/core/misc/python/pyopencv_cuda.hpp
Expand Up @@ -20,18 +20,18 @@ template<> struct pyopencvVecConverter<cuda::GpuMat>
}
};

CV_PY_TO_CLASS(cuda::GpuMat);
CV_PY_TO_CLASS(cuda::Stream);
CV_PY_TO_CLASS(cuda::Event);
CV_PY_TO_CLASS(cuda::HostMem);
CV_PY_TO_CLASS(cuda::GpuMat)
CV_PY_TO_CLASS(cuda::Stream)
CV_PY_TO_CLASS(cuda::Event)
CV_PY_TO_CLASS(cuda::HostMem)

CV_PY_TO_CLASS_PTR(cuda::GpuMat);
CV_PY_TO_CLASS_PTR(cuda::GpuMat::Allocator);
CV_PY_TO_CLASS_PTR(cuda::GpuMat)
CV_PY_TO_CLASS_PTR(cuda::GpuMat::Allocator)

CV_PY_FROM_CLASS(cuda::GpuMat);
CV_PY_FROM_CLASS(cuda::Stream);
CV_PY_FROM_CLASS(cuda::HostMem);
CV_PY_FROM_CLASS(cuda::GpuMat)
CV_PY_FROM_CLASS(cuda::Stream)
CV_PY_FROM_CLASS(cuda::HostMem)

CV_PY_FROM_CLASS_PTR(cuda::GpuMat::Allocator);
CV_PY_FROM_CLASS_PTR(cuda::GpuMat::Allocator)

#endif
4 changes: 2 additions & 2 deletions modules/core/misc/python/pyopencv_umat.hpp
Expand Up @@ -4,8 +4,8 @@

typedef std::vector<Range> vector_Range;

CV_PY_TO_CLASS(UMat);
CV_PY_FROM_CLASS(UMat);
CV_PY_TO_CLASS(UMat)
CV_PY_FROM_CLASS(UMat)

static bool cv_mappable_to(const Ptr<Mat>& src, Ptr<UMat>& dst)
{
Expand Down
2 changes: 1 addition & 1 deletion modules/core/perf/perf_allocation.cpp
Expand Up @@ -45,4 +45,4 @@ PERF_TEST_P(MatDepth_tb, DISABLED_Allocation_Aligned,
SANITY_CHECK_NOTHING();
}

};
}
2 changes: 1 addition & 1 deletion modules/core/src/alloc.cpp
Expand Up @@ -53,7 +53,6 @@
#undef CV__ALLOCATOR_STATS_LOG

//#define OPENCV_ALLOC_ENABLE_STATISTICS
#define OPENCV_ALLOC_STATISTICS_LIMIT 4096 // don't track buffers less than N bytes


#ifdef HAVE_POSIX_MEMALIGN
Expand All @@ -63,6 +62,7 @@
#endif

#ifdef OPENCV_ALLOC_ENABLE_STATISTICS
#define OPENCV_ALLOC_STATISTICS_LIMIT 4096 // don't track buffers less than N bytes
#include <map>
#endif

Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/arithm.dispatch.cpp
Expand Up @@ -8,4 +8,4 @@
#include "arithm.simd_declarations.hpp"

#define ARITHM_DISPATCHING_ONLY
#include "arithm.simd.hpp"
#include "arithm.simd.hpp"
2 changes: 1 addition & 1 deletion modules/core/src/arithm_ipp.hpp
Expand Up @@ -414,4 +414,4 @@ inline int arithm_ipp_mul32f(const float *src1, size_t step1, const float *src2,

#if !ARITHM_USE_IPP
#define ARITHM_CALL_IPP(...)
#endif
#endif
2 changes: 0 additions & 2 deletions modules/core/src/dxt.cpp
Expand Up @@ -64,8 +64,6 @@ namespace cv
Discrete Fourier Transform
\****************************************************************************************/

#define CV_MAX_LOCAL_DFT_SIZE (1 << 15)

static unsigned char bitrevTab[] =
{
0x00,0x80,0x40,0xc0,0x20,0xa0,0x60,0xe0,0x10,0x90,0x50,0xd0,0x30,0xb0,0x70,0xf0,
Expand Down

0 comments on commit 5fb3869

Please sign in to comment.