From 295cb05393b3fa7d0cfa74984dbeb6115d124a25 Mon Sep 17 00:00:00 2001 From: omy Date: Wed, 11 Sep 2013 16:52:16 +0400 Subject: [PATCH] 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" --- src/FSD/FSD_FileHeader.hxx | 42 +++++++++------ src/GeomPlate/GeomPlate_BuildPlateSurface.cxx | 14 ++--- src/IntCurveSurface/IntCurveSurface_Inter.gxx | 3 -- src/IntImpParGen/IntImpParGen_Intersector.gxx | 1 - src/IntStart/IntStart_SearchOnBoundaries.gxx | 2 +- src/IntTools/IntTools_EdgeFace.cxx | 8 +-- src/NIS/NIS_View.cxx | 1 - src/OSD/OSD_MAllocHook.cxx | 51 +++++++++++-------- src/OpenGl/OpenGl_Window.cxx | 1 - src/PLib/PLib.cxx | 2 - src/QABugs/QABugs_16.cxx | 4 -- src/QABugs/QABugs_17.cxx | 1 - .../QANewBRepNaming_BooleanOperationFeat.cxx | 1 - .../TopOpeBRep_EdgesIntersector.cxx | 1 - src/Visual3d/Visual3d_ViewMapping.cxx | 1 - .../XmlLDrivers_DocumentRetrievalDriver.cxx | 2 - 16 files changed, 68 insertions(+), 67 deletions(-) diff --git a/src/FSD/FSD_FileHeader.hxx b/src/FSD/FSD_FileHeader.hxx index 3ea7fdc845..373659e324 100755 --- a/src/FSD/FSD_FileHeader.hxx +++ b/src/FSD/FSD_FileHeader.hxx @@ -112,23 +112,33 @@ inline Standard_ShortReal InverseShortReal (const Standard_ShortReal theValue) //purpose : Inverses bytes in size_t type instance //======================================================================= -inline Standard_Size InverseSize (const Standard_Size theValue) +template +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 ) - | (( theValue & 0x0000ff00 ) << 8 ) - | (( theValue & 0x00ff0000 ) >> 8 ) - | (( 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; + return (0 | (( theValue & 0x000000ff ) << 24 ) + | (( theValue & 0x0000ff00 ) << 8 ) + | (( theValue & 0x00ff0000 ) >> 8 ) + | (( theValue >> 24 ) & 0x000000ff ) ); } +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 (theValue, 0); +} + + #endif diff --git a/src/GeomPlate/GeomPlate_BuildPlateSurface.cxx b/src/GeomPlate/GeomPlate_BuildPlateSurface.cxx index 48786c478c..2468ac2458 100755 --- a/src/GeomPlate/GeomPlate_BuildPlateSurface.cxx +++ b/src/GeomPlate/GeomPlate_BuildPlateSurface.cxx @@ -178,7 +178,7 @@ GeomPlate_BuildPlateSurface::GeomPlate_BuildPlateSurface ( const Standard_Real Tol2d, const Standard_Real Tol3d, const Standard_Real TolAng, - const Standard_Real TolCurv, + const Standard_Real /*TolCurv*/, const Standard_Boolean Anisotropie ) : mySurfInit(Surf), myAnisotropie(Anisotropie), @@ -209,12 +209,12 @@ myNbBounds(0) GeomPlate_BuildPlateSurface::GeomPlate_BuildPlateSurface ( const Standard_Integer Degree, const Standard_Integer NbPtsOnCur, - const Standard_Integer NbIter, - const Standard_Real Tol2d, - const Standard_Real Tol3d, - const Standard_Real TolAng, - const Standard_Real TolCurv, - const Standard_Boolean Anisotropie ) : + const Standard_Integer NbIter, + const Standard_Real Tol2d, + const Standard_Real Tol3d, + const Standard_Real TolAng, + const Standard_Real /*TolCurv*/, + const Standard_Boolean Anisotropie ) : myAnisotropie(Anisotropie), myDegree(Degree), myNbPtsOnCur(NbPtsOnCur), diff --git a/src/IntCurveSurface/IntCurveSurface_Inter.gxx b/src/IntCurveSurface/IntCurveSurface_Inter.gxx index eae612e697..cd8c8b01c1 100755 --- a/src/IntCurveSurface/IntCurveSurface_Inter.gxx +++ b/src/IntCurveSurface/IntCurveSurface_Inter.gxx @@ -315,9 +315,6 @@ void IntCurveSurface_Inter::Perform(const TheCurve& curve, done = Standard_True; Standard_Integer NbUOnS = TheSurfaceTool::NbUIntervals(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; if(NbUOnS > 1) { diff --git a/src/IntImpParGen/IntImpParGen_Intersector.gxx b/src/IntImpParGen/IntImpParGen_Intersector.gxx index bd7dec6975..3806b9a4de 100755 --- a/src/IntImpParGen/IntImpParGen_Intersector.gxx +++ b/src/IntImpParGen/IntImpParGen_Intersector.gxx @@ -44,7 +44,6 @@ #define EPSX ParTool::EpsX(TheParCurve) #define NB_ECHANTILLONS -static Standard_Real PIpPI = M_PI + M_PI; diff --git a/src/IntStart/IntStart_SearchOnBoundaries.gxx b/src/IntStart/IntStart_SearchOnBoundaries.gxx index 92b3105b27..164e2bede7 100755 --- a/src/IntStart/IntStart_SearchOnBoundaries.gxx +++ b/src/IntStart/IntStart_SearchOnBoundaries.gxx @@ -154,7 +154,7 @@ void BoundedArc (const TheArc& A, Standard_Integer i,Nbi,Nbp; gp_Pnt ptdeb,ptfin; - Standard_Real pardeb,parfin; + Standard_Real pardeb = 0., parfin = 0.; Standard_Integer ideb,ifin,range,ranged,rangef; diff --git a/src/IntTools/IntTools_EdgeFace.cxx b/src/IntTools/IntTools_EdgeFace.cxx index 1402429b3a..58fa4d6546 100755 --- a/src/IntTools/IntTools_EdgeFace.cxx +++ b/src/IntTools/IntTools_EdgeFace.cxx @@ -855,7 +855,7 @@ void IntTools_EdgeFace::CheckData() Standard_Integer IntTools_EdgeFace::MakeType(IntTools_CommonPrt& aCommonPrt) { Standard_Real af1, al1; - Standard_Real dt, df1, df2, tm; + Standard_Real df1, tm; Standard_Boolean bAllNullFlag; // bAllNullFlag=aCommonPrt.AllNullFlag(); @@ -900,7 +900,7 @@ void IntTools_EdgeFace::CheckData() } return 0; } - // + /* dt=al1-af1; if (dt<1.e-5) { @@ -940,8 +940,8 @@ void IntTools_EdgeFace::CheckData() aCommonPrt.SetType(TopAbs_EDGE); } } - */ -// return 0; + + return 0;*/ } diff --git a/src/NIS/NIS_View.cxx b/src/NIS/NIS_View.cxx index 37a24aa658..3c75cee2b9 100755 --- a/src/NIS/NIS_View.cxx +++ b/src/NIS/NIS_View.cxx @@ -556,7 +556,6 @@ void NIS_View::Select (const NCollection_List &thePolygon, const gp_Ax3 anAx3 (anEye, aProj, anXdir); gp_Trsf aTrf; aTrf.SetTransformation (anAx3); - const gp_Trsf aTrfInv = aTrf.Inverted(); // Prepare list of 2d points of selection polygon. NCollection_List aPoints; diff --git a/src/OSD/OSD_MAllocHook.cxx b/src/OSD/OSD_MAllocHook.cxx index 70e11ae41e..ab7a7a50ae 100755 --- a/src/OSD/OSD_MAllocHook.cxx +++ b/src/OSD/OSD_MAllocHook.cxx @@ -83,37 +83,46 @@ OSD_MAllocHook::CollectBySize* OSD_MAllocHook::GetCollectBySize() #ifdef WNT #include +#if _MSC_VER == 1500 /* VS 2008 */ + static long getRequestNum(void* pvData, long lRequest, size_t& theSize) { -#if _MSC_VER == 1500 /* VS 2008 */ -#ifdef _DEBUG /* in Release, _CrtIsValidHeapPointer is always 1 */ - if (_CrtIsValidHeapPointer(pvData)) +#ifdef _DEBUG /* protect against invalid pointer; in Release, _CrtIsValidHeapPointer is always 1 */ + if (!_CrtIsValidHeapPointer(pvData)) + return lRequest; +#else + (void)lRequest; // avoid compiler warning on unused arg #endif - { + #define nNoMansLandSize 4 - // the header struct is taken from crt/src/dbgint.h - struct _CrtMemBlockHeader - { + // the header struct is taken from crt/src/dbgint.h + struct _CrtMemBlockHeader + { #ifdef _WIN64 - int nBlockUse; - size_t nDataSize; + int nBlockUse; + size_t nDataSize; #else - size_t nDataSize; - 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 + size_t nDataSize; + int nBlockUse; #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; } +#endif /* _MSC_VER == 1500 */ + int __cdecl MyAllocHook(int nAllocType, void * pvData, size_t nSize, diff --git a/src/OpenGl/OpenGl_Window.cxx b/src/OpenGl/OpenGl_Window.cxx index 415d26a4d1..14090d6328 100644 --- a/src/OpenGl/OpenGl_Window.cxx +++ b/src/OpenGl/OpenGl_Window.cxx @@ -531,7 +531,6 @@ OpenGl_Window::~OpenGl_Window() ReleaseDC (aWindow, aWindowDC); } #else - GLXDrawable aWindow = (GLXDrawable )myGlContext->myWindow; Display* aDisplay = (Display* )myGlContext->myDisplay; GLXContext aGContext = (GLXContext )myGlContext->myGContext; myGlContext.Nullify(); diff --git a/src/PLib/PLib.cxx b/src/PLib/PLib.cxx index 303a5aecc7..9bcd5889ac 100755 --- a/src/PLib/PLib.cxx +++ b/src/PLib/PLib.cxx @@ -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 diff --git a/src/QABugs/QABugs_16.cxx b/src/QABugs/QABugs_16.cxx index 29246b5926..c6d0af328b 100755 --- a/src/QABugs/QABugs_16.cxx +++ b/src/QABugs/QABugs_16.cxx @@ -494,16 +494,12 @@ static Standard_Integer OCC405 (Draw_Interpretor& di, Standard_Integer argc, con bsplc1->LastParameter() > l1 + Precision::PConfusion()) { Handle(Geom_BSplineCurve) aBstmp = Handle(Geom_BSplineCurve)::DownCast(bsplc1->Copy()); aBstmp->Segment(f1,l1); - gp_Pnt p1 = aBstmp->Pole(1); - gp_Pnt p2 = aBstmp->Pole(aBstmp->NbPoles()); bsplc1 =aBstmp; } if(bsplc2->FirstParameter() < f2 - Precision::PConfusion() || bsplc2->LastParameter() > l2 + Precision::PConfusion()) { Handle(Geom_BSplineCurve) aBstmp = Handle(Geom_BSplineCurve)::DownCast(bsplc2->Copy()); aBstmp->Segment(f2,l2); - gp_Pnt p1 = aBstmp->Pole(1); - gp_Pnt p2 = aBstmp->Pole(aBstmp->NbPoles()); bsplc2 =aBstmp; } gp_Pnt pmid = 0.5 * ( bsplc1->Pole(bsplc1->NbPoles()).XYZ() + bsplc2->Pole(1).XYZ() ); diff --git a/src/QABugs/QABugs_17.cxx b/src/QABugs/QABugs_17.cxx index ab3aa30ba2..8b83dea17b 100755 --- a/src/QABugs/QABugs_17.cxx +++ b/src/QABugs/QABugs_17.cxx @@ -843,7 +843,6 @@ static Standard_Real fl = 1.e-3; static Standard_Real tapp_angle = 1.e-2; static GeomAbs_Shape blend_cont = GeomAbs_C1; -static BRepFilletAPI_MakeFillet* Rakk = 0; static BRepFilletAPI_MakeFillet* Rake = 0; static char name[100]; diff --git a/src/QANewBRepNaming/QANewBRepNaming_BooleanOperationFeat.cxx b/src/QANewBRepNaming/QANewBRepNaming_BooleanOperationFeat.cxx index 55a0f3ca93..909a9da586 100755 --- a/src/QANewBRepNaming/QANewBRepNaming_BooleanOperationFeat.cxx +++ b/src/QANewBRepNaming/QANewBRepNaming_BooleanOperationFeat.cxx @@ -1071,7 +1071,6 @@ static void SortEdges5 (const TopTools_Array1OfShape& theArS, const TColgp_Array // 2. find nearest group (aV1, aV3), reorganize ArI - nerest => top 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 aPnt = theAx.Location(); Standard_Real aD1 = aPnt.Distance(aDP1);//i1-i2-i3 diff --git a/src/TopOpeBRep/TopOpeBRep_EdgesIntersector.cxx b/src/TopOpeBRep/TopOpeBRep_EdgesIntersector.cxx index e5c0572dbd..264b96f7fa 100755 --- a/src/TopOpeBRep/TopOpeBRep_EdgesIntersector.cxx +++ b/src/TopOpeBRep/TopOpeBRep_EdgesIntersector.cxx @@ -370,7 +370,6 @@ Standard_Boolean EdgesIntersector_checkT1D(const TopoDS_Edge& E1,const TopoDS_Ed if (apex) { TopoDS_Vertex vf,vl; TopExp::Vertices(myEdge1,vf,vl); 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); diff --git a/src/Visual3d/Visual3d_ViewMapping.cxx b/src/Visual3d/Visual3d_ViewMapping.cxx index 04b6be2454..9c7eb77f00 100755 --- a/src/Visual3d/Visual3d_ViewMapping.cxx +++ b/src/Visual3d/Visual3d_ViewMapping.cxx @@ -45,7 +45,6 @@ // Perspective #include -static Standard_Boolean env_init = Standard_False; static OSD_Environment env_walkthrow; static Standard_Boolean Visual3dWalkthrow() diff --git a/src/XmlLDrivers/XmlLDrivers_DocumentRetrievalDriver.cxx b/src/XmlLDrivers/XmlLDrivers_DocumentRetrievalDriver.cxx index f8e5fb564c..cdd1e484aa 100755 --- a/src/XmlLDrivers/XmlLDrivers_DocumentRetrievalDriver.cxx +++ b/src/XmlLDrivers/XmlLDrivers_DocumentRetrievalDriver.cxx @@ -51,8 +51,6 @@ #define END_REF "END_REF" #define REFERENCE_COUNTER "REFERENCE_COUNTER" -static Standard_Integer myDocumentVersion = 0; - //#define TAKE_TIMES static void take_time (const Standard_Integer, const char *, const Handle(CDM_MessageDriver)&)