0026780: Coding rules - eliminate warnings on Linux and Mac
authorabv <abv@opencascade.com>
Wed, 11 Nov 2015 06:32:41 +0000 (09:32 +0300)
committerabv <abv@opencascade.com>
Wed, 11 Nov 2015 06:43:26 +0000 (09:43 +0300)
Fixed a few remaining warnings found by GCC, CLang, and VC++ 14 (recent changes)

src/Draft/Draft_Modification_1.cxx
src/Font/Font_TextFormatter.cxx
src/STEPCAFControl/STEPCAFControl_Reader.cxx
src/ShapeFix/ShapeFix_Shape.cxx
src/Standard/Standard_ErrorHandler.hxx
src/TopOpeBRep/TopOpeBRep_FFDumper.cxx
src/TopOpeBRepTool/TopOpeBRepTool_makeTransition.cxx
src/ViewerTest/ViewerTest.cxx
src/XDEDRAW/XDEDRAW_GDTs.cxx

index 1aec745..08b053e 100644 (file)
@@ -801,18 +801,16 @@ void Draft_Modification::Perform ()
     }
 
     // Calculate new edges.
-
-    Handle(Geom_Surface) S1,S2;
-    Handle(Geom_Curve) C, newC;
-    Standard_Real f,l;
-    TopLoc_Location L;
-
     for (Standard_Integer ii = 1; ii <= myEMap.Extent(); ii++) 
     {
       Draft_EdgeInfo& Einf = myEMap.ChangeFromIndex(ii); 
 
       const TopoDS_Edge& theEdge = TopoDS::Edge(myEMap.FindKey(ii));
 
+      Handle(Geom_Surface) S1,S2;
+      Handle(Geom_Curve) C, newC;
+      Standard_Real f,l;
+      TopLoc_Location L;
       C = BRep_Tool::Curve(theEdge,L,f,l);
       C = Handle(Geom_Curve)::DownCast(C->Transformed(L.Transformation()));
 
@@ -1414,8 +1412,8 @@ void Draft_Modification::Perform ()
             Standard_Real param = Parameter(Einf2.Geometry(), pvt, done);
             if (done != 0)
             {
-              S1 = myFMap.FindFromKey(Einf2.FirstFace()).Geometry();
-              S2 = myFMap.FindFromKey(Einf2.SecondFace()).Geometry();
+              Handle(Geom_Surface) S1 = myFMap.FindFromKey(Einf2.FirstFace()).Geometry();
+              Handle(Geom_Surface) S2 = myFMap.FindFromKey(Einf2.SecondFace()).Geometry();
               Vinf.ChangeParameter(Edg2) = SmartParameter( Einf2, BRep_Tool::Tolerance(Edg2), pvt, done, S1, S2 );
             }
             else
@@ -1428,8 +1426,8 @@ void Draft_Modification::Perform ()
           Standard_Real param = Parameter(Einf1.Geometry(), pvt, done);
           if (done != 0)
           {
-            S1 = myFMap.FindFromKey(Einf1.FirstFace()).Geometry();
-            S2 = myFMap.FindFromKey(Einf1.SecondFace()).Geometry();
+            Handle(Geom_Surface) S1 = myFMap.FindFromKey(Einf1.FirstFace()).Geometry();
+            Handle(Geom_Surface) S2 = myFMap.FindFromKey(Einf1.SecondFace()).Geometry();
             Vinf.ChangeParameter(Edg1) = SmartParameter( Einf1, BRep_Tool::Tolerance(Edg1), pvt, done, S1, S2 );
           }
           else
@@ -1516,8 +1514,8 @@ void Draft_Modification::Perform ()
         Standard_Real param = Parameter(Einf.Geometry(), pvt, done);
         if (done != 0)
         {
-          S1 = myFMap.FindFromKey(Einf.FirstFace()).Geometry();
-          S2 = myFMap.FindFromKey(Einf.SecondFace()).Geometry();
+          Handle(Geom_Surface) S1 = myFMap.FindFromKey(Einf.FirstFace()).Geometry();
+          Handle(Geom_Surface) S2 = myFMap.FindFromKey(Einf.SecondFace()).Geometry();
           Vinf.ChangeParameter(Edg) = SmartParameter( Einf, BRep_Tool::Tolerance(Edg), pvt, done, S1, S2 );
         }
         else
index 6ed0474..c31e60f 100644 (file)
@@ -43,16 +43,6 @@ namespace
     }
   }
 
