mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0024168: Eliminate CLang compiler warning -Wunused-variable
Got rid of warning -Wunused-variable In FSD_File, use template specialization instead of comparison of sizeof() to specific value in if statement, thus eliminating warning "constant value in conditional expression"
This commit is contained in:
parent
74d80fb976
commit
295cb05393
@ -112,23 +112,33 @@ inline Standard_ShortReal InverseShortReal (const Standard_ShortReal theValue)
|
|||||||
//purpose : Inverses bytes in size_t type instance
|
//purpose : Inverses bytes in size_t type instance
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
inline Standard_Size InverseSize (const Standard_Size theValue)
|
template<int size>
|
||||||
|
inline Standard_Size InverseSizeSpecialized (const Standard_Size theValue, int);
|
||||||
|
|
||||||
|
template<>
|
||||||
|
inline Standard_Size InverseSizeSpecialized <4> (const Standard_Size theValue, int)
|
||||||
{
|
{
|
||||||
if (sizeof(Standard_Size) == 4)
|
return (0 | (( theValue & 0x000000ff ) << 24 )
|
||||||
return (0 | (( theValue & 0x000000ff ) << 24 )
|
| (( theValue & 0x0000ff00 ) << 8 )
|
||||||
| (( theValue & 0x0000ff00 ) << 8 )
|
| (( theValue & 0x00ff0000 ) >> 8 )
|
||||||
| (( theValue & 0x00ff0000 ) >> 8 )
|
| (( theValue >> 24 ) & 0x000000ff ) );
|
||||||
| (( theValue >> 24 ) & 0x000000ff ) );
|
|
||||||
else if (sizeof(Standard_Size) == 8) {
|
|
||||||
Standard_Size aResult;
|
|
||||||
Standard_Integer *i = (Standard_Integer*) &theValue;
|
|
||||||
Standard_Integer *j = (Standard_Integer*) &aResult;
|
|
||||||
j[1] = InverseInt (i[0]);
|
|
||||||
j[0] = InverseInt (i[1]);
|
|
||||||
return aResult;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
inline Standard_Size InverseSizeSpecialized <8> (const Standard_Size theValue, int)
|
||||||
|
{
|
||||||
|
Standard_Size aResult;
|
||||||
|
Standard_Integer *i = (Standard_Integer*) &theValue;
|
||||||
|
Standard_Integer *j = (Standard_Integer*) &aResult;
|
||||||
|
j[1] = InverseInt (i[0]);
|
||||||
|
j[0] = InverseInt (i[1]);
|
||||||
|
return aResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Standard_Size InverseSize (const Standard_Size theValue)
|
||||||
|
{
|
||||||
|
return InverseSizeSpecialized <sizeof(Standard_Size)> (theValue, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -178,7 +178,7 @@ GeomPlate_BuildPlateSurface::GeomPlate_BuildPlateSurface (
|
|||||||
const Standard_Real Tol2d,
|
const Standard_Real Tol2d,
|
||||||
const Standard_Real Tol3d,
|
const Standard_Real Tol3d,
|
||||||
const Standard_Real TolAng,
|
const Standard_Real TolAng,
|
||||||
const Standard_Real TolCurv,
|
const Standard_Real /*TolCurv*/,
|
||||||
const Standard_Boolean Anisotropie ) :
|
const Standard_Boolean Anisotropie ) :
|
||||||
mySurfInit(Surf),
|
mySurfInit(Surf),
|
||||||
myAnisotropie(Anisotropie),
|
myAnisotropie(Anisotropie),
|
||||||
@ -209,12 +209,12 @@ myNbBounds(0)
|
|||||||
GeomPlate_BuildPlateSurface::GeomPlate_BuildPlateSurface (
|
GeomPlate_BuildPlateSurface::GeomPlate_BuildPlateSurface (
|
||||||
const Standard_Integer Degree,
|
const Standard_Integer Degree,
|
||||||
const Standard_Integer NbPtsOnCur,
|
const Standard_Integer NbPtsOnCur,
|
||||||
const Standard_Integer NbIter,
|
const Standard_Integer NbIter,
|
||||||
const Standard_Real Tol2d,
|
const Standard_Real Tol2d,
|
||||||
const Standard_Real Tol3d,
|
const Standard_Real Tol3d,
|
||||||
const Standard_Real TolAng,
|
const Standard_Real TolAng,
|
||||||
const Standard_Real TolCurv,
|
const Standard_Real /*TolCurv*/,
|
||||||
const Standard_Boolean Anisotropie ) :
|
const Standard_Boolean Anisotropie ) :
|
||||||
myAnisotropie(Anisotropie),
|
myAnisotropie(Anisotropie),
|
||||||
myDegree(Degree),
|
myDegree(Degree),
|
||||||
myNbPtsOnCur(NbPtsOnCur),
|
myNbPtsOnCur(NbPtsOnCur),
|
||||||
|
@ -315,9 +315,6 @@ void IntCurveSurface_Inter::Perform(const TheCurve& curve,
|
|||||||
done = Standard_True;
|
done = Standard_True;
|
||||||
Standard_Integer NbUOnS = TheSurfaceTool::NbUIntervals(surface,GeomAbs_C2);
|
Standard_Integer NbUOnS = TheSurfaceTool::NbUIntervals(surface,GeomAbs_C2);
|
||||||
Standard_Integer NbVOnS = TheSurfaceTool::NbVIntervals(surface,GeomAbs_C2);
|
Standard_Integer NbVOnS = TheSurfaceTool::NbVIntervals(surface,GeomAbs_C2);
|
||||||
#ifdef ICS_DEB
|
|
||||||
Standard_Integer NbOnC = TheCurveTool::NbIntervals(curve,GeomAbs_C2);
|
|
||||||
#endif
|
|
||||||
Standard_Real U0,U1,V0,V1;
|
Standard_Real U0,U1,V0,V1;
|
||||||
|
|
||||||
if(NbUOnS > 1) {
|
if(NbUOnS > 1) {
|
||||||
|
@ -44,7 +44,6 @@
|
|||||||
#define EPSX ParTool::EpsX(TheParCurve)
|
#define EPSX ParTool::EpsX(TheParCurve)
|
||||||
#define NB_ECHANTILLONS
|
#define NB_ECHANTILLONS
|
||||||
|
|
||||||
static Standard_Real PIpPI = M_PI + M_PI;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ void BoundedArc (const TheArc& A,
|
|||||||
Standard_Integer i,Nbi,Nbp;
|
Standard_Integer i,Nbi,Nbp;
|
||||||
|
|
||||||
gp_Pnt ptdeb,ptfin;
|
gp_Pnt ptdeb,ptfin;
|
||||||
Standard_Real pardeb,parfin;
|
Standard_Real pardeb = 0., parfin = 0.;
|
||||||
Standard_Integer ideb,ifin,range,ranged,rangef;
|
Standard_Integer ideb,ifin,range,ranged,rangef;
|
||||||
|
|
||||||
|
|
||||||
|
@ -855,7 +855,7 @@ void IntTools_EdgeFace::CheckData()
|
|||||||
Standard_Integer IntTools_EdgeFace::MakeType(IntTools_CommonPrt& aCommonPrt)
|
Standard_Integer IntTools_EdgeFace::MakeType(IntTools_CommonPrt& aCommonPrt)
|
||||||
{
|
{
|
||||||
Standard_Real af1, al1;
|
Standard_Real af1, al1;
|
||||||
Standard_Real dt, df1, df2, tm;
|
Standard_Real df1, tm;
|
||||||
Standard_Boolean bAllNullFlag;
|
Standard_Boolean bAllNullFlag;
|
||||||
//
|
//
|
||||||
bAllNullFlag=aCommonPrt.AllNullFlag();
|
bAllNullFlag=aCommonPrt.AllNullFlag();
|
||||||
@ -900,7 +900,7 @@ void IntTools_EdgeFace::CheckData()
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//
|
|
||||||
/*
|
/*
|
||||||
dt=al1-af1;
|
dt=al1-af1;
|
||||||
if (dt<1.e-5) {
|
if (dt<1.e-5) {
|
||||||
@ -940,8 +940,8 @@ void IntTools_EdgeFace::CheckData()
|
|||||||
aCommonPrt.SetType(TopAbs_EDGE);
|
aCommonPrt.SetType(TopAbs_EDGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
// return 0;
|
return 0;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -556,7 +556,6 @@ void NIS_View::Select (const NCollection_List<gp_XY> &thePolygon,
|
|||||||
const gp_Ax3 anAx3 (anEye, aProj, anXdir);
|
const gp_Ax3 anAx3 (anEye, aProj, anXdir);
|
||||||
gp_Trsf aTrf;
|
gp_Trsf aTrf;
|
||||||
aTrf.SetTransformation (anAx3);
|
aTrf.SetTransformation (anAx3);
|
||||||
const gp_Trsf aTrfInv = aTrf.Inverted();
|
|
||||||
|
|
||||||
// Prepare list of 2d points of selection polygon.
|
// Prepare list of 2d points of selection polygon.
|
||||||
NCollection_List<gp_XY> aPoints;
|
NCollection_List<gp_XY> aPoints;
|
||||||
|
@ -83,37 +83,46 @@ OSD_MAllocHook::CollectBySize* OSD_MAllocHook::GetCollectBySize()
|
|||||||
#ifdef WNT
|
#ifdef WNT
|
||||||
#include <crtdbg.h>
|
#include <crtdbg.h>
|
||||||
|
|
||||||
|
#if _MSC_VER == 1500 /* VS 2008 */
|
||||||
|
|
||||||
static long getRequestNum(void* pvData, long lRequest, size_t& theSize)
|
static long getRequestNum(void* pvData, long lRequest, size_t& theSize)
|
||||||
{
|
{
|
||||||
#if _MSC_VER == 1500 /* VS 2008 */
|
#ifdef _DEBUG /* protect against invalid pointer; in Release, _CrtIsValidHeapPointer is always 1 */
|
||||||
#ifdef _DEBUG /* in Release, _CrtIsValidHeapPointer is always 1 */
|
if (!_CrtIsValidHeapPointer(pvData))
|
||||||
if (_CrtIsValidHeapPointer(pvData))
|
return lRequest;
|
||||||
|
#else
|
||||||
|
(void)lRequest; // avoid compiler warning on unused arg
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
#define nNoMansLandSize 4
|
#define nNoMansLandSize 4
|
||||||
// the header struct is taken from crt/src/dbgint.h
|
// the header struct is taken from crt/src/dbgint.h
|
||||||
struct _CrtMemBlockHeader
|
struct _CrtMemBlockHeader
|
||||||
{
|
{
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
int nBlockUse;
|
int nBlockUse;
|
||||||
size_t nDataSize;
|
size_t nDataSize;
|
||||||
#else
|
#else
|
||||||
size_t nDataSize;
|
size_t nDataSize;
|
||||||
int nBlockUse;
|
int nBlockUse;
|
||||||
#endif
|
|
||||||
long lRequest;
|
|
||||||
unsigned char gap[nNoMansLandSize];
|
|
||||||
};
|
|
||||||
_CrtMemBlockHeader* aHeader = ((_CrtMemBlockHeader*)pvData)-1;
|
|
||||||
theSize = aHeader->nDataSize;
|
|
||||||
return aHeader->lRequest;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
(void)pvData; (void)theSize; // avoid compiler warning on unused arg
|
|
||||||
#endif
|
#endif
|
||||||
|
long lRequest;
|
||||||
|
unsigned char gap[nNoMansLandSize];
|
||||||
|
};
|
||||||
|
|
||||||
|
_CrtMemBlockHeader* aHeader = ((_CrtMemBlockHeader*)pvData)-1;
|
||||||
|
theSize = aHeader->nDataSize;
|
||||||
|
return aHeader->lRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* _MSC_VER == 1500 */
|
||||||
|
|
||||||
|
static long getRequestNum(void* /*pvData*/, long lRequest, size_t& /*theSize*/)
|
||||||
|
{
|
||||||
return lRequest;
|
return lRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* _MSC_VER == 1500 */
|
||||||
|
|
||||||
int __cdecl MyAllocHook(int nAllocType,
|
int __cdecl MyAllocHook(int nAllocType,
|
||||||
void * pvData,
|
void * pvData,
|
||||||
size_t nSize,
|
size_t nSize,
|
||||||
|
@ -531,7 +531,6 @@ OpenGl_Window::~OpenGl_Window()
|
|||||||
ReleaseDC (aWindow, aWindowDC);
|
ReleaseDC (aWindow, aWindowDC);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
GLXDrawable aWindow = (GLXDrawable )myGlContext->myWindow;
|
|
||||||
Display* aDisplay = (Display* )myGlContext->myDisplay;
|
Display* aDisplay = (Display* )myGlContext->myDisplay;
|
||||||
GLXContext aGContext = (GLXContext )myGlContext->myGContext;
|
GLXContext aGContext = (GLXContext )myGlContext->myGContext;
|
||||||
myGlContext.Nullify();
|
myGlContext.Nullify();
|
||||||
|
@ -2044,8 +2044,6 @@ void PLib::EvalPoly2Var(const Standard_Real UParameter,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static Standard_Integer storage_divided = 0 ;
|
|
||||||
static Standard_Real *divided_differences_array = NULL;
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : This evaluates the lagrange polynomial and its derivatives
|
//function : This evaluates the lagrange polynomial and its derivatives
|
||||||
|
@ -494,16 +494,12 @@ static Standard_Integer OCC405 (Draw_Interpretor& di, Standard_Integer argc, con
|
|||||||
bsplc1->LastParameter() > l1 + Precision::PConfusion()) {
|
bsplc1->LastParameter() > l1 + Precision::PConfusion()) {
|
||||||
Handle(Geom_BSplineCurve) aBstmp = Handle(Geom_BSplineCurve)::DownCast(bsplc1->Copy());
|
Handle(Geom_BSplineCurve) aBstmp = Handle(Geom_BSplineCurve)::DownCast(bsplc1->Copy());
|
||||||
aBstmp->Segment(f1,l1);
|
aBstmp->Segment(f1,l1);
|
||||||
gp_Pnt p1 = aBstmp->Pole(1);
|
|
||||||
gp_Pnt p2 = aBstmp->Pole(aBstmp->NbPoles());
|
|
||||||
bsplc1 =aBstmp;
|
bsplc1 =aBstmp;
|
||||||
}
|
}
|
||||||
if(bsplc2->FirstParameter() < f2 - Precision::PConfusion() ||
|
if(bsplc2->FirstParameter() < f2 - Precision::PConfusion() ||
|
||||||
bsplc2->LastParameter() > l2 + Precision::PConfusion()) {
|
bsplc2->LastParameter() > l2 + Precision::PConfusion()) {
|
||||||
Handle(Geom_BSplineCurve) aBstmp = Handle(Geom_BSplineCurve)::DownCast(bsplc2->Copy());
|
Handle(Geom_BSplineCurve) aBstmp = Handle(Geom_BSplineCurve)::DownCast(bsplc2->Copy());
|
||||||
aBstmp->Segment(f2,l2);
|
aBstmp->Segment(f2,l2);
|
||||||
gp_Pnt p1 = aBstmp->Pole(1);
|
|
||||||
gp_Pnt p2 = aBstmp->Pole(aBstmp->NbPoles());
|
|
||||||
bsplc2 =aBstmp;
|
bsplc2 =aBstmp;
|
||||||
}
|
}
|
||||||
gp_Pnt pmid = 0.5 * ( bsplc1->Pole(bsplc1->NbPoles()).XYZ() + bsplc2->Pole(1).XYZ() );
|
gp_Pnt pmid = 0.5 * ( bsplc1->Pole(bsplc1->NbPoles()).XYZ() + bsplc2->Pole(1).XYZ() );
|
||||||
|
@ -843,7 +843,6 @@ static Standard_Real fl = 1.e-3;
|
|||||||
static Standard_Real tapp_angle = 1.e-2;
|
static Standard_Real tapp_angle = 1.e-2;
|
||||||
static GeomAbs_Shape blend_cont = GeomAbs_C1;
|
static GeomAbs_Shape blend_cont = GeomAbs_C1;
|
||||||
|
|
||||||
static BRepFilletAPI_MakeFillet* Rakk = 0;
|
|
||||||
static BRepFilletAPI_MakeFillet* Rake = 0;
|
static BRepFilletAPI_MakeFillet* Rake = 0;
|
||||||
static char name[100];
|
static char name[100];
|
||||||
|
|
||||||
|
@ -1071,7 +1071,6 @@ static void SortEdges5 (const TopTools_Array1OfShape& theArS, const TColgp_Array
|
|||||||
|
|
||||||
// 2. find nearest group (aV1, aV3), reorganize ArI - nerest => top
|
// 2. find nearest group (aV1, aV3), reorganize ArI - nerest => top
|
||||||
gp_Pnt aDP1 = BRep_Tool::Pnt(TopoDS::Vertex(aV1));
|
gp_Pnt aDP1 = BRep_Tool::Pnt(TopoDS::Vertex(aV1));
|
||||||
gp_Pnt aDP2 = BRep_Tool::Pnt(TopoDS::Vertex(aV2));
|
|
||||||
gp_Pnt aDP3 = BRep_Tool::Pnt(TopoDS::Vertex(aV3));
|
gp_Pnt aDP3 = BRep_Tool::Pnt(TopoDS::Vertex(aV3));
|
||||||
gp_Pnt aPnt = theAx.Location();
|
gp_Pnt aPnt = theAx.Location();
|
||||||
Standard_Real aD1 = aPnt.Distance(aDP1);//i1-i2-i3
|
Standard_Real aD1 = aPnt.Distance(aDP1);//i1-i2-i3
|
||||||
|
@ -370,7 +370,6 @@ Standard_Boolean EdgesIntersector_checkT1D(const TopoDS_Edge& E1,const TopoDS_Ed
|
|||||||
if (apex) {
|
if (apex) {
|
||||||
TopoDS_Vertex vf,vl; TopExp::Vertices(myEdge1,vf,vl);
|
TopoDS_Vertex vf,vl; TopExp::Vertices(myEdge1,vf,vl);
|
||||||
gp_Pnt ptf = BRep_Tool::Pnt(vf); Standard_Real df = pt2.Distance(ptf);
|
gp_Pnt ptf = BRep_Tool::Pnt(vf); Standard_Real df = pt2.Distance(ptf);
|
||||||
gp_Pnt ptl = BRep_Tool::Pnt(vl);
|
|
||||||
|
|
||||||
Standard_Real tolf = BRep_Tool::Tolerance(vf);
|
Standard_Real tolf = BRep_Tool::Tolerance(vf);
|
||||||
|
|
||||||
|
@ -45,7 +45,6 @@
|
|||||||
|
|
||||||
// Perspective
|
// Perspective
|
||||||
#include <OSD_Environment.hxx>
|
#include <OSD_Environment.hxx>
|
||||||
static Standard_Boolean env_init = Standard_False;
|
|
||||||
static OSD_Environment env_walkthrow;
|
static OSD_Environment env_walkthrow;
|
||||||
|
|
||||||
static Standard_Boolean Visual3dWalkthrow()
|
static Standard_Boolean Visual3dWalkthrow()
|
||||||
|
@ -51,8 +51,6 @@
|
|||||||
#define END_REF "END_REF"
|
#define END_REF "END_REF"
|
||||||
#define REFERENCE_COUNTER "REFERENCE_COUNTER"
|
#define REFERENCE_COUNTER "REFERENCE_COUNTER"
|
||||||
|
|
||||||
static Standard_Integer myDocumentVersion = 0;
|
|
||||||
|
|
||||||
//#define TAKE_TIMES
|
//#define TAKE_TIMES
|
||||||
static void take_time (const Standard_Integer, const char *,
|
static void take_time (const Standard_Integer, const char *,
|
||||||
const Handle(CDM_MessageDriver)&)
|
const Handle(CDM_MessageDriver)&)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user