0028956: Coding Rules - eliminate several trivial compiler warnings
authorkgv <kgv@opencascade.com>
Fri, 28 Jul 2017 06:42:11 +0000 (09:42 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 28 Jul 2017 12:34:55 +0000 (15:34 +0300)
Eliminated GCC warning -Wsign-compare introduced by patch for #0028786.
Eliminated (false) GCC warning -Wuninitialized introduced by patch for #0027117.

Suppressed GCC warning "-Wunused-but-set-variable" with OCCT_DEBUG defined

src/BRepClass3d/BRepClass3d_SClassifier.cxx
src/Bisector/Bisector_BisecAna.cxx
src/DNaming/DNaming_Line3DDriver.cxx
src/GccAna/GccAna_Circ2d3Tan_1.cxx
src/GccAna/GccAna_Circ2d3Tan_6.cxx
src/GccAna/GccAna_Circ2d3Tan_8.cxx
src/IntCurveSurface/IntCurveSurface_Inter.gxx
src/Message/Message_Report.cxx

index 16e0bf8..edc87e2 100644 (file)
@@ -313,11 +313,14 @@ void BRepClass3d_SClassifier::Perform(BRepClass3d_SolidExplorer& SolidExplorer,
           continue;
         TopoDS_Face f1 = TopoDS::Face(ffs.First());
         TopoDS_Face f2 = TopoDS::Face(ffs.Last());
-        IntCurveSurface_TransitionOnCurve tran;
         TopoDS_Vertex V1, V2;
         TopExp::Vertices(EE, V1, V2);
         if (LVInts.Contains(V1) || LVInts.Contains(V2))
+        {
           continue;
+        }
+
+        IntCurveSurface_TransitionOnCurve tran = IntCurveSurface_Tangent;
         Standard_Integer Tst = GetTransi(f1, f2, EE, param, L, tran);
         if (Tst == 1 && Abs(Lpar) < Abs(parmin))
         {
index baeda5f..6e5330d 100644 (file)
@@ -839,11 +839,8 @@ void Bisector_BisecAna::Perform(const Handle(Geom2d_Curve)& afirstcurve  ,
   }
 
   aFirstCurveType = curve->DynamicType();
-#ifdef OCCT_DEBUG
-  gp_Pnt2d Point(asecondpoint->Pnt2d());
-#else
-  asecondpoint->Pnt2d();
-#endif
+  const gp_Pnt2d aPoint(asecondpoint->Pnt2d());
+  (void )aPoint;
   if (aFirstCurveType == STANDARD_TYPE(Geom2d_Circle)) {
     cas = 1;
     Handle(Geom2d_Circle) C1 = Handle(Geom2d_Circle)::DownCast(curve);
index 438ab05..1cc2c61 100644 (file)
@@ -118,13 +118,15 @@ Standard_Integer DNaming_Line3DDriver::Execute(Handle(TFunction_Logbook)& theLog
 #ifdef OCCT_DEBUG
     if(!aNS1->IsEmpty()) {
       aShape1 = aNS1->Get();
-      gp_Pnt aDebPoint = BRep_Tool::Pnt(TopoDS::Vertex(aShape1));
+      const gp_Pnt aDebPoint = BRep_Tool::Pnt(TopoDS::Vertex(aShape1));
+      (void )aDebPoint;
       //       cout << aCounter << " X = " <<  aDebPoint.X() << " Y = " <<  aDebPoint.Y() << " Z = " <<  aDebPoint.Z() << endl;
     } else
       cout << " Line3DDriver:: NS1 is empty" << endl;
     if(!aNS2->IsEmpty()) {
       aShape2 = aNS2->Get();
-      gp_Pnt aDebPoint = BRep_Tool::Pnt(TopoDS::Vertex(aShape2));
+      const gp_Pnt aDebPoint = BRep_Tool::Pnt(TopoDS::Vertex(aShape2));
+      (void )aDebPoint;
       //      cout << aCounter+1 << " X = " <<  aDebPoint.X() << " Y = " <<  aDebPoint.Y() << " Z = " <<  aDebPoint.Z() << endl;
     } else
       cout << " Line3DDriver:: NS2 is empty" << endl;
@@ -137,10 +139,12 @@ Standard_Integer DNaming_Line3DDriver::Execute(Handle(TFunction_Logbook)& theLog
     aShape1 = aNS1->Get();
     aShape2 = aNS2->Get();
 #ifdef OCCT_DEBUG
-    gp_Pnt aDebPoint = BRep_Tool::Pnt(TopoDS::Vertex(aShape1));
-    //      cout << aCounter << " X = " <<  aDebPoint.X() << " Y = " <<  aDebPoint.Y() << " Z = " <<  aDebPoint.Z() << endl;
-    aDebPoint = BRep_Tool::Pnt(TopoDS::Vertex(aShape2));
-    //      cout << aCounter+1 << " X = " <<  aDebPoint.X() << " Y = " <<  aDebPoint.Y() << " Z = " <<  aDebPoint.Z() << endl;
+    const gp_Pnt aDebPoint1 = BRep_Tool::Pnt(TopoDS::Vertex(aShape1));
+    const gp_Pnt aDebPoint2 = BRep_Tool::Pnt(TopoDS::Vertex(aShape2));
+    //      cout << aCounter   << " X = " <<  aDebPoint1.X() << " Y = " <<  aDebPoint1.Y() << " Z = " <<  aDebPoint1.Z() << endl;
+    //      cout << aCounter+1 << " X = " <<  aDebPoint2.X() << " Y = " <<  aDebPoint2.Y() << " Z = " <<  aDebPoint2.Z() << endl;
+    (void )aDebPoint1;
+    (void )aDebPoint2;
 #endif 
     if(aShape1.ShapeType() != TopAbs_VERTEX || aShape2.ShapeType() != TopAbs_VERTEX) {
       aFunction->SetFailure(WRONG_ARGUMENT);
index 21b29bb..4550d81 100644 (file)
@@ -89,11 +89,9 @@ GccAna_Circ2d3Tan::
   Standard_Real R1 = C1.Radius();
   Standard_Real R2 = C2.Radius();
   gp_Pnt2d center1(C1.Location());
-#ifdef OCCT_DEBUG
   gp_Pnt2d center2(C2.Location());
-#else
-  C2.Location() ;
-#endif
+  (void )center2;
+
   gp_Pnt2d origin3(L3.Location());
   gp_Dir2d dir3(L3.Direction());
   gp_Dir2d normL3(-dir3.Y(),dir3.X());
index 005760b..4e795a9 100644 (file)
@@ -93,18 +93,14 @@ GccAna_Circ2d3Tan::
      Standard_Integer nbsolution1 = Bis1.NbSolutions();
      Handle(GccInt_Bisec) Sol2 = Bis2.ThisSolution();
      for (Standard_Integer i = 1 ; i <=  nbsolution1; i++) {
-#ifdef OCCT_DEBUG
-       gp_Lin2d Sol1(Bis1.ThisSolution(i));
-#else
-       Bis1.ThisSolution(i) ;
-#endif
+       const gp_Lin2d Sol1(Bis1.ThisSolution(i));
        GccInt_IType typ2 = Sol2->ArcType();
        IntAna2d_AnaIntersection Intp;
        if (typ2 == GccInt_Lin) {
-        Intp.Perform(Bis1.ThisSolution(i),Sol2->Line());
+        Intp.Perform(Sol1,Sol2->Line());
        }
        else if (typ2 == GccInt_Par) {
-        Intp.Perform(Bis1.ThisSolution(i),IntAna2d_Conic(Sol2->Parabola()));
+        Intp.Perform(Sol1,IntAna2d_Conic(Sol2->Parabola()));
        }
        if (Intp.IsDone()) {
         if (!Intp.IsEmpty()) {
index 33a0c0b..6c23405 100644 (file)
@@ -88,14 +88,9 @@ GccAna_Circ2d3Tan::
    GccAna_Pnt2dBisec Bis1(Point2,Point3);
    GccAna_LinPnt2dBisec Bis2(L1,Point2);
    if (Bis1.IsDone() && Bis2.IsDone()) {
-     gp_Lin2d linint1(Bis1.ThisSolution());
+     const gp_Lin2d linint1(Bis1.ThisSolution());
      Handle(GccInt_Bisec) Sol2 = Bis2.ThisSolution();
      GccInt_IType typ2 = Sol2->ArcType();
-#ifdef OCCT_DEBUG
-     gp_Lin2d linintb(Bis1.ThisSolution());
-#else
-     Bis1.ThisSolution() ;
-#endif
      IntAna2d_AnaIntersection Intp;
      if (typ2 == GccInt_Lin) {
        gp_Lin2d linint2(Sol2->Line());
index 3038684..e0bad06 100644 (file)
@@ -942,12 +942,8 @@ void IntCurveSurface_Inter::PerformConicSurf(const gp_Lin&   Line,
        Standard_Integer nbp = intlintorus.NbPoints();
        Standard_Real fi,theta,w;
        for(Standard_Integer i = 1; i<= nbp; i++) { 
-#ifndef OCCT_DEBUG
-         gp_Pnt P;
-         P = intlintorus.Value(i);
-#else
-         gp_Pnt P(intlintorus.Value(i));
-#endif
+         const gp_Pnt aDebPnt(intlintorus.Value(i));
+         (void )aDebPnt;
          w = intlintorus.ParamOnLine(i);
          intlintorus.ParamOnTorus(i,fi,theta);
          AppendPoint(curve,w,surface,fi,theta);
index 012c644..0732459 100644 (file)
@@ -37,7 +37,7 @@ Message_Report::Message_Report ()
 void Message_Report::AddAlert (Message_Gravity theGravity, const Handle(Message_Alert)& theAlert)
 {
   Standard_ASSERT_RETURN (! theAlert.IsNull(), "Attempt to add null alert",);
-  Standard_ASSERT_RETURN (theGravity >= 0 && theGravity < sizeof(myAlerts)/sizeof(myAlerts[0]), 
+  Standard_ASSERT_RETURN (theGravity >= 0 && size_t(theGravity) < sizeof(myAlerts)/sizeof(myAlerts[0]), 
                           "Adding alert with gravity not in valid range",);
 
   Standard_Mutex::Sentry aSentry (myMutex);
@@ -68,7 +68,7 @@ void Message_Report::AddAlert (Message_Gravity theGravity, const Handle(Message_
 const Message_ListOfAlert& Message_Report::GetAlerts (Message_Gravity theGravity) const
 {
   static const Message_ListOfAlert anEmptyList;
-  Standard_ASSERT_RETURN (theGravity >= 0 && theGravity < sizeof(myAlerts)/sizeof(myAlerts[0]), 
+  Standard_ASSERT_RETURN (theGravity >= 0 && size_t(theGravity) < sizeof(myAlerts)/sizeof(myAlerts[0]), 
                           "Requesting alerts for gravity not in valid range", anEmptyList);
   return myAlerts[theGravity];
 }
@@ -95,7 +95,7 @@ Standard_Boolean Message_Report::HasAlert (const Handle(Standard_Type)& theType)
 
 Standard_Boolean Message_Report::HasAlert (const Handle(Standard_Type)& theType, Message_Gravity theGravity)
 {
-  Standard_ASSERT_RETURN (theGravity >= 0 && theGravity < sizeof(myAlerts)/sizeof(myAlerts[0]), 
+  Standard_ASSERT_RETURN (theGravity >= 0 && size_t(theGravity) < sizeof(myAlerts)/sizeof(myAlerts[0]), 
                           "Requesting alerts for gravity not in valid range", Standard_False);
   for (Message_ListOfAlert::Iterator anIt (myAlerts[theGravity]); anIt.More(); anIt.Next())
   {
@@ -125,7 +125,7 @@ void Message_Report::Clear ()
 
 void Message_Report::Clear (Message_Gravity theGravity)
 {
-  Standard_ASSERT_RETURN (theGravity >= 0 && theGravity < sizeof(myAlerts)/sizeof(myAlerts[0]), 
+  Standard_ASSERT_RETURN (theGravity >= 0 && size_t(theGravity) < sizeof(myAlerts)/sizeof(myAlerts[0]), 
                           "Requesting alerts for gravity not in valid range", );
   myAlerts[theGravity].Clear();
 }
@@ -173,7 +173,7 @@ void Message_Report::Dump (Standard_OStream& theOS)
 
 void Message_Report::Dump (Standard_OStream& theOS, Message_Gravity theGravity)
 {
-  Standard_ASSERT_RETURN (theGravity >= 0 && theGravity < sizeof(myAlerts)/sizeof(myAlerts[0]), 
+  Standard_ASSERT_RETURN (theGravity >= 0 && size_t(theGravity) < sizeof(myAlerts)/sizeof(myAlerts[0]), 
                           "Requesting alerts for gravity not in valid range", );
 
   // report each type of warning only once
@@ -208,7 +208,7 @@ void Message_Report::SendMessages (const Handle(Message_Messenger)& theMessenger
 
 void Message_Report::SendMessages (const Handle(Message_Messenger)& theMessenger, Message_Gravity theGravity)
 {
-  Standard_ASSERT_RETURN (theGravity >= 0 && theGravity < sizeof(myAlerts)/sizeof(myAlerts[0]), 
+  Standard_ASSERT_RETURN (theGravity >= 0 && size_t(theGravity) < sizeof(myAlerts)/sizeof(myAlerts[0]), 
                           "Requesting alerts for gravity not in valid range", );
 
   // report each type of warning only once