-  //! Apply floor to vector components.
-  //! @param  theVec - vector to change (by reference!)
-  //! @return modified vector
-  inline Vec2f& floor (Vec2f& theVec)
-  {
-    theVec.x() = std::floor (theVec.x());
-    theVec.y() = std::floor (theVec.y());
-    return theVec;
-  }
-
 }
 
 // =======================================================================
index 954e948..21eb2d2 100644 (file)
@@ -1875,17 +1875,16 @@ static Standard_Boolean setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat,
               {
                 Handle(StepAP242_GeometricItemSpecificUsage) aGISU
                   = Handle(StepAP242_GeometricItemSpecificUsage)::DownCast(anIterDSWP.Value());
-                Handle(StepRepr_RepresentationItem) aRI;
+                Handle(StepRepr_RepresentationItem) anItem;
                 if(aPGISU->NbIdentifiedItem() > 0) {
-                  aRI = Handle(StepRepr_RepresentationItem)::DownCast(aPGISU->IdentifiedItemValue(1));
+                  anItem = Handle(StepRepr_RepresentationItem)::DownCast(aPGISU->IdentifiedItemValue(1));
                 }
-                if(aRI.IsNull()) continue;
-                Standard_Integer index = aTP->MapIndex(aRI);
-                TopoDS_Shape aSh;
-                if(index >0) {
-                  Handle(Transfer_Binder) binder = aTP->MapItem(index);
-                  aSh = TransferBRep::ShapeResult(binder);
-                  aDatObj->SetDatumTarget(aSh);
+                if(anItem.IsNull()) continue;
+                Standard_Integer anItemIndex = aTP->MapIndex(anItem);
+                if(anItemIndex >0) {
+                  Handle(Transfer_Binder) binder = aTP->MapItem(anItemIndex);
+                  TopoDS_Shape anItemShape = TransferBRep::ShapeResult(binder);
+                  aDatObj->SetDatumTarget(anItemShape);
                 }
               }
             }
