1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 08:13:04 +04:00

Merge pull request #23109 from seanm:misc-warnings

* 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>
This commit is contained in:
Sean McBride
2023-10-06 06:33:21 -04:00
committed by GitHub
parent 24fd39538e
commit 5fb3869775
135 changed files with 620 additions and 534 deletions
@@ -241,6 +241,7 @@ namespace gapi
*
* @brief G-API functions and classes for serialization and deserialization.
*/
/** @brief Wraps deserialized output GRunArgs to GRunArgsP which can be used by GCompiled.
*
* Since it's impossible to get modifiable output arguments from deserialization
@@ -254,6 +255,7 @@ namespace gapi
* @see deserialize
*/
GAPI_EXPORTS cv::GRunArgsP bind(cv::GRunArgs &out_args);
/** @brief Wraps output GRunArgsP available during graph execution to GRunArgs which can be serialized.
*
* GRunArgsP is pointer-to-value, so to be serialized they need to be binded to real values
+3 -3
View File
@@ -102,17 +102,17 @@ namespace detail
GAPI_Assert(m_hint != nullptr);
using U = typename std::decay<T>::type;
return dynamic_cast<TypeHint<U>*>(m_hint.get()) != nullptr;
};
}
template <typename T>
void GArrayU::specifyType(){
m_hint.reset(new TypeHint<typename std::decay<T>::type>);
};
}
template <typename T>
void GArrayU::storeKind(){
setKind(cv::detail::GOpaqueTraits<T>::kind);
};
}
// This class represents a typed STL vector reference.
// Depending on origins, this reference may be either "just a" reference to
@@ -50,6 +50,7 @@ namespace s11n {
*
* @brief G-API classes for constructed and compiled graphs.
*/
/**
* @brief GComputation class represents a captured computation
* graph. GComputation objects form boundaries for expression code
@@ -430,7 +430,7 @@ namespace gapi {
virtual ~GFunctor() = default;
protected:
GFunctor(const char* id) : m_id(id) { };
GFunctor(const char* id) : m_id(id) { }
private:
const char* m_id;
};
@@ -692,7 +692,7 @@ namespace gapi {
int unused[] = { 0, (pkg.include<KK>(), 0)... };
cv::util::suppress_unused_warning(unused);
return pkg;
};
}
template<typename... FF>
GKernelPackage kernels(FF&... functors)
@@ -701,7 +701,7 @@ namespace gapi {
int unused[] = { 0, (pkg.include(functors), 0)... };
cv::util::suppress_unused_warning(unused);
return pkg;
};
}
/** @} */
@@ -48,6 +48,7 @@ struct GOrigin;
* `cv::GOpaque<T>` | T
* cv::GFrame | cv::MediaFrame
*/
/**
* @brief GMat class represents image or tensor data in the
* graph.
@@ -98,18 +98,18 @@ namespace detail
GAPI_Assert(m_hint != nullptr);
using U = util::decay_t<T>;
return dynamic_cast<TypeHint<U>*>(m_hint.get()) != nullptr;
};
}
template <typename T>
void GOpaqueU::specifyType(){
m_hint.reset(new TypeHint<util::decay_t<T>>);
};
}
template <typename T>
void GOpaqueU::storeKind(){
// FIXME: Add assert here on cv::Mat and cv::Scalar?
setKind(cv::detail::GOpaqueTraits<T>::kind);
};
}
// This class represents a typed object reference.
// Depending on origins, this reference may be either "just a" reference to
@@ -409,7 +409,7 @@ namespace streaming {
struct GAPI_EXPORTS_W_SIMPLE queue_capacity
{
GAPI_WRAP
explicit queue_capacity(size_t cap = 1) : capacity(cap) { };
explicit queue_capacity(size_t cap = 1) : capacity(cap) { }
GAPI_PROP_RW
size_t capacity;
};
@@ -91,7 +91,7 @@ public:
{ \
struct G_DESCR_HELPER_CLASS(Class) \
{ \
static constexpr const char *descr() { return Descr; }; \
static constexpr const char *descr() { return Descr; } \
}; \
}
@@ -231,10 +231,10 @@ template<typename T> struct GObtainCtor {
static HostCtor get() { return HostCtor{}; }
};
template<typename T> struct GObtainCtor<GArray<T> > {
static HostCtor get() { return HostCtor{ConstructVec{&GArray<T>::VCtor}}; };
static HostCtor get() { return HostCtor{ConstructVec{&GArray<T>::VCtor}}; }
};
template<typename T> struct GObtainCtor<GOpaque<T> > {
static HostCtor get() { return HostCtor{ConstructOpaque{&GOpaque<T>::Ctor}}; };
static HostCtor get() { return HostCtor{ConstructOpaque{&GOpaque<T>::Ctor}}; }
};
} // namespace detail
} // namespace cv
+1 -1
View File
@@ -40,7 +40,7 @@ namespace detail
//workaround for MSVC 19.0 bug
template <typename T>
auto make_default()->decltype(T{}) {return {};}
}; // detail
} // detail
/**
* @brief This class is a typed wrapper over a regular GComputation.
@@ -173,7 +173,7 @@ public:
, {}
, {}
, {} } {
};
}
/** @overload
Use this constructor to work with pre-compiled network.
@@ -202,7 +202,7 @@ public:
, {}
, {}
, {} } {
};
}
/** @brief Specifies sequence of network input layers names for inference.
@@ -547,7 +547,7 @@ public:
detail::ParamDesc::Kind::Load, true, {}, {}, {}, 1u,
{}, {}, {}, {}, InferMode::Async, {}, {}, {}, {} },
m_tag(tag) {
};
}
/** @overload
@@ -565,7 +565,7 @@ public:
detail::ParamDesc::Kind::Import, true, {}, {}, {}, 1u,
{}, {}, {}, {}, InferMode::Async, {}, {}, {}, {} },
m_tag(tag) {
};
}
/** @see ie::Params::pluginConfig. */
Params& pluginConfig(const IEConfig& cfg) {
@@ -293,7 +293,7 @@ public:
desc.num_out = std::tuple_size<typename Net::OutArgs>::value;
desc.is_generic = false;
desc.disable_mem_pattern = false;
};
}
/** @brief Specifies sequence of network input layers names for inference.
@@ -33,6 +33,7 @@ namespace cv {
* @brief Extra G-API data structures used to pass input/output data
* to the graph for processing.
*/
/**
* @brief cv::MediaFrame class represents an image/media frame
* obtained from an external source.
@@ -31,7 +31,7 @@ namespace cv
return (m.dims == 2)
? cv::gapi::own::Mat{m.rows, m.cols, m.type(), m.data, m.step}
: cv::gapi::own::Mat{to_own<int>(m.size), m.type(), m.data};
};
}
namespace gapi
{
@@ -21,7 +21,7 @@ class GAPI_EXPORTS Scalar
{
public:
Scalar() = default;
explicit Scalar(double v0) { val[0] = v0; };
explicit Scalar(double v0) { val[0] = v0; }
Scalar(double v0, double v1, double v2 = 0, double v3 = 0)
: val{v0, v1, v2, v3}
{
+1 -1
View File
@@ -337,7 +337,7 @@ namespace detail {
template<typename V>
IOStream& put_v(IOStream&, const V&, std::size_t) {
GAPI_Error("variant>>: requested index is invalid");
};
}
template<typename V, typename X, typename... Xs>
IOStream& put_v(IOStream& os, const V& v, std::size_t x) {
+1 -1
View File
@@ -321,7 +321,7 @@ PyObject* pyopencv_from(const cv::detail::OpaqueRef& o)
PyErr_SetString(PyExc_TypeError, "Unsupported GOpaque type");
return NULL;
};
}
template <>
PyObject* pyopencv_from(const cv::detail::VectorRef& v)
+2 -2
View File
@@ -137,7 +137,7 @@ public:
using Storage = cv::detail::MakeVariantType<cv::GOpaque, GOPAQUE_TYPE_LIST_G(ID_, ID)>;
template<typename T>
GOpaqueT(cv::GOpaque<T> arg) : m_type(cv::detail::ArgTypeTraits<T>::type), m_arg(arg) { };
GOpaqueT(cv::GOpaque<T> arg) : m_type(cv::detail::ArgTypeTraits<T>::type), m_arg(arg) { }
GAPI_WRAP GOpaqueT(gapi::ArgType type) : m_type(type)
{
@@ -175,7 +175,7 @@ public:
using Storage = cv::detail::MakeVariantType<cv::GArray, GARRAY_TYPE_LIST_G(ID_, ID)>;
template<typename T>
GArrayT(cv::GArray<T> arg) : m_type(cv::detail::ArgTypeTraits<T>::type), m_arg(arg) { };
GArrayT(cv::GArray<T> arg) : m_type(cv::detail::ArgTypeTraits<T>::type), m_arg(arg) { }
GAPI_WRAP GArrayT(gapi::ArgType type) : m_type(type)
{
@@ -16,7 +16,7 @@ void create_rand_mats(const cv::Size &size, MatType type, cv::Mat &ref_mat, cv::
ref_mat.create(size, type);
cv::randu(ref_mat, cv::Scalar::all(0), cv::Scalar::all(255));
ref_mat.copyTo(gapi_mat);
};
}
} // namespace
+5 -5
View File
@@ -67,7 +67,7 @@ inline void mosaic(cv::Mat& mat, const cv::Rect &rect, int cellSz)
cell_roi = cv::mean(cell_roi);
}
}
};
}
inline void blendImage(const cv::Mat& img,
const cv::Mat& alpha,
@@ -120,7 +120,7 @@ inline void poly(cv::Mat& mat,
{
std::vector<std::vector<cv::Point>> points{pp.points};
cv::fillPoly(mat, points, pp.color, pp.lt, pp.shift);
};
}
struct BGR2YUVConverter
{
@@ -133,13 +133,13 @@ struct BGR2YUVConverter
return {y, u, v};
}
void cvtImg(const cv::Mat& in, cv::Mat& out) { cv::cvtColor(in, out, cv::COLOR_BGR2YUV); };
void cvtImg(const cv::Mat& in, cv::Mat& out) { cv::cvtColor(in, out, cv::COLOR_BGR2YUV); }
};
struct EmptyConverter
{
cv::Scalar cvtColor(const cv::Scalar& bgr) const { return bgr; };
void cvtImg(const cv::Mat& in, cv::Mat& out) const { out = in; };
cv::Scalar cvtColor(const cv::Scalar& bgr) const { return bgr; }
void cvtImg(const cv::Mat& in, cv::Mat& out) const { out = in; }
};
// FIXME util::visitor ?
@@ -8,9 +8,8 @@
#include <map> // map
#include <ade/util/zip_range.hpp> // indexed
#define NOMINMAX
#ifdef _WIN32
#define NOMINMAX
#include <winsock.h> // htonl, ntohl
#else
#include <netinet/in.h> // htonl, ntohl
@@ -195,7 +195,7 @@ class GAPI_EXPORTS ByteMemoryInStream final: public IIStream {
size_t m_idx = 0u;
void check(std::size_t n) { (void) n; GAPI_DbgAssert(m_idx+n-1 < m_storage.size()); }
uint32_t getU32() { uint32_t v{}; *this >> v; return v; };
uint32_t getU32() { uint32_t v{}; *this >> v; return v; }
//virtual IIStream& operator>> (uint32_t &) final;
@@ -159,7 +159,7 @@ struct Copy: public cv::detail::KernelTag
return cv::gapi::streaming::IActor::Ptr(new Actor(args));
}
static cv::gapi::streaming::GStreamingKernel kernel() { return {&create}; };
static cv::gapi::streaming::GStreamingKernel kernel() { return {&create}; }
};
void Copy::Actor::run(cv::gimpl::GIslandExecutable::IInput &in,
@@ -249,7 +249,7 @@ struct GOCVBGR: public cv::detail::KernelTag
{
return cv::gapi::streaming::IActor::Ptr(new Actor(args));
}
static cv::gapi::streaming::GStreamingKernel kernel() { return {&create}; };
static cv::gapi::streaming::GStreamingKernel kernel() { return {&create}; }
};
void GOCVBGR::Actor::extractRMat(const cv::MediaFrame& frame, cv::RMat& rmat)
@@ -323,7 +323,7 @@ struct GOCVY: public cv::detail::KernelTag
{
return cv::gapi::streaming::IActor::Ptr(new Actor(args));
}
static cv::gapi::streaming::GStreamingKernel kernel() { return {&create}; };
static cv::gapi::streaming::GStreamingKernel kernel() { return {&create}; }
};
void GOCVY::Actor::extractRMat(const cv::MediaFrame& frame, cv::RMat& rmat)
@@ -389,7 +389,7 @@ struct GOCVUV: public cv::detail::KernelTag
{
return cv::gapi::streaming::IActor::Ptr(new Actor(args));
}
static cv::gapi::streaming::GStreamingKernel kernel() { return {&create}; };
static cv::gapi::streaming::GStreamingKernel kernel() { return {&create}; }
};
void GOCVUV::Actor::extractRMat(const cv::MediaFrame& frame, cv::RMat& rmat)
+1 -1
View File
@@ -27,7 +27,7 @@ namespace cv {
namespace gimpl
{
struct GRuntimeArgs;
};
}
// FIXME: GAPI_EXPORTS is here only due to tests and Windows linker issues
class GAPI_EXPORTS GCompiled::Priv
@@ -16,7 +16,7 @@ namespace cv {
namespace gimpl
{
struct GRuntimeArgs;
};
}
// FIXME: GAPI_EXPORTS is here only due to tests and Windows linker issues
// FIXME: It seems it clearly duplicates the GStreamingCompiled and
@@ -73,7 +73,7 @@ bool compareDataNodes(const ade::NodeHandle& first, const std::vector<std::size_
// check that first and second nodes have the same type of DATA::Storage.
return true;
};
}
// Returns true if two OP nodes semantically and structurally identical:
// - both nodes have the same kernel name
@@ -130,7 +130,7 @@ bool compareOpNodes(const VisitedMatchings& matchedVisitedNodes,
}
return true;
};
}
// Retrieves and return sample from the cartesian product of candidates sets
VisitedMatchings sampleFromProduct(std::size_t sampleIdx, // index of the sample in the product
@@ -168,7 +168,7 @@ std::size_t labelOf (const ade::NodeHandle& node, // reader node
else {
return graph.metadata(edge).get<cv::gimpl::Output>().port;
}
};
}
inline bool IS_STARTPOINT(const ade::NodeHandle& nh){
return nh->inEdges().empty();
@@ -1699,7 +1699,7 @@ namespace {
return cv::MediaFrame::View(std::move(pp), std::move(ss));
}
};
};
}
namespace {
class TestMediaGray final : public cv::MediaFrame::IAdapter {
@@ -1718,7 +1718,7 @@ namespace {
return cv::MediaFrame::View(std::move(pp), std::move(ss));
}
};
};
}
TEST_P(SizeMFTest, ParseTest)
{
@@ -92,6 +92,6 @@ void blendImageRef(cv::Mat& mat, const cv::Point& org, const cv::Mat& img, const
roi32f += img32f;
roi32f.convertTo(roi, CV_8U, 255.0);
};
}
} // namespace opencv_test
@@ -115,7 +115,7 @@ struct Fixture : public RenderNV12TestBase API { \
__WRAP_VAARGS(DEFINE_SPECIFIC_PARAMS_##Number(__VA_ARGS__)) \
Fixture() { \
Init(sz_); \
}; \
} \
};
#define GAPI_RENDER_TEST_FIXTURE_BGR(Fixture, API, Number, ...) \
@@ -123,7 +123,7 @@ struct Fixture : public RenderBGRTestBase API { \
__WRAP_VAARGS(DEFINE_SPECIFIC_PARAMS_##Number(__VA_ARGS__)) \
Fixture() { \
Init(sz_); \
}; \
} \
};
#define GET_VA_ARGS(...) __VA_ARGS__
@@ -165,7 +165,7 @@ namespace
out = true;
}
};
};
}
TEST(StatefulKernel, StateInitOnceInRegularMode)
{
@@ -190,7 +190,7 @@ TEST(StatefulKernel, StateInitOnceInRegularMode)
EXPECT_TRUE(params.pSetupsCount != nullptr);
EXPECT_EQ(1, *params.pSetupsCount);
}
};
}
struct StateInitOnce : public ::testing::TestWithParam<bool>{};
TEST_P(StateInitOnce, StreamingCompiledWithMeta)
+1 -1
View File
@@ -207,7 +207,7 @@ struct CallBack: crtp_cast<crtp_final_t> {
mtx.unlock();
cv.notify_one();
};
};
}
template<typename... Args >
void start_async(Args&&... args){
+3 -3
View File
@@ -28,12 +28,12 @@ namespace
void WriteFunction(uint8_t* row, int nr, int w) {
for (int i = 0; i < w; i++)
row[i] = static_cast<uint8_t>(nr+i);
};
}
void ReadFunction1x1(const uint8_t* row, int w) {
for (int i = 0; i < w; i++)
std::cout << std::setw(4) << static_cast<int>(row[i]) << " ";
std::cout << "\n";
};
}
void ReadFunction3x3(const uint8_t* rows[3], int w) {
for (int i = 0; i < 3; i++) {
for (int j = -1; j < w+1; j++) {
@@ -42,7 +42,7 @@ namespace
std::cout << "\n";
}
std::cout << "\n";
};
}
}
TEST(FluidBuffer, InputTest)
+2 -2
View File
@@ -215,7 +215,7 @@ TEST(KernelPackage, RemoveBackend)
EXPECT_FALSE(pkg.includes<J::Foo>());
EXPECT_FALSE(pkg.includes<J::Bar>());
EXPECT_TRUE(pkg.includes<S::Baz>());
};
}
TEST(KernelPackage, RemoveAPI)
{
@@ -228,7 +228,7 @@ TEST(KernelPackage, RemoveAPI)
pkg.remove<I::Foo>();
EXPECT_TRUE(pkg.includes<J::Bar>());
EXPECT_FALSE(pkg.includes<J::Foo>());
};
}
TEST(KernelPackage, CreateHetero)
{
@@ -55,7 +55,7 @@ public:
GMockExecutable(bool can_reshape = true)
: m_priv(new Priv{can_reshape, 0, 0})
{
};
}
void setReshape(bool can_reshape) { m_priv->m_can_reshape = can_reshape; }
@@ -92,7 +92,7 @@ class GMockBackendImpl final: public cv::gapi::GBackend::Priv
}
public:
GMockBackendImpl(const GMockExecutable& exec) : m_exec(exec) { };
GMockBackendImpl(const GMockExecutable& exec) : m_exec(exec) { }
int getCompileCounter() const { return m_compile_counter; }
};
@@ -124,8 +124,8 @@ GMockFunctor mock_kernel(const cv::gapi::GBackend& backend, Callable c)
};
}
void dummyFooImpl(const cv::Mat&, cv::Mat&) { };
void dummyBarImpl(const cv::Mat&, const cv::Mat&, cv::Mat&) { };
void dummyFooImpl(const cv::Mat&, cv::Mat&) { }
void dummyBarImpl(const cv::Mat&, const cv::Mat&, cv::Mat&) { }
struct GExecutorReshapeTest: public ::testing::Test
{
@@ -155,7 +155,7 @@ struct GExecutorReshapeTest: public ::testing::Test
std::shared_ptr<GMockBackendImpl> backend_impl2;
cv::gapi::GBackend backend2;
cv::GKernelPackage pkg;
cv::Mat in_mat1, in_mat2, out_mat;;
cv::Mat in_mat1, in_mat2, out_mat;
};
} // anonymous namespace
@@ -627,7 +627,7 @@ namespace
void assignIsland(const std::string &s)
{
cv::gapi::island(s, cv::GIn(tmp[0]), cv::GOut(tmp[2]));
};
}
};
TEST_P(CheckName, Test)
{