Fix GCC warnings with current default flags:

- default flags include warnings enabled by -Wall and -Wextra
    - suppressed newer warnings in public headers and internal files
      (-Wclass-memaccess, -Wcast-function-type, -Wdeprecated-copy)
    - suppressed -Wunused-function from internal source files
This commit is contained in:
Barry Fowler 2022-08-30 12:13:44 -07:00
parent 6ee81253a3
commit 810d7f671b
7 changed files with 37 additions and 16 deletions

View File

@ -253,7 +253,7 @@ namespace {
//
struct FacetStrip {
public:
FacetStrip() { std::memset(this, 0, sizeof(*this)); }
FacetStrip() { std::memset((void*) this, 0, sizeof(*this)); }
int connectUniformQuads( FacetArray facets) const;
int connectUniformTris( FacetArray facets) const;
@ -1988,7 +1988,7 @@ qsub::GetNonUniformFacets(int N, int const outerRes[], int innerRes,
void
Tessellation::initializeDefaults() {
std::memset(this, 0, sizeof(*this));
std::memset((void*) this, 0, sizeof(*this));
// Assign any non-zero defaults:
_triangulate = true;

View File

@ -1618,6 +1618,7 @@ namespace {
}
}
#ifdef FAR_DEBUG_LOOP_PATCH_BUILDER
void
_printSourcePatch(SourcePatch const & patch, bool printCornerInfo = true,
bool printRingPoints = true) {
@ -1650,6 +1651,7 @@ namespace {
}
}
}
#endif
}

View File

@ -64,7 +64,7 @@ namespace Far {
class SourcePatch {
public:
struct Corner {
Corner() { std::memset(this, 0, sizeof(Corner)); }
Corner() { std::memset((void*) this, 0, sizeof(Corner)); }
LocalIndex _numFaces; // valence of corner vertex
LocalIndex _patchFace; // location of patch within incident faces
@ -81,7 +81,7 @@ public:
};
public:
SourcePatch() { std::memset(this, 0, sizeof(SourcePatch)); }
SourcePatch() { std::memset((void*) this, 0, sizeof(SourcePatch)); }
~SourcePatch() { }
// To be called after all Corners have been initialized (hope to

View File

@ -77,6 +77,12 @@ public:
PatchDescriptor( PatchDescriptor const & d ) :
_type(d.GetType()) { }
/// \brief Assignment operator
PatchDescriptor & operator=( PatchDescriptor const & d ) {
_type = d.GetType();
return *this;
}
/// \brief Returns the type of the patch
Type GetType() const {
return (Type)_type;

View File

@ -322,6 +322,19 @@ protected:
// Not to be specialized:
//
static bool populateBaseLevel(TopologyRefiner& refiner, MESH const& mesh, Options options);
private:
//
// An oversight in the interfaces of the error reporting function between the factory
// class and the Vtr::Level requires this adapter function to avoid warnings.
//
// The static class method requires a reference as the MESH argument, but the interface
// for Vtr::Level requires a pointer (void*). So this adapter with a MESH* argument is
// used to effectively cast the function pointer required by Vtr::Level error reporting:
//
static void reportInvalidTopologyAdapter(TopologyError errCode, char const * msg, MESH const * mesh) {
reportInvalidTopology(errCode, msg, *mesh);
}
};
@ -380,7 +393,7 @@ TopologyRefinerFactory<MESH>::populateBaseLevel(TopologyRefiner& refiner, MESH c
// Otherwise edges and remaining topology will be completed from the face-vertices:
//
bool validate = options.validateFullTopology;
TopologyCallback callback = reinterpret_cast<TopologyCallback>(reportInvalidTopology);
TopologyCallback callback = reinterpret_cast<TopologyCallback>(reportInvalidTopologyAdapter);
void const * userData = &mesh;
if (! assignComponentTopology(refiner, mesh)) return false;

View File

@ -32,7 +32,7 @@
#include <cassert>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
@ -128,8 +128,8 @@ GLStencilTableSSBO::~GLStencilTableSSBO() {
GLComputeEvaluator::GLComputeEvaluator()
: _workGroupSize(64),
_patchArraysSSBO(0) {
memset (&_stencilKernel, 0, sizeof(_stencilKernel));
memset (&_patchKernel, 0, sizeof(_patchKernel));
std::memset((void*) &_stencilKernel, 0, sizeof(_stencilKernel));
std::memset((void*) &_patchKernel, 0, sizeof(_patchKernel));
// Initialize internal OpenGL loader library if necessary
OpenSubdiv::internal::GLLoader::libraryInitializeGL();

View File

@ -100,7 +100,7 @@ public:
// When cleared, the VTag ALMOST represents a smooth, regular, interior
// vertex -- the Type enum requires a bit be explicitly set for Smooth,
// so that must be done explicitly if desired on initialization.
void clear() { std::memset(this, 0, sizeof(VTag)); }
void clear() { std::memset((void*) this, 0, sizeof(VTag)); }
typedef unsigned short VTagSize;
@ -141,7 +141,7 @@ public:
ETag() { }
// When cleared, the ETag represents a smooth, manifold, interior edge
void clear() { std::memset(this, 0, sizeof(ETag)); }
void clear() { std::memset((void*) this, 0, sizeof(ETag)); }
typedef unsigned char ETagSize;
@ -165,7 +165,7 @@ public:
struct FTag {
FTag() { }
void clear() { std::memset(this, 0, sizeof(FTag)); }
void clear() { std::memset((void*) this, 0, sizeof(FTag)); }
typedef unsigned char FTagSize;
@ -191,9 +191,9 @@ public:
// use of the const method here to direct inspection of the member.
//
struct VSpan {
VSpan() { std::memset(this, 0, sizeof(VSpan)); }
VSpan() { std::memset((void*) this, 0, sizeof(VSpan)); }
void clear() { std::memset(this, 0, sizeof(VSpan)); }
void clear() { std::memset((void*) this, 0, sizeof(VSpan)); }
bool isAssigned() const { return _numFaces > 0; }
LocalIndex _numFaces;
@ -801,7 +801,7 @@ Level::resizeFaces(int faceCount) {
_faceVertCountsAndOffsets.resize(2 * faceCount);
_faceTags.resize(faceCount);
std::memset(&_faceTags[0], 0, _faceCount * sizeof(FTag));
std::memset((void*) &_faceTags[0], 0, _faceCount * sizeof(FTag));
}
inline void
Level::resizeFaceVertices(int totalFaceVertCount) {
@ -822,7 +822,7 @@ Level::resizeEdges(int edgeCount) {
_edgeTags.resize(edgeCount);
if (edgeCount>0) {
std::memset(&_edgeTags[0], 0, _edgeCount * sizeof(ETag));
std::memset((void*) &_edgeTags[0], 0, _edgeCount * sizeof(ETag));
}
}
inline void
@ -846,7 +846,7 @@ Level::resizeVertices(int vertCount) {
_vertSharpness.resize(vertCount);
_vertTags.resize(vertCount);
std::memset(&_vertTags[0], 0, _vertCount * sizeof(VTag));
std::memset((void*) &_vertTags[0], 0, _vertCount * sizeof(VTag));
}
inline void
Level::resizeVertexFaces(int totalVertFaceCount) {