From 5575171652b544b20c7cef22a3f5817d38eacfaa Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Fri, 28 Sep 2018 16:53:05 +0300 Subject: [PATCH] Merge pull request #12673 from alalek:fix_build_warnings * fix build warnings * python: forbid wrapping of functions with "void*" arguments --- modules/core/include/opencv2/core/cuda.hpp | 4 ++-- modules/python/src2/cv2.cpp | 2 +- modules/python/src2/gen2.py | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/core/include/opencv2/core/cuda.hpp b/modules/core/include/opencv2/core/cuda.hpp index 4863a65674..b49e75dc5f 100644 --- a/modules/core/include/opencv2/core/cuda.hpp +++ b/modules/core/include/opencv2/core/cuda.hpp @@ -134,8 +134,8 @@ public: CV_WRAP GpuMat(const GpuMat& m); //! constructor for GpuMat headers pointing to user-allocated data - CV_WRAP GpuMat(int rows, int cols, int type, void* data, size_t step = Mat::AUTO_STEP); - CV_WRAP GpuMat(Size size, int type, void* data, size_t step = Mat::AUTO_STEP); + GpuMat(int rows, int cols, int type, void* data, size_t step = Mat::AUTO_STEP); + GpuMat(Size size, int type, void* data, size_t step = Mat::AUTO_STEP); //! creates a GpuMat header for a part of the bigger matrix CV_WRAP GpuMat(const GpuMat& m, Range rowRange, Range colRange); diff --git a/modules/python/src2/cv2.cpp b/modules/python/src2/cv2.cpp index 5ae963a94f..e5504adfdb 100644 --- a/modules/python/src2/cv2.cpp +++ b/modules/python/src2/cv2.cpp @@ -92,7 +92,7 @@ bool pyopencv_to(PyObject* dst, TYPE& src, const char* name) { \ if (!dst || dst == Py_None) \ return true; \ - std::underlying_type::type underlying; \ + std::underlying_type::type underlying = 0; \ \ if (!pyopencv_to(dst, underlying, name)) return false; \ src = static_cast(underlying); \ diff --git a/modules/python/src2/gen2.py b/modules/python/src2/gen2.py index 9830d9637c..3e774fc5c9 100755 --- a/modules/python/src2/gen2.py +++ b/modules/python/src2/gen2.py @@ -10,6 +10,8 @@ if sys.version_info[0] >= 3: else: from cStringIO import StringIO +forbidden_arg_types = ["void*"] + ignored_arg_types = ["RNG*"] pass_by_val_types = ["Point*", "Point2f*", "Rect*", "String*", "double*", "float*", "int*"] @@ -483,6 +485,7 @@ class FuncVariant(object): argno += 1 if a.name in self.array_counters: continue + assert not a.tp in forbidden_arg_types, 'Forbidden type "{}" for argument "{}" in "{}" ("{}")'.format(a.tp, a.name, self.name, self.classname) if a.tp in ignored_arg_types: continue if a.returnarg: @@ -671,7 +674,7 @@ class FuncInfo(object): if a.tp in ignored_arg_types: defval = a.defval if not defval and a.tp.endswith("*"): - defval = 0 + defval = "0" assert defval if not code_args.endswith("("): code_args += ", "