@@ -2297,8 +2296,8 @@ static TDF_Label createGDTObjectInXCAF(const Handle(Standard_Transient)& theEnt,
               if(!DimCharR.IsNull()) {
                 Handle(StepShape_ShapeDimensionRepresentation) SDimR = DimCharR->Representation();
                 if(!SDimR.IsNull() && SDimR->NbItems()>0) {
-                  Handle(StepRepr_RepresentationItem) aRI = SDimR->ItemsValue(1);
-                  Handle(StepRepr_ValueRange) VR = Handle(StepRepr_ValueRange)::DownCast(aRI);
+                  Handle(StepRepr_RepresentationItem) anItem = SDimR->ItemsValue(1);
+                  Handle(StepRepr_ValueRange) VR = Handle(StepRepr_ValueRange)::DownCast(anItem);
                   if(!VR.IsNull()) {
                     aName = VR->Name();
                     //StepRepr_CompoundItemDefinition CID = VR->ItemElement();
index cca527e..5c884f0 100644 (file)
@@ -258,8 +258,7 @@ Standard_Boolean ShapeFix_Shape::Perform(const Handle(Message_ProgressIndicator)
       //after all fixes.
       //This fix it should be performed for example for case when cutting edge was performed.
       Handle(ShapeFix_Edge) sfe = FixEdgeTool();
-      TopExp_Explorer anExpF (myResult, TopAbs_FACE);
-      for ( ; anExpF.More(); anExpF.Next()) 
+      for (anExpF.ReInit(); anExpF.More(); anExpF.Next()) 
       {
         TopoDS_Face aF = TopoDS::Face(anExpF.Current());
         TopExp_Explorer anExpE (aF, TopAbs_EDGE);
index 968f8eb..115784d 100644 (file)
@@ -68,7 +68,7 @@
   #define OCC_CATCH_SIGNALS 
 
   // Suppress GCC warning "variable ...  might be clobbered by 'longjmp' or 'vfork'"
-  #ifdef __GNUC__
+  #if defined(__GNUC__) && ! defined(__INTEL_COMPILER) && ! defined(__clang__)
   #pragma GCC diagnostic ignored "-Wclobbered"
   #endif
 
@@ -83,7 +83,7 @@
                              }
 
   // Suppress GCC warning "variable ...  might be clobbered by 'longjmp' or 'vfork'"
-  #ifdef __GNUC__
+  #if defined(__GNUC__) && ! defined(__INTEL_COMPILER) && ! defined(__clang__)
   #pragma GCC diagnostic ignored "-Wclobbered"
   #endif
 
index 44f7e73..df35f57 100644 (file)
@@ -65,6 +65,11 @@ TopOpeBRep_FFDumper::TopOpeBRep_FFDumper(const TopOpeBRep_PFacesFiller& PFF)
 #ifndef OCCT_DEBUG
 void TopOpeBRep_FFDumper::Init(const TopOpeBRep_PFacesFiller& )
 {
+  // just shut up compiler warnings
+  (void)myEn1;
+  (void)myEn2;
+  (void)myLineIndex;
+}
 #else
 void TopOpeBRep_FFDumper::Init(const TopOpeBRep_PFacesFiller& PFF)
 {
@@ -84,8 +89,8 @@ void TopOpeBRep_FFDumper::Init(const TopOpeBRep_PFacesFiller& PFF)
     for (x.Init(myF2,TopAbs_EDGE);x.More();x.Next()) myEM2.Bind(x.Current(),++myEn2);
     myLineIndex = 0;
   }
-#endif
 }
+#endif
 
 //=======================================================================
 //function : DumpLine
index a2ff4a1..3ca65e0 100644 (file)
@@ -204,9 +204,11 @@ static Standard_Boolean FUN_tg(const TopoDS_Edge& e,const Standard_Real par,cons
   st = BEFORE;
   for (Standard_Integer nite = 1; nite <= 2; nite++) {
     if (nite == 2) st = AFTER;    
-    Standard_Real pn; Standard_Boolean mkp = FUN_getnearpar(e,par,f,l,factor,st,pn);
+    Standard_Real pn = 0.;
+    Standard_Boolean mkp = FUN_getnearpar(e,par,f,l,factor,st,pn);
     if (!mkp) continue;
-    gp_Vec tmp; Standard_Boolean ok = TopOpeBRepTool_TOOL::TggeomE(pn,e,tmp);
+    gp_Vec tmp;
+    Standard_Boolean ok = TopOpeBRepTool_TOOL::TggeomE(pn,e,tmp);
     if (!ok) continue;
     tg = gp_Dir(tmp); 
     return Standard_True;    
@@ -477,9 +479,11 @@ static Standard_Boolean FUN_staproj(const TopoDS_Edge& e,const Standard_Real pf,
                       const Standard_Real factor, const Standard_Integer st, const TopoDS_Face& f, 
                       TopAbs_State& sta)
 {
-  Standard_Real par;Standard_Boolean ok = FUN_getnearpar(e,pe,pf,pl,factor,st, par);
+  Standard_Real par = 0.;
+  Standard_Boolean ok = FUN_getnearpar(e,pe,pf,pl,factor,st, par);
   if (!ok) return Standard_False;
-  gp_Pnt pt;  ok = FUN_tool_value(par,e, pt);
+  gp_Pnt pt;
+  ok = FUN_tool_value(par,e, pt);
   if (!ok) return Standard_False;
   gp_Pnt2d uv; ok = TopOpeBRepTool_TOOL::Getstp3dF(pt,f,uv,sta);
   return ok;
index 96bcd5f..0622563 100644 (file)
@@ -5750,12 +5750,12 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
 
   theCommands.Add("vsetshading",
       "vsetshading  : vsetshading name Quality(default=0.0008) "
-      "\n\t\t: Sets deflection coefficient that defines the quality of the shape\92s representation in the shading mode.",
+      "\n\t\t: Sets deflection coefficient that defines the quality of the shape representation in the shading mode.",
       __FILE__,VShading,group);
 
   theCommands.Add("vunsetshading",
       "vunsetshading :vunsetshading name "
-      "\n\t\t: Sets default deflection coefficient (0.0008) that defines the quality of the shape\92s representation in the shading mode.",
+      "\n\t\t: Sets default deflection coefficient (0.0008) that defines the quality of the shape representation in the shading mode.",
       __FILE__,VShading,group);
 
   theCommands.Add ("vtexture",
index 2c13b0b..8636f20 100644 (file)
@@ -266,9 +266,9 @@ static Standard_Integer DumpDGTs (Draw_Interpretor& di, Standard_Integer argc, c
                 if (!aModif.IsEmpty())
                 {
                   di << ",";
-                  for (Standard_Integer k = aModif.Lower(); k <= aModif.Upper(); k++)
+                  for (Standard_Integer iModif = aModif.Lower(); iModif <= aModif.Upper(); iModif++)
                   {
-                    di << " M " << aModif.Value(k);
+                    di << " M " << aModif.Value(iModif);
                   }
                 }
                 XCAFDimTolObjects_DatumModifWithValue aM;