Commit 6773b938 authored by Alexander Alekhin's avatar Alexander Alekhin

Merge pull request #15896 from alalek:build_gcc_9

parents 94f1c3d1 7ecdcf6c
...@@ -22,6 +22,7 @@ else() ...@@ -22,6 +22,7 @@ else()
-Wenum-compare-switch -Wenum-compare-switch
-Wsuggest-override -Winconsistent-missing-override -Wsuggest-override -Winconsistent-missing-override
-Wimplicit-fallthrough -Wimplicit-fallthrough
-Warray-bounds # GCC 9+
) )
endif() endif()
if(CV_ICC) if(CV_ICC)
......
...@@ -377,6 +377,7 @@ macro(ocv_clear_vars) ...@@ -377,6 +377,7 @@ macro(ocv_clear_vars)
endmacro() endmacro()
set(OCV_COMPILER_FAIL_REGEX set(OCV_COMPILER_FAIL_REGEX
"argument '.*' is not valid" # GCC 9+
"command line option .* is valid for .* but not for C\\+\\+" # GNU "command line option .* is valid for .* but not for C\\+\\+" # GNU
"command line option .* is valid for .* but not for C" # GNU "command line option .* is valid for .* but not for C" # GNU
"unrecognized .*option" # GNU "unrecognized .*option" # GNU
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
//M*/ //M*/
#include "precomp.hpp" #include "precomp.hpp"
#include "upnp.h" //#include "upnp.h"
#include "dls.h" #include "dls.h"
#include "epnp.h" #include "epnp.h"
#include "p3p.h" #include "p3p.h"
......
...@@ -49,6 +49,8 @@ ...@@ -49,6 +49,8 @@
#include "upnp.h" #include "upnp.h"
#include <limits> #include <limits>
#if 0 // fix buffer overflow first (FIXIT mark in .cpp file)
using namespace std; using namespace std;
using namespace cv; using namespace cv;
...@@ -313,7 +315,9 @@ void upnp::compute_ccs(const double * betas, const double * ut) ...@@ -313,7 +315,9 @@ void upnp::compute_ccs(const double * betas, const double * ut)
const double * v = ut + 12 * (9 + i); const double * v = ut + 12 * (9 + i);
for(int j = 0; j < 4; ++j) for(int j = 0; j < 4; ++j)
for(int k = 0; k < 3; ++k) for(int k = 0; k < 3; ++k)
ccs[j][k] += betas[i] * v[3 * j + k]; ccs[j][k] += betas[i] * v[3 * j + k]; // FIXIT: array subscript 144 is outside array bounds of 'double [144]' [-Warray-bounds]
// line 109: double ut[12 * 12]
// line 359: double u[12*12]
} }
for (int i = 0; i < 4; ++i) ccs[i][2] *= fu; for (int i = 0; i < 4; ++i) ccs[i][2] *= fu;
...@@ -821,3 +825,5 @@ void upnp::qr_solve(Mat * A, Mat * b, Mat * X) ...@@ -821,3 +825,5 @@ void upnp::qr_solve(Mat * A, Mat * b, Mat * X)
pX[i] = (pb[i] - sum) / A2[i]; pX[i] = (pb[i] - sum) / A2[i];
} }
} }
#endif
...@@ -52,6 +52,8 @@ ...@@ -52,6 +52,8 @@
#include "opencv2/core/core_c.h" #include "opencv2/core/core_c.h"
#include <iostream> #include <iostream>
#if 0 // fix buffer overflow first (FIXIT mark in .cpp file)
class upnp class upnp
{ {
public: public:
...@@ -133,4 +135,6 @@ private: ...@@ -133,4 +135,6 @@ private:
double * A1, * A2; double * A1, * A2;
}; };
#endif
#endif // OPENCV_CALIB3D_UPNP_H_ #endif // OPENCV_CALIB3D_UPNP_H_
...@@ -526,6 +526,8 @@ public: ...@@ -526,6 +526,8 @@ public:
*/ */
FileNode(const FileNode& node); FileNode(const FileNode& node);
FileNode& operator=(const FileNode& node);
/** @brief Returns element of a mapping node or a sequence node. /** @brief Returns element of a mapping node or a sequence node.
@param nodename Name of an element in the mapping node. @param nodename Name of an element in the mapping node.
@returns Returns the element with the given identifier. @returns Returns the element with the given identifier.
...@@ -645,6 +647,8 @@ public: ...@@ -645,6 +647,8 @@ public:
*/ */
FileNodeIterator(const FileNodeIterator& it); FileNodeIterator(const FileNodeIterator& it);
FileNodeIterator& operator=(const FileNodeIterator& it);
//! returns the currently observed element //! returns the currently observed element
FileNode operator *() const; FileNode operator *() const;
//! accesses the currently observed element methods //! accesses the currently observed element methods
...@@ -1326,6 +1330,7 @@ inline FileNode FileStorage::getFirstTopLevelNode() const { FileNode r = root(); ...@@ -1326,6 +1330,7 @@ inline FileNode FileStorage::getFirstTopLevelNode() const { FileNode r = root();
inline FileNode::FileNode() : fs(0), node(0) {} inline FileNode::FileNode() : fs(0), node(0) {}
inline FileNode::FileNode(const CvFileStorage* _fs, const CvFileNode* _node) : fs(_fs), node(_node) {} inline FileNode::FileNode(const CvFileStorage* _fs, const CvFileNode* _node) : fs(_fs), node(_node) {}
inline FileNode::FileNode(const FileNode& _node) : fs(_node.fs), node(_node.node) {} inline FileNode::FileNode(const FileNode& _node) : fs(_node.fs), node(_node.node) {}
inline FileNode& FileNode::operator=(const FileNode& _node) { fs = _node.fs; node = _node.node; return *this; }
inline bool FileNode::empty() const { return node == 0; } inline bool FileNode::empty() const { return node == 0; }
inline bool FileNode::isNone() const { return type() == NONE; } inline bool FileNode::isNone() const { return type() == NONE; }
inline bool FileNode::isSeq() const { return type() == SEQ; } inline bool FileNode::isSeq() const { return type() == SEQ; }
......
...@@ -328,6 +328,15 @@ FileNodeIterator::FileNodeIterator(const FileNodeIterator& it) ...@@ -328,6 +328,15 @@ FileNodeIterator::FileNodeIterator(const FileNodeIterator& it)
remaining = it.remaining; remaining = it.remaining;
} }
FileNodeIterator& FileNodeIterator::operator=(const FileNodeIterator& it)
{
fs = it.fs;
container = it.container;
reader = it.reader;
remaining = it.remaining;
return *this;
}
FileNodeIterator& FileNodeIterator::operator ++() FileNodeIterator& FileNodeIterator::operator ++()
{ {
if( remaining > 0 ) if( remaining > 0 )
......
...@@ -634,10 +634,13 @@ CV_IMPL int cvStartWindowThread(){ ...@@ -634,10 +634,13 @@ CV_IMPL int cvStartWindowThread(){
cvInitSystem(0,NULL); cvInitSystem(0,NULL);
if (!thread_started) if (!thread_started)
{ {
if (!g_thread_supported ()) { #if !GLIB_CHECK_VERSION(2, 32, 0) // https://github.com/GNOME/glib/blame/b4d58a7105bb9d75907233968bb534b38f9a6e43/glib/deprecated/gthread.h#L274
if (!g_thread_supported ())
{
/* the GThread system wasn't inited, so init it */ /* the GThread system wasn't inited, so init it */
g_thread_init(NULL); g_thread_init(NULL);
} }
#endif
(void)getWindowMutex(); // force mutex initialization (void)getWindowMutex(); // force mutex initialization
......
...@@ -22,6 +22,7 @@ private: ...@@ -22,6 +22,7 @@ private:
public: public:
typedef fixedpoint64 WT; typedef fixedpoint64 WT;
CV_ALWAYS_INLINE fixedpoint64() { val = 0; } CV_ALWAYS_INLINE fixedpoint64() { val = 0; }
CV_ALWAYS_INLINE fixedpoint64(const fixedpoint64& v) { val = v.val; }
CV_ALWAYS_INLINE fixedpoint64(const int8_t& _val) { val = ((int64_t)_val) << fixedShift; } CV_ALWAYS_INLINE fixedpoint64(const int8_t& _val) { val = ((int64_t)_val) << fixedShift; }
CV_ALWAYS_INLINE fixedpoint64(const uint8_t& _val) { val = ((int64_t)_val) << fixedShift; } CV_ALWAYS_INLINE fixedpoint64(const uint8_t& _val) { val = ((int64_t)_val) << fixedShift; }
CV_ALWAYS_INLINE fixedpoint64(const int16_t& _val) { val = ((int64_t)_val) << fixedShift; } CV_ALWAYS_INLINE fixedpoint64(const int16_t& _val) { val = ((int64_t)_val) << fixedShift; }
...@@ -104,6 +105,7 @@ private: ...@@ -104,6 +105,7 @@ private:
public: public:
typedef ufixedpoint64 WT; typedef ufixedpoint64 WT;
CV_ALWAYS_INLINE ufixedpoint64() { val = 0; } CV_ALWAYS_INLINE ufixedpoint64() { val = 0; }
CV_ALWAYS_INLINE ufixedpoint64(const ufixedpoint64& v) { val = v.val; }
CV_ALWAYS_INLINE ufixedpoint64(const uint8_t& _val) { val = ((uint64_t)_val) << fixedShift; } CV_ALWAYS_INLINE ufixedpoint64(const uint8_t& _val) { val = ((uint64_t)_val) << fixedShift; }
CV_ALWAYS_INLINE ufixedpoint64(const uint16_t& _val) { val = ((uint64_t)_val) << fixedShift; } CV_ALWAYS_INLINE ufixedpoint64(const uint16_t& _val) { val = ((uint64_t)_val) << fixedShift; }
CV_ALWAYS_INLINE ufixedpoint64(const uint32_t& _val) { val = ((uint64_t)_val) << fixedShift; } CV_ALWAYS_INLINE ufixedpoint64(const uint32_t& _val) { val = ((uint64_t)_val) << fixedShift; }
...@@ -169,6 +171,7 @@ private: ...@@ -169,6 +171,7 @@ private:
public: public:
typedef fixedpoint64 WT; typedef fixedpoint64 WT;
CV_ALWAYS_INLINE fixedpoint32() { val = 0; } CV_ALWAYS_INLINE fixedpoint32() { val = 0; }
CV_ALWAYS_INLINE fixedpoint32(const fixedpoint32& v) { val = v.val; }
CV_ALWAYS_INLINE fixedpoint32(const int8_t& _val) { val = ((int32_t)_val) << fixedShift; } CV_ALWAYS_INLINE fixedpoint32(const int8_t& _val) { val = ((int32_t)_val) << fixedShift; }
CV_ALWAYS_INLINE fixedpoint32(const uint8_t& _val) { val = ((int32_t)_val) << fixedShift; } CV_ALWAYS_INLINE fixedpoint32(const uint8_t& _val) { val = ((int32_t)_val) << fixedShift; }
CV_ALWAYS_INLINE fixedpoint32(const int16_t& _val) { val = ((int32_t)_val) << fixedShift; } CV_ALWAYS_INLINE fixedpoint32(const int16_t& _val) { val = ((int32_t)_val) << fixedShift; }
...@@ -222,6 +225,7 @@ private: ...@@ -222,6 +225,7 @@ private:
public: public:
typedef ufixedpoint64 WT; typedef ufixedpoint64 WT;
CV_ALWAYS_INLINE ufixedpoint32() { val = 0; } CV_ALWAYS_INLINE ufixedpoint32() { val = 0; }
CV_ALWAYS_INLINE ufixedpoint32(const ufixedpoint32& v) { val = v.val; }
CV_ALWAYS_INLINE ufixedpoint32(const uint8_t& _val) { val = ((uint32_t)_val) << fixedShift; } CV_ALWAYS_INLINE ufixedpoint32(const uint8_t& _val) { val = ((uint32_t)_val) << fixedShift; }
CV_ALWAYS_INLINE ufixedpoint32(const uint16_t& _val) { val = ((uint32_t)_val) << fixedShift; } CV_ALWAYS_INLINE ufixedpoint32(const uint16_t& _val) { val = ((uint32_t)_val) << fixedShift; }
CV_ALWAYS_INLINE ufixedpoint32(const cv::softdouble& _val) { val = _val.getSign() ? 0 : (uint32_t)cvRound(_val * cv::softdouble((1 << fixedShift))); } CV_ALWAYS_INLINE ufixedpoint32(const cv::softdouble& _val) { val = _val.getSign() ? 0 : (uint32_t)cvRound(_val * cv::softdouble((1 << fixedShift))); }
...@@ -271,6 +275,7 @@ private: ...@@ -271,6 +275,7 @@ private:
public: public:
typedef fixedpoint32 WT; typedef fixedpoint32 WT;
CV_ALWAYS_INLINE fixedpoint16() { val = 0; } CV_ALWAYS_INLINE fixedpoint16() { val = 0; }
CV_ALWAYS_INLINE fixedpoint16(const fixedpoint16& v) { val = v.val; }
CV_ALWAYS_INLINE fixedpoint16(const int8_t& _val) { val = ((int16_t)_val) << fixedShift; } CV_ALWAYS_INLINE fixedpoint16(const int8_t& _val) { val = ((int16_t)_val) << fixedShift; }
CV_ALWAYS_INLINE fixedpoint16(const cv::softdouble& _val) { val = (int16_t)cvRound(_val * cv::softdouble((1 << fixedShift))); } CV_ALWAYS_INLINE fixedpoint16(const cv::softdouble& _val) { val = (int16_t)cvRound(_val * cv::softdouble((1 << fixedShift))); }
CV_ALWAYS_INLINE fixedpoint16& operator = (const int8_t& _val) { val = ((int16_t)_val) << fixedShift; return *this; } CV_ALWAYS_INLINE fixedpoint16& operator = (const int8_t& _val) { val = ((int16_t)_val) << fixedShift; return *this; }
...@@ -317,6 +322,7 @@ private: ...@@ -317,6 +322,7 @@ private:
public: public:
typedef ufixedpoint32 WT; typedef ufixedpoint32 WT;
CV_ALWAYS_INLINE ufixedpoint16() { val = 0; } CV_ALWAYS_INLINE ufixedpoint16() { val = 0; }
CV_ALWAYS_INLINE ufixedpoint16(const ufixedpoint16& v) { val = v.val; }
CV_ALWAYS_INLINE ufixedpoint16(const uint8_t& _val) { val = ((uint16_t)_val) << fixedShift; } CV_ALWAYS_INLINE ufixedpoint16(const uint8_t& _val) { val = ((uint16_t)_val) << fixedShift; }
CV_ALWAYS_INLINE ufixedpoint16(const cv::softdouble& _val) { val = _val.getSign() ? 0 : (uint16_t)cvRound(_val * cv::softdouble((int32_t)(1 << fixedShift))); } CV_ALWAYS_INLINE ufixedpoint16(const cv::softdouble& _val) { val = _val.getSign() ? 0 : (uint16_t)cvRound(_val * cv::softdouble((int32_t)(1 << fixedShift))); }
CV_ALWAYS_INLINE ufixedpoint16& operator = (const uint8_t& _val) { val = ((uint16_t)_val) << fixedShift; return *this; } CV_ALWAYS_INLINE ufixedpoint16& operator = (const uint8_t& _val) { val = ((uint16_t)_val) << fixedShift; return *this; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment