0026852: Coding - compiler warnings issued by GCC 5.2.1
authorabv <abv@opencascade.com>
Sun, 8 Nov 2015 16:29:24 +0000 (19:29 +0300)
committerabv <abv@opencascade.com>
Mon, 9 Nov 2015 12:04:54 +0000 (15:04 +0300)
Compiler warnings eliminated:
- BRepAlgo_DSAccess: avoid copying of local list
- IntPatch, IntTools: initialize "possibly used uninitialized" variables by zeros
- Intf: slight refactoring
- OSD_signal: suppress unused argument
- OpenGL: add missing initializers in structures
- STEPConstruct_GDTProperty: correct function signature to pass output parameters by reference

src/BRepAlgo/BRepAlgo_DSAccess.cxx
src/IntPatch/IntPatch_ImpImpIntersection_4.gxx
src/IntTools/IntTools_EdgeEdge.cxx
src/Intf/Intf_Tool.cxx
src/OSD/OSD_signal.cxx
src/OpenGl/OpenGl_AspectFace.cxx
src/OpenGl/OpenGl_AspectMarker.cxx
src/OpenGl/OpenGl_GraphicDriver.cxx
src/OpenGl/OpenGl_Trihedron.cxx
src/STEPConstruct/STEPConstruct_GDTProperty.cxx
src/STEPConstruct/STEPConstruct_GDTProperty.hxx

index 620365e..ae103e3 100644 (file)
@@ -443,12 +443,12 @@ const TopTools_ListOfShape& BRepAlgo_DSAccess::SectionVertex
 (const TopoDS_Shape& F,
  const TopoDS_Shape& E)
 {
-  TopTools_ListOfShape Result;
-  Result.Clear();
-  if(F.ShapeType() != TopAbs_FACE) return myEmptyListOfShape;
-  if(E.ShapeType() != TopAbs_EDGE) return myEmptyListOfShape;
+  myListOfVertex.Clear();
+  if(F.ShapeType() != TopAbs_FACE || E.ShapeType() != TopAbs_EDGE)
+    return myListOfVertex;
   Standard_Integer iF = myHDS->Shape(F), iE = myHDS->Shape(E);
-  if((iF == 0) || (iE == 0)) return myEmptyListOfShape;
+  if((iF == 0) || (iE == 0))
+    return myListOfVertex;
 
   const TopOpeBRepDS_DataStructure& DS = myHDS->DS();
   const TopOpeBRepDS_ListOfInterference& LI = 
@@ -464,13 +464,12 @@ const TopTools_ListOfShape& BRepAlgo_DSAccess::SectionVertex
       goodKind  = I->GeometryType();
       goodIndex = I->Geometry();
       if(goodKind == TopOpeBRepDS_VERTEX)
-       Result.Append(myHDS->Shape(goodIndex));
+       myListOfVertex.Append(myHDS->Shape(goodIndex));
       else 
        if (goodKind == TopOpeBRepDS_POINT)
-         Result.Append(myHB->NewVertex(goodIndex));
+         myListOfVertex.Append(myHB->NewVertex(goodIndex));
     }
   }
-  myListOfVertex = Result;
   return myListOfVertex;
 }
 
index 02704fe..6b05437 100644 (file)
@@ -2510,7 +2510,7 @@ Standard_Boolean IntCyCyTrim( const IntSurf_Quadric& theQuad1,
         anUexpect[i] = anUf;
       }
       
-      Standard_Real aCriticalDelta[aNbCritPointsMax];
+      Standard_Real aCriticalDelta[aNbCritPointsMax] = {0};
       for(Standard_Integer aCritPID = 0; aCritPID < aNbCritPoints; aCritPID++)
       { //We are not intersted in elements of aCriticalDelta array
         //if their index is greater than or equal to aNbCritPoints
index d9474f0..095fb50 100644 (file)
@@ -1030,6 +1030,7 @@ Standard_Integer FindDistPC(const Standard_Real aT1A,
   //
   iC = bMaxDist ? 1 : -1;
   iErr = 0;
+  aT1max = aT2max = 0.; // silence GCC warning
   //
   aGS = 0.6180339887498948482045868343656;// =0.5*(1.+sqrt(5.))-1.;
   aA = aT1A;
index 0b2a28b..c776f2e 100644 (file)
@@ -975,39 +975,24 @@ Standard_Integer Intf_Tool::Inters3d(const gp_Hypr& theCurv,
     {
       if(parint[i] <= parint[j])
       {
-        Standard_Real aTemp = parint[i];
-        parint[i] = parint[j];
-        parint[j] = aTemp;
-
-        aTemp = zint[i];
-        zint[i] = zint[j];
-        zint[j] = aTemp;
-
-        aTemp = yint[i];
-        yint[i] = yint[j];
-        yint[j] = aTemp;
-
-        aTemp = xint[i];
-        xint[i] = xint[j];
-        xint[j] = aTemp;
-
-        aTemp = bord[i];
-        bord[i] = bord[j];
-        bord[j] = RealToInt(aTemp);
+       std::swap (parint[i], parint[j]);
+       std::swap (zint[i], zint[j]);
+       std::swap (yint[i], yint[j]);
+       std::swap (xint[i], xint[j]);
+       std::swap (bord[i], bord[j]);
       }
 
       if((i < nbpi - 1) && IsEqual(parint[i], parint[i+1]))
       {
-        for(Standard_Integer k = i + 1; k < aNbDiffPoints; k++)
+        aNbDiffPoints--;
+        for(Standard_Integer k = i; k < aNbDiffPoints; k++)
         {
-          parint[k-1] = parint[k];
-          zint[k-1] = zint[k];
-          yint[k-1] = yint[k];
-          xint[k-1] = xint[k];
-          bord[k-1] = bord[k];
+          parint[k] = parint[k+1];
+          zint[k] = zint[k+1];
+          yint[k] = yint[k+1];
+          xint[k] = xint[k+1];
+          bord[k] = bord[k+1];
         }
-
-        aNbDiffPoints--;
       }
     }
   }
index 4979916..6f7f009 100644 (file)
@@ -343,7 +343,8 @@ static void SegvHandler(const int theSignal,
     return;
   }
 #else
-  (void )theContext;
+  (void)theSignal; // silence GCC warnings
+  (void)theContext;
 #endif
 #ifdef linux
   if (fFltExceptions)
index a425216..0b290b5 100644 (file)
@@ -43,7 +43,8 @@ namespace
     {{ 1.0F, 1.0F, 1.0F, 1.0F }}, // diffuse color
     {{ 1.0F, 1.0F, 1.0F, 1.0F }}, // specular color
     {{ 1.0F, 1.0F, 1.0F, 1.0F }}, // emissive color
-    {{ 1.0F, 1.0F, 1.0F, 1.0F }}  // material color
+    {{ 1.0F, 1.0F, 1.0F, 1.0F }}, // material color
+    Graphic3d_BSDF()
   };
 
   static const TCollection_AsciiString THE_EMPTY_KEY;
index bc3508b..6227c16 100644 (file)
@@ -174,19 +174,19 @@ typedef PM_FONT_INFO* pm_font_info;
 static const PM_FONT_INFO arrPMFontInfo[][TEL_NO_OF_SIZES] =
 {
  // TOM_POINT - not used
- {{0},
-  {0},
-  {0},
-  {0},
-  {0},
-  {0},
-  {0},
-  {0},
-  {0},
-  {0},
-  {0},
-  {0},
-  {0}},
+ {{0, 0, 0},
+  {0, 0, 0},
+  {0, 0, 0},
+  {0, 0, 0},
+  {0, 0, 0},
+  {0, 0, 0},
+  {0, 0, 0},
+  {0, 0, 0},
+  {0, 0, 0},
+  {0, 0, 0},
+  {0, 0, 0},
+  {0, 0, 0},
+  {0, 0, 0}},
 
  // TOM_PLUS
  {{ 9.f,  9.f, PM_PLUS_10_OFT},
index 545009d..3881cfe 100644 (file)
@@ -492,7 +492,8 @@ void OpenGl_GraphicDriver::TextSize (const Handle(Graphic3d_CView)& theView,
     { 1.F, 1.F, 1.F }, //ColorSubTitle
     0, //TextZoomable
     0.F, //TextAngle
-    (int)Font_FA_Regular //TextFontAspect
+    (int)Font_FA_Regular, //TextFontAspect
+    0 //ShaderProgram
   };
   aTextAspect.SetAspect(aDefaultContextText);
   TCollection_ExtendedString anExtText = theText;
index e25d821..11c0178 100644 (file)
@@ -197,7 +197,7 @@ void OpenGl_Trihedron::redraw (const Handle(OpenGl_Workspace)& theWorkspace) con
 
   // Set line aspect
   const OpenGl_AspectLine* aCurrentAspectLine = theWorkspace->AspectLine (Standard_True);
-  CALL_DEF_CONTEXTLINE aLineAspect = {1, 1, { 1.F, 1.F, 1.F },  aCurrentAspectLine->Type(), aCurrentAspectLine->Width()};
+  CALL_DEF_CONTEXTLINE aLineAspect = {1, 1, { 1.F, 1.F, 1.F },  aCurrentAspectLine->Type(), aCurrentAspectLine->Width(), 0};
   aLineAspect.Color.r = myZColor.r();
   aLineAspect.Color.g = myZColor.g();
   aLineAspect.Color.b = myZColor.b();
index c777b29..59cdd34 100644 (file)
@@ -166,9 +166,9 @@ void STEPConstruct_GDTProperty::GetDimModifiers(const Handle(StepRepr_CompoundRe
 //purpose  : 
 //=======================================================================
 void STEPConstruct_GDTProperty::GetDimClassOfTolerance(const Handle(StepShape_LimitsAndFits)& theLAF,
-                                   Standard_Boolean theHolle,
-                                   XCAFDimTolObjects_DimensionFormVariance theFV,
-                                   XCAFDimTolObjects_DimensionGrade theG)
+                                   Standard_Boolean& theHolle,
+                                   XCAFDimTolObjects_DimensionFormVariance& theFV,
+                                   XCAFDimTolObjects_DimensionGrade& theG)
 {
   Handle(TCollection_HAsciiString) aFormV = theLAF->FormVariance();
   Handle(TCollection_HAsciiString) aGrade = theLAF->Grade();
@@ -597,4 +597,4 @@ Standard_Boolean STEPConstruct_GDTProperty::GetTolValueType(const Handle(TCollec
       return Standard_True;
     }
     return Standard_False;
-}
\ No newline at end of file
+}
index cd995eb..19204e2 100644 (file)
@@ -47,9 +47,9 @@ public:
                                               XCAFDimTolObjects_DimensionModifiersSequence& theModifiers);
 
   Standard_EXPORT static void GetDimClassOfTolerance(const Handle(StepShape_LimitsAndFits)& theLAF,
-                                                     Standard_Boolean theHolle,
-                                                     XCAFDimTolObjects_DimensionFormVariance theFV,
-                                                     XCAFDimTolObjects_DimensionGrade theG);
+                                                     Standard_Boolean& theHolle,
+                                                     XCAFDimTolObjects_DimensionFormVariance& theFV,
+                                                     XCAFDimTolObjects_DimensionGrade& theG);
 
   Standard_EXPORT static Standard_Boolean GetDimType(const Handle(TCollection_HAsciiString)& theName,
                                                      XCAFDimTolObjects_DimensionType& theType);