Silence some annoying warnings when doing full build with strict flags

This mainly touches extern libraries and few debug-only places in intern.

Some summary:

- External libraries are not strict at all about missing declarations,
  so we can rather safely remove such warning together with other strict
  flags.

- Bullet has some static functions which are not used.
  Those were commented out.

- Carve now has some unused debug-only functions commented out as well.
  While we're on the way of getting rid of Carve, it makes sense to make
  things a bit cleaner for the time being.

- In LZMA we have some parts disabled which gives some set but unused
  variables which is rather correct.

- Elbeem had quite some variables set and never used because their usage
  is inside of debug-only code which is commented out.

Note about patching upstream libraries: surely one might say that we
have to make local patchset against this, but own experience says it
only gives extra work trying to merge such tweaks to a new upstream
version and usually it's just faster to re-apply such fixes again after
bundling new upstream library.
This commit is contained in:
Sergey Sharybin 2016-04-22 10:59:15 +02:00
parent d2cb0f955b
commit 87dcee0c0c
16 changed files with 48 additions and 19 deletions

@ -968,6 +968,7 @@ macro(remove_strict_flags)
remove_cc_flag(
"-Wstrict-prototypes"
"-Wmissing-prototypes"
"-Wmissing-declarations"
"-Wmissing-format-attribute"
"-Wunused-local-typedefs"
"-Wunused-macros"

@ -51,6 +51,7 @@ namespace {
bottom_out = -displacement.cross(top_out) + rotation_matrix * bottom_in;
}
/*
void InverseSpatialTransform(const btMatrix3x3 &rotation_matrix,
const btVector3 &displacement,
const btVector3 &top_in,
@ -80,6 +81,7 @@ namespace {
top_out = a_top.cross(b_top);
bottom_out = a_bottom.cross(b_top) + a_top.cross(b_bottom);
}
*/
}

@ -1127,6 +1127,7 @@ int nattrb=0;
int hasbounds=0;
int result = sscanf(node,"%d %d %d %d",&nnode,&ndims,&nattrb,&hasbounds);
result = sscanf(node,"%d %d %d %d",&nnode,&ndims,&nattrb,&hasbounds);
(void)result;
node += nextLine(node);
pos.resize(nnode);
@ -1208,10 +1209,10 @@ if(ele&&ele[0])
}
}
}
printf("Nodes: %u\r\n",psb->m_nodes.size());
printf("Links: %u\r\n",psb->m_links.size());
printf("Faces: %u\r\n",psb->m_faces.size());
printf("Tetras: %u\r\n",psb->m_tetras.size());
printf("Nodes: %d\r\n",psb->m_nodes.size());
printf("Links: %d\r\n",psb->m_links.size());
printf("Faces: %d\r\n",psb->m_faces.size());
printf("Tetras: %d\r\n",psb->m_tetras.size());
return(psb);
}

@ -422,7 +422,7 @@ static inline btVector3 BaryCoord( const btVector3& a,
}
//
static btScalar ImplicitSolve( btSoftBody::ImplicitFn* fn,
static inline btScalar ImplicitSolve( btSoftBody::ImplicitFn* fn,
const btVector3& a,
const btVector3& b,
const btScalar accuracy,
@ -504,7 +504,7 @@ static inline btScalar VolumeOf( const btVector3& x0,
}
//
static void EvaluateMedium( const btSoftBodyWorldInfo* wfi,
static inline void EvaluateMedium( const btSoftBodyWorldInfo* wfi,
const btVector3& x,
btSoftBody::sMedium& medium)
{

@ -157,6 +157,7 @@ namespace carve {
return pointInPoly(points, p2_adapt_ident(), p);
}
#if 0
static int lineSegmentPolyIntersections(const P2Vector &points,
LineSegment2 line,
std::vector<PolyIntersectionInfo> &out) {
@ -224,6 +225,7 @@ namespace carve {
}
return count;
}
#endif
struct FwdSort {
bool operator()(const PolyIntersectionInfo &a,
@ -239,6 +241,7 @@ namespace carve {
}
};
#if 0
static int sortedLineSegmentPolyIntersections(const P2Vector &points,
LineSegment2 line,
std::vector<PolyIntersectionInfo> &out) {
@ -253,6 +256,7 @@ namespace carve {
}
return count;
}
#endif
bool pickContainedPoint(const std::vector<P2> &poly, P2 &result) {
return pickContainedPoint(poly, p2_adapt_ident(), result);

@ -28,6 +28,7 @@ namespace carve {
namespace geom3d {
namespace {
#if 0
int is_same(const std::vector<const Vector *> &a,
const std::vector<const Vector *> &b) {
if (a.size() != b.size()) return false;
@ -52,6 +53,7 @@ not_fwd:
not_rev:
return 0;
}
#endif
}
bool planeIntersection(const Plane &a, const Plane &b, Ray &r) {

@ -236,6 +236,7 @@ namespace {
#if 0
void dump_intersections(std::ostream &out, carve::csg::Intersections &csg_intersections) {
std::vector<dump_data> temp;
@ -284,13 +285,14 @@ namespace {
vertices.push_back(i_pt->v);
}
}
#endif
carve::point::PointSet points(vertices);
std::string outf("/tmp/intersection-points.ply");
::writePLY(outf, &points, true);
#endif
}
#endif
@ -481,6 +483,7 @@ void carve::csg::CSG::makeVertexIntersections() {
#if 0
static carve::mesh::MeshSet<3>::vertex_t *chooseWeldPoint(
const carve::csg::detail::VSet &equivalent,
carve::csg::VertexPool &vertex_pool) {
@ -537,7 +540,7 @@ static const carve::mesh::MeshSet<3>::vertex_t *weld(
}
return weld_point;
}
#endif
void carve::csg::CSG::groupIntersections() {
@ -1219,6 +1222,7 @@ void carve::csg::CSG::makeFaceEdges(carve::csg::EdgeClassification &eclass,
*
* @param fll
*/
#if 0
static void checkFaceLoopIntegrity(carve::csg::FaceLoopList &fll) {
static carve::TimingName FUNC_NAME("CSG::checkFaceLoopIntegrity()");
carve::TimingBlock block(FUNC_NAME);
@ -1245,7 +1249,7 @@ static void checkFaceLoopIntegrity(carve::csg::FaceLoopList &fll) {
}
}
}
#endif
/**

@ -139,6 +139,7 @@ namespace carve {
#if 0
static void walkGraphSegment(carve::csg::detail::VVSMap &shared_edge_graph,
const carve::csg::detail::VSet &branch_points,
V2 initial,
@ -215,7 +216,7 @@ namespace carve {
#endif
#endif
}
#endif
static carve::geom3d::Vector perpendicular(const carve::geom3d::Vector &v) {
@ -383,6 +384,7 @@ namespace carve {
#if 0
static void traceIntersectionGraph(const V2Set &shared_edges,
const FLGroupList & /* a_loops_grouped */,
const FLGroupList & /* b_loops_grouped */,
@ -416,6 +418,7 @@ namespace carve {
walkGraphSegment(shared_edge_graph, branch_points, V2(v1, v2), a_edge_map, b_edge_map, out);
}
}
#endif
void hashByPerimeter(FLGroupList &grp, PerimMap &perim_map) {
for (FLGroupList::iterator i = grp.begin(); i != grp.end(); ++i) {

@ -1409,6 +1409,7 @@ namespace {
return s.str().substr(1);
}
#if 0
void dumpAsGraph(carve::mesh::MeshSet<3>::face_t *face,
const std::vector<carve::mesh::MeshSet<3>::vertex_t *> &base_loop,
const carve::csg::V2Set &face_edges,
@ -1450,6 +1451,7 @@ namespace {
}
std::cerr << "};\n";
}
#endif
void generateOneFaceLoop(carve::mesh::MeshSet<3>::face_t *face,
const carve::csg::detail::Data &data,

@ -43,6 +43,7 @@ namespace carve {
};
namespace {
#if 0
void cplx_sqrt(double re, double im,
double &re_1, double &im_1,
double &re_2, double &im_2) {
@ -57,7 +58,9 @@ namespace carve {
im_2 = -im_1;
}
}
#endif
#if 0
void cplx_cbrt(double re, double im,
double &re_1, double &im_1,
double &re_2, double &im_2,
@ -76,6 +79,7 @@ namespace carve {
im_3 = r * sin(t + M_TWOPI * 2.0 / 3.0);
}
}
#endif
void add_root(std::vector<Root> &roots, double root) {
for (size_t i = 0; i < roots.size(); ++i) {
@ -250,6 +254,7 @@ namespace carve {
e2.normalize();
}
#if 0
static void eig3(const Matrix3 &m,
double l,
carve::geom::vector<3> &e1,
@ -259,6 +264,7 @@ namespace carve {
e2.x = 0.0; e2.y = 1.0; e2.z = 0.0;
e3.x = 0.0; e3.y = 0.0; e3.z = 1.0;
}
#endif
void eigSolveSymmetric(const Matrix3 &m,
double &l1, carve::geom::vector<3> &e1,

@ -774,7 +774,6 @@ namespace carve {
// connectivity information in the Polyhedron.
mesh::MeshSet<3> *meshFromPolyhedron(const poly::Polyhedron *poly, int manifold_id) {
typedef mesh::Vertex<3> vertex_t;
typedef mesh::Vertex<3>::vector_t vector_t;
typedef mesh::Edge<3> edge_t;
typedef mesh::Face<3> face_t;
typedef mesh::Mesh<3> mesh_t;
@ -884,7 +883,6 @@ namespace carve {
// construct a Polyhedron from a MeshSet
poly::Polyhedron *polyhedronFromMesh(const mesh::MeshSet<3> *mesh, int manifold_id) {
typedef poly::Polyhedron poly_t;
typedef poly::Polyhedron::vertex_t vertex_t;
typedef poly::Polyhedron::edge_t edge_t;
typedef poly::Polyhedron::face_t face_t;

@ -1919,11 +1919,10 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize
static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig)
{
UInt32 beforeSize = kNumOpts;
Bool btMode;
if (!RangeEnc_Alloc(&p->rc, alloc))
return SZ_ERROR_MEM;
btMode = (p->matchFinderBase.btMode != 0);
#ifdef COMPRESS_MF_MT
Bool btMode = (p->matchFinderBase.btMode != 0);;
p->mtMode = (p->multiThread && !p->fastMode && btMode);
#endif

@ -22,6 +22,9 @@
int calcCellsFilled=0; \
int calcCellsEmptied=0; \
int calcNumUsedCells=0; \
/* This is a generic macro, and now all it's users are using all variables. */ \
(void)calcCurrentMass; \
(void)calcCellsFilled \

@ -299,7 +299,7 @@ void ntlRay::intersectBackAABB(ntlVec3Gfx mStart, ntlVec3Gfx mEnd, gfxReal &t, n
//! intersect ray with AABB
void ntlRay::intersectCompleteAABB(ntlVec3Gfx mStart, ntlVec3Gfx mEnd, gfxReal &tmin, gfxReal &tmax) const
{
char inside = true; /* inside box? */
// char inside = true; /* inside box? */ /* UNUSED */
char hit = false; /* ray hits box? */
int whichPlane; /* intersection plane */
gfxReal candPlane[NUMDIM]; /* candidate plane */
@ -315,11 +315,11 @@ void ntlRay::intersectCompleteAABB(ntlVec3Gfx mStart, ntlVec3Gfx mEnd, gfxReal &
if(origin[i] < mStart[i]) {
quadrant[i] = LEFT;
candPlane [i] = mStart[i];
inside = false;
// inside = false;
} else if(origin[i] > mEnd[i]) {
quadrant[i] = RIGHT;
candPlane[i] = mEnd[i];
inside = false;
// inside = false;
} else {
/* intersect with backside */
if(dir[i] > 0) {

@ -685,6 +685,8 @@ bool LbmFsgrSolver::initializeSolverMemory()
if(firstMInit) {
mrSetup();
}
#else
(void)firstMInit;
#endif // LBM_INCLUDE_TESTSOLVERS==1
firstMInit=false;
@ -1351,13 +1353,13 @@ bool LbmFsgrSolver::initializeSolverPostinit() {
} } \
if(ntype&(CFBndFreeslip)) { \
const LbmFloat dp=dot(objvel, vec2L((*pNormals)[n]) ); \
const LbmVec oldov=objvel; /*DEBUG*/ \
/* const LbmVec oldov=objvel; */ /*DEBUG*/ \
objvel = vec2L((*pNormals)[n]) *dp; \
/* if((j==24)&&(n%5==2)) errMsg("FSBT","n"<<n<<" v"<<objvel<<" nn"<<(*pNormals)[n]<<" dp"<<dp<<" oldov"<<oldov ); */ \
} \
else if(ntype&(CFBndPartslip)) { \
const LbmFloat dp=dot(objvel, vec2L((*pNormals)[n]) ); \
const LbmVec oldov=objvel; /*DEBUG*/ \
/* const LbmVec oldov=objvel; */ /*DEBUG*/ \
/* if((j==24)&&(n%5==2)) errMsg("FSBT","n"<<n<<" v"<<objvel<<" nn"<<(*pNormals)[n]<<" dp"<<dp<<" oldov"<<oldov ); */ \
const LbmFloat partv = mObjectPartslips[OId]; \
/*errMsg("PARTSLIP_DEBUG","l="<<l<<" ccel="<<RAC(ccel, dfInv[l] )<<" partv="<<partv<<",id="<<(int)(mnbf>>24)<<" newval="<<newval ); / part slip debug */ \

@ -777,6 +777,8 @@ LbmFsgrSolver::mainLoop(int lev)
+ RAC(ccel,dET) - RAC(ccel,dEB)
+ RAC(ccel,dWT) - RAC(ccel,dWB);
(void)oldRho;
// now reconstruction
ux=oldUx, uy=oldUy, uz=oldUz; // no local vars, only for usqr
rho = REFERENCE_PRESSURE;