From b7c186f6d397b0b1b7c2a3a9476b535d5ef671b4 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 26 Aug 2020 15:19:23 +0100 Subject: [PATCH] Fixed warnings reported by gcc-9.3.0 Note from glebm@: Back-ported from https://github.com/openscenegraph/OpenSceneGraph/commit/e0d5e4b0ffa382ea0cf1d3290937722950a9ed80 Identical except for the changes to `MatrixTemplate`, which does not exist in 3.6 --- include/osg/BoundingSphere | 7 +++++++ include/osg/GLExtensions | 9 +++++++++ include/osg/Quat | 8 ++++++++ src/osg/glu/libtess/tess.cpp | 2 +- src/osgPlugins/dds/ReaderWriterDDS.cpp | 3 --- src/osgPlugins/gles/IndexMeshVisitor.cpp | 1 - src/osgPlugins/gles/glesUtil | 6 ------ src/osgPlugins/ive/DataInputStream.cpp | 2 +- src/osgPlugins/ive/DataOutputStream.cpp | 2 +- src/osgPlugins/osc/OscReceivingDevice.cpp | 22 +++++++++++----------- src/osgUtil/MeshOptimizers.cpp | 5 +++++ 11 files changed, 43 insertions(+), 24 deletions(-) diff --git a/include/osg/BoundingSphere b/include/osg/BoundingSphere index 4502e4595..d3903b380 100644 --- a/include/osg/BoundingSphere +++ b/include/osg/BoundingSphere @@ -63,6 +63,13 @@ class BoundingSphereImpl * otherwise. */ inline bool valid() const { return _radius>=0.0; } + inline BoundingSphereImpl& operator = (const BoundingSphereImpl& rhs) + { + _center = rhs._center; + _radius = rhs._radius; + return *this; + } + inline bool operator == (const BoundingSphereImpl& rhs) const { return _center==rhs._center && _radius==rhs._radius; } inline bool operator != (const BoundingSphereImpl& rhs) const { return _center!=rhs._center || _radius!=rhs._radius; } diff --git a/include/osg/GLExtensions b/include/osg/GLExtensions index aa868e9cf..28e810b69 100644 --- a/include/osg/GLExtensions +++ b/include/osg/GLExtensions @@ -149,6 +149,15 @@ class VertexAttribAlias _osgName(osgName), _declaration(declaration) {} + VertexAttribAlias& operator = (const VertexAttribAlias& rhs) + { + _location = rhs._location; + _glName = rhs._glName; + _osgName = rhs._osgName; + _declaration = rhs._declaration; + return *this; + } + GLuint _location; std::string _glName; std::string _osgName; diff --git a/include/osg/Quat b/include/osg/Quat index 863a029e8..adebc8768 100644 --- a/include/osg/Quat +++ b/include/osg/Quat @@ -53,6 +53,14 @@ class OSG_EXPORT Quat _v[3]=w; } + inline Quat( const Quat& rhs ) + { + _v[0]=rhs._v[0]; + _v[1]=rhs._v[1]; + _v[2]=rhs._v[2]; + _v[3]=rhs._v[3]; + } + inline Quat( const Vec4f& v ) { _v[0]=v.x(); diff --git a/src/osg/glu/libtess/tess.cpp b/src/osg/glu/libtess/tess.cpp index ccdbfada7..ca14854bc 100644 --- a/src/osg/glu/libtess/tess.cpp +++ b/src/osg/glu/libtess/tess.cpp @@ -213,7 +213,7 @@ osg::gluTessProperty( GLUtesselator *tess, GLenum which, GLdouble value ) tess->windingRule = windingRule; return; default: - break; + return; } case GLU_TESS_BOUNDARY_ONLY: diff --git a/src/osgPlugins/dds/ReaderWriterDDS.cpp b/src/osgPlugins/dds/ReaderWriterDDS.cpp index 26532d778..345cdfede 100644 --- a/src/osgPlugins/dds/ReaderWriterDDS.cpp +++ b/src/osgPlugins/dds/ReaderWriterDDS.cpp @@ -1079,15 +1079,12 @@ bool WriteDDSFile(const osg::Image *img, std::ostream& fout, bool autoFlipDDSWri // Initialize ddsd structure and its members DDSURFACEDESC2 ddsd; - memset( &ddsd, 0, sizeof( ddsd ) ); DDPIXELFORMAT ddpf; - memset( &ddpf, 0, sizeof( ddpf ) ); //DDCOLORKEY ddckCKDestOverlay; //DDCOLORKEY ddckCKDestBlt; //DDCOLORKEY ddckCKSrcOverlay; //DDCOLORKEY ddckCKSrcBlt; DDSCAPS2 ddsCaps; - memset( &ddsCaps, 0, sizeof( ddsCaps ) ); ddsd.dwSize = sizeof(ddsd); ddpf.dwSize = sizeof(ddpf); diff --git a/src/osgPlugins/gles/IndexMeshVisitor.cpp b/src/osgPlugins/gles/IndexMeshVisitor.cpp index 617a86221..7f6dc4f05 100644 --- a/src/osgPlugins/gles/IndexMeshVisitor.cpp +++ b/src/osgPlugins/gles/IndexMeshVisitor.cpp @@ -55,7 +55,6 @@ void IndexMeshVisitor::process(osg::Geometry& geom) { new_primitives.reserve(primitives.size()); // compute duplicate vertices - typedef std::vector IndexList; unsigned int numVertices = geom.getVertexArray()->getNumElements(); IndexList indices(numVertices); unsigned int i, j; diff --git a/src/osgPlugins/gles/glesUtil b/src/osgPlugins/gles/glesUtil index 88f381728..5071b3835 100644 --- a/src/osgPlugins/gles/glesUtil +++ b/src/osgPlugins/gles/glesUtil @@ -222,9 +222,6 @@ namespace glesUtil { virtual void apply(osg::Vec2ubArray& array) { remap(array); } virtual void apply(osg::MatrixfArray& array) { remap(array); } - - protected: - RemapArray& operator= (const RemapArray&) { return *this; } }; @@ -252,9 +249,6 @@ namespace glesUtil { } return 0; } - - protected: - VertexAttribComparitor& operator= (const VertexAttribComparitor&) { return *this; } }; // Move the values in an array to new positions, based on the diff --git a/src/osgPlugins/ive/DataInputStream.cpp b/src/osgPlugins/ive/DataInputStream.cpp index d53330343..3524c3e32 100644 --- a/src/osgPlugins/ive/DataInputStream.cpp +++ b/src/osgPlugins/ive/DataInputStream.cpp @@ -287,7 +287,7 @@ bool DataInputStream::uncompress(std::istream& fin, std::string& destination) co return ret == Z_STREAM_END ? true : false; } #else -bool DataInputStream::uncompress(std::istream& fin, std::string& destination) const +bool DataInputStream::uncompress(std::istream& /*fin*/, std::string& /*destination*/) const { return false; } diff --git a/src/osgPlugins/ive/DataOutputStream.cpp b/src/osgPlugins/ive/DataOutputStream.cpp index afeada60e..b55fd6e13 100644 --- a/src/osgPlugins/ive/DataOutputStream.cpp +++ b/src/osgPlugins/ive/DataOutputStream.cpp @@ -320,7 +320,7 @@ bool DataOutputStream::compress(std::ostream& fout, const std::string& source) c return true; } #else -bool DataOutputStream::compress(std::ostream& fout, const std::string& source) const +bool DataOutputStream::compress(std::ostream& /*fout*/, const std::string& /*source*/) const { return false; } diff --git a/src/osgPlugins/osc/OscReceivingDevice.cpp b/src/osgPlugins/osc/OscReceivingDevice.cpp index 3ca662c0b..ab9078886 100644 --- a/src/osgPlugins/osc/OscReceivingDevice.cpp +++ b/src/osgPlugins/osc/OscReceivingDevice.cpp @@ -309,7 +309,7 @@ public: return true; } - catch(osc::Exception e) { + catch(osc::Exception& e) { handleException(e); } @@ -342,7 +342,7 @@ public: return true; } - catch(osc::Exception e) { + catch(osc::Exception& e) { handleException(e); } @@ -378,7 +378,7 @@ public: return true; } - catch(osc::Exception e) { + catch(osc::Exception& e) { handleException(e); } @@ -413,7 +413,7 @@ public: return true; } - catch(osc::Exception e) { + catch(osc::Exception& e) { handleException(e); } @@ -449,7 +449,7 @@ public: return true; } - catch (osc::Exception e) { + catch (osc::Exception& e) { handleException(e); } return false; @@ -491,7 +491,7 @@ public: return true; } - catch (osc::Exception e) { + catch (osc::Exception& e) { handleException(e); } return false; @@ -529,7 +529,7 @@ public: return true; } - catch (osc::Exception e) { + catch (osc::Exception& e) { handleException(e); } return false; @@ -588,7 +588,7 @@ public: return true; } - catch (osc::Exception e) { + catch (osc::Exception& e) { handleException(e); } return false; @@ -630,7 +630,7 @@ public: return true; } - catch (osc::Exception e) { + catch (osc::Exception& e) { handleException(e); } return false; @@ -662,7 +662,7 @@ public: return true; } - catch (osc::Exception e) { + catch (osc::Exception& e) { handleException(e); } return false; @@ -695,7 +695,7 @@ public: return true; } - catch (osc::Exception e) { + catch (osc::Exception& e) { handleException(e); } return false; diff --git a/src/osgUtil/MeshOptimizers.cpp b/src/osgUtil/MeshOptimizers.cpp index f337fc436..5d5ef92d6 100644 --- a/src/osgUtil/MeshOptimizers.cpp +++ b/src/osgUtil/MeshOptimizers.cpp @@ -109,6 +109,11 @@ struct VertexAttribComparitor : public GeometryArrayGatherer { } + VertexAttribComparitor(const VertexAttribComparitor& rhs) + : GeometryArrayGatherer(rhs) + { + } + bool operator() (unsigned int lhs, unsigned int rhs) const { for(ArrayList::const_iterator itr=_arrayList.begin();