1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00

0026988: Fresh compiler warnings (VC++ 14, GCC 5.2.1, CLang 3.6.2)

Compiler warnings eliminated:

- VC++: potential use of uninitialized variable
- GCC: potential use of uninitialized variable [-Wmaybe-uninitialized], redundant const on return value [-Wignored-qualifiers]
- CLang: missing override specifier on overloaded virtual function [-Winconsistent-missing-override], function call within typeid() [-Wpotentially-evaluated-expression]
This commit is contained in:
abv 2015-12-13 13:21:54 +03:00 committed by bugmaster
parent 795be040eb
commit c785481848
20 changed files with 83 additions and 89 deletions

View File

@ -86,16 +86,16 @@ void ApproxInt_KnotTools::ComputeKnotInds(const NCollection_LocalArray<Standard_
TColStd_Array1OfReal aCurv(thePars.Lower(), thePars.Upper());
// Arrays are allocated for max theDim = 7: 1 3d curve + 2 2d curves.
Standard_Real Val[21], Par[3], Res[21];
Standard_Integer i, j, k, l, m, ic;
Standard_Integer i, j, m, ic;
Standard_Real aMaxCurv = 0.;
Standard_Integer dim = theDim;
//
i = aCurv.Lower();
for(j = 0; j < 3; ++j)
{
k = i+j;
Standard_Integer k = i+j;
ic = (k - aCurv.Lower()) * dim;
l = dim*j;
Standard_Integer l = dim*j;
for(m = 0; m < dim; ++m)
{
Val[l + m] = theCoords[ic + m];
@ -115,9 +115,9 @@ void ApproxInt_KnotTools::ComputeKnotInds(const NCollection_LocalArray<Standard_
{
for(j = 0; j < 3; ++j)
{
k = i+j-1;
Standard_Integer k = i+j-1;
ic = (k - aCurv.Lower()) * dim;
l = dim*j;
Standard_Integer l = dim*j;
for(m = 0; m < dim; ++m)
{
Val[l + m] = theCoords[ic + m];
@ -136,9 +136,9 @@ void ApproxInt_KnotTools::ComputeKnotInds(const NCollection_LocalArray<Standard_
i = aCurv.Upper();
for(j = 0; j < 3; ++j)
{
k = i+j-2;
Standard_Integer k = i+j-2;
ic = (k - aCurv.Lower()) * dim;
l = dim*j;
Standard_Integer l = dim*j;
for(m = 0; m < dim; ++m)
{
Val[l + m] = theCoords[ic + m];
@ -243,19 +243,18 @@ void ApproxInt_KnotTools::ComputeKnotInds(const NCollection_LocalArray<Standard_
ici1 = (anIndNext - aCurv.Lower()) * theDim,
icm = (anInd - aCurv.Lower()) * theDim;
NCollection_LocalArray<Standard_Real> V1(theDim), V2(theDim);
Standard_Integer k,l;
Standard_Real mp = 0., m1 = 0., m2 = 0.;
Standard_Real p;
for(k = 0; k < theDim; ++k)
for(Standard_Integer k = 0; k < theDim; ++k)
{
V1[k] = theCoords[icm + k] - theCoords[ici + k];
m1 += V1[k]*V1[k];
V2[k] = theCoords[ici1 + k] - theCoords[icm + k];
m2 += V2[k]*V2[k];
}
for(k = 1; k < theDim; ++k)
for(Standard_Integer k = 1; k < theDim; ++k)
{
for(l = 0; l < k; ++l)
for(Standard_Integer l = 0; l < k; ++l)
{
p = V1[k]*V2[l] - V1[l]*V2[k];
mp += p*p;

View File

@ -91,7 +91,7 @@ public:
//! Returns true to indicate the need to copy polygon;
//! copies it if required
Standard_Boolean NewPolygon(const TopoDS_Edge& E, Handle(Poly_Polygon3D)& P)
Standard_Boolean NewPolygon(const TopoDS_Edge& E, Handle(Poly_Polygon3D)& P) Standard_OVERRIDE
{
if (!myCopyMesh)
return Standard_False;
@ -111,7 +111,7 @@ public:
//! Returns true to indicate the need to copy polygon;
//! copies it if required
Standard_Boolean NewPolygonOnTriangulation(const TopoDS_Edge& E, const TopoDS_Face& F,
Handle(Poly_PolygonOnTriangulation)& P)
Handle(Poly_PolygonOnTriangulation)& P) Standard_OVERRIDE
{
if (!myCopyMesh)
return Standard_False;

View File

@ -4700,6 +4700,9 @@ Standard_Boolean CheckBiNormals
Standard_Boolean& bRemove,
const Standard_Boolean RemoveInvalidFaces)
{
bKeep = Standard_True;
bRemove = Standard_False;
Standard_Boolean bChecked;
Standard_Integer aNbEdgesChecked;
Standard_Real anAngle;
@ -4792,8 +4795,6 @@ Standard_Boolean CheckBiNormals
}
//
// decide whether to remove the split face or not
bKeep = Standard_True;
bRemove = Standard_False;
//
Standard_Integer aNb = aMEInv.Extent();
if (aNb == 0) {

View File

@ -100,14 +100,6 @@ IVtkDraw_Interactor::~IVtkDraw_Interactor()
{
}
//===========================================================
// Function : Copy constructor
// Purpose :
//===========================================================
IVtkDraw_Interactor::IVtkDraw_Interactor (const IVtkDraw_Interactor& )
{
}
//===========================================================
// Function : SetShapePicker
// Purpose :

View File

@ -69,10 +69,8 @@ public:
protected:
IVtkDraw_Interactor();
IVtkDraw_Interactor (const IVtkDraw_Interactor& );
~IVtkDraw_Interactor();
#ifdef _WIN32
friend LRESULT CALLBACK WndProc (HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam);
friend LRESULT CALLBACK ViewerWindowProc (HWND hwnd,
@ -97,6 +95,10 @@ protected:
void GetMousePosition (Standard_Integer *theX, Standard_Integer *theY);
#endif
private:
// copying is prohibited
IVtkDraw_Interactor (const IVtkDraw_Interactor&);
void operator = (const IVtkDraw_Interactor&);
private:

View File

@ -55,7 +55,7 @@ private:
//! @param [in] selection container for sensitive primitives
//! @param [in] mode Selection mode
void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
const Standard_Integer theMode);
const Standard_Integer theMode) Standard_OVERRIDE;
const Bnd_Box& BoundingBox();

View File

@ -59,7 +59,7 @@ public:
IVtk_IdType GetSubShapeId (const TopoDS_Shape& theSubShape) const;
//! Get ids of sub-shapes composing a sub-shape with the given id
Standard_EXPORT IVtk_ShapeIdList GetSubIds (const IVtk_IdType) const;
Standard_EXPORT IVtk_ShapeIdList GetSubIds (const IVtk_IdType) const Standard_OVERRIDE;
//! @brief Get a sub-shape by its local ID.
//!

View File

@ -53,8 +53,7 @@ public:
const Standard_Integer theNbVIsos = 1)
: myDevCoeff (theDevCoeff),
myDevAngle (theDevAngle),
myDeflection (0.0),
myPointId (0)
myDeflection (0.0)
{
myNbIsos[0] = theNbUIsos;
myNbIsos[1] = theNbVIsos;
@ -88,7 +87,7 @@ public:
protected:
//! Executes the mesh generation algorithms. To be defined in implementation class.
Standard_EXPORT virtual void internalBuild();
Standard_EXPORT virtual void internalBuild() Standard_OVERRIDE;
private:
//! Internal method, generates OCCT triangulation starting from TopoDS_Shape
@ -186,7 +185,6 @@ private:
Standard_Real myDevCoeff;
Standard_Real myDevAngle;
mutable Standard_Real myDeflection;
IVtk_PointId myPointId;
Standard_Integer myNbIsos[2];
};

View File

@ -38,15 +38,16 @@ public:
//! Sets the picker's view interface.
//! The picker uses the view to obtain parameters of
//! the 3D view projection.
Standard_EXPORT virtual void SetView (const IVtk_IView::Handle& theView);
Standard_EXPORT virtual void SetView (const IVtk_IView::Handle& theView) Standard_OVERRIDE;
//! Get number of picked entities.
Standard_EXPORT virtual int NbPicked();
Standard_EXPORT virtual int NbPicked() Standard_OVERRIDE;
//! Get activated selection modes for a shape.
//! @param [in] theShape a shape with activated selection mode(s)
//! @return list of active selection modes
Standard_EXPORT virtual IVtk_SelectionModeList GetSelectionModes (const IVtk_IShape::Handle& theShape) const;
Standard_EXPORT virtual IVtk_SelectionModeList
GetSelectionModes (const IVtk_IShape::Handle& theShape) const Standard_OVERRIDE;
public: //! @name Set selectable shapes and selection modes
@ -58,7 +59,7 @@ public: //! @name Set selectable shapes and selection modes
//! @param [in] theIsTurnOn Flag to turn on/off the selection mode
Standard_EXPORT virtual void SetSelectionMode (const IVtk_IShape::Handle& theShape,
const IVtk_SelectionMode theMode,
const bool theIsTurnOn = true);
const bool theIsTurnOn = true) Standard_OVERRIDE;
//! Activates/deactivates the given selection mode for the shape.
//! If mode == SM_None, the shape becomes non-selectable and
@ -68,31 +69,32 @@ public: //! @name Set selectable shapes and selection modes
//! @param [in] theIsTurnOn Flag to turn on/off the selection mode
Standard_EXPORT virtual void SetSelectionMode (const IVtk_ShapePtrList& theShapes,
const IVtk_SelectionMode theMode,
const bool theIsTurnOn = true);
const bool theIsTurnOn = true) Standard_OVERRIDE;
public: //! @name Picking methods
Standard_EXPORT virtual bool Pick (const double theX, const double theY);
Standard_EXPORT virtual bool Pick (const double theX, const double theY) Standard_OVERRIDE;
Standard_EXPORT virtual bool Pick (const double theXMin,
const double theYMin,
const double theXMax,
const double theYMax);
const double theYMax) Standard_OVERRIDE;
Standard_EXPORT virtual bool Pick (double** thePolyLine, const int theNbPoints);
Standard_EXPORT virtual bool Pick (double** thePolyLine, const int theNbPoints) Standard_OVERRIDE;
public: //! @name Obtain picking results
//! @return the list of picked top-level shape IDs,
//! in the order of increasing depth (the ID of the shape closest to the eye
//! is the first in the list)
Standard_EXPORT virtual const IVtk_ShapeIdList& ShapesPicked() const;
Standard_EXPORT virtual const IVtk_ShapeIdList& ShapesPicked() const Standard_OVERRIDE;
//! @param [in] theId Top-level shape ID
//! @param [out] theShapeList the list of picked sub-shape IDs for the given top-level shape ID,
//! in the order of increasing depth (the ID of the sub-shape closest to the eye
//! is the first in the list)
Standard_EXPORT virtual void SubShapesPicked (const IVtk_IdType theId, IVtk_ShapeIdList& theShapeList) const;
Standard_EXPORT virtual void
SubShapesPicked (const IVtk_IdType theId, IVtk_ShapeIdList& theShapeList) const Standard_OVERRIDE;
public:

View File

@ -135,7 +135,7 @@ void IVtkTools_DisplayModeFilter::SetDisplayMode(const IVtk_DisplayMode theMode)
// Method: GetDisplayMode
// Purpose:
//============================================================================
const IVtk_DisplayMode IVtkTools_DisplayModeFilter::GetDisplayMode () const
IVtk_DisplayMode IVtkTools_DisplayModeFilter::GetDisplayMode () const
{
return myDisplayMode;
}

View File

@ -39,7 +39,7 @@ public:
void SetDisplaySharedVertices (const bool doDisplay);
//! Get current display mode.
const IVtk_DisplayMode GetDisplayMode() const;
IVtk_DisplayMode GetDisplayMode() const;
protected:
//! Filter cells according to the given set of ids.

View File

@ -62,7 +62,7 @@ public:
//! @param [in] theY Y coordinate
//! @param [in] theZ Z coordinate
//! @return id of added point
Standard_EXPORT virtual IVtk_PointId InsertCoordinate (double theX, double theY, double theZ);
Standard_EXPORT virtual IVtk_PointId InsertCoordinate (double theX, double theY, double theZ) Standard_OVERRIDE;
//! Insert a vertex.
//! @param [in] theShapeID id of the subshape to which the vertex belongs.
@ -70,7 +70,7 @@ public:
//! @param [in] theMeshType mesh type of the subshape (MT_Undefined by default)
Standard_EXPORT virtual void InsertVertex (const IVtk_IdType theShapeID,
const IVtk_PointId thePointId,
const IVtk_MeshType theMeshType);
const IVtk_MeshType theMeshType) Standard_OVERRIDE;
//! Insert a line.
//! @param [in] theShapeID id of the subshape to which the line belongs.
@ -80,7 +80,7 @@ public:
Standard_EXPORT virtual void InsertLine (const IVtk_IdType theShapeID,
const IVtk_PointId thePointId1,
const IVtk_PointId thePointId2,
const IVtk_MeshType theMeshType);
const IVtk_MeshType theMeshType) Standard_OVERRIDE;
//! Insert a poly-line.
//! @param [in] theShapeID id of the subshape to which the polyline belongs.
@ -88,7 +88,7 @@ public:
//! @param [in] theMeshType mesh type of the subshape (MT_Undefined by default)
Standard_EXPORT virtual void InsertLine (const IVtk_IdType theShapeID,
const IVtk_PointIdList* thePointIds,
const IVtk_MeshType theMeshType);
const IVtk_MeshType theMeshType) Standard_OVERRIDE;
//! Insert a triangle
//! @param [in] theShapeID id of the subshape to which the triangle belongs.
//! @param [in] thePointId1 id of the first point
@ -99,7 +99,7 @@ public:
const IVtk_PointId thePointId1,
const IVtk_PointId thePointId2,
const IVtk_PointId thePointId3,
const IVtk_MeshType theMeshType);
const IVtk_MeshType theMeshType) Standard_OVERRIDE;
public: //! @name Specific methods

View File

@ -41,33 +41,33 @@ public:
Standard_EXPORT virtual ~IVtkVTK_View();
//! @return true if this is a perspective view, and false otherwise.
Standard_EXPORT virtual bool IsPerspective() const;
Standard_EXPORT virtual bool IsPerspective() const Standard_OVERRIDE;
//! @return The focal distance of the view
Standard_EXPORT virtual double GetDistance() const;
Standard_EXPORT virtual double GetDistance() const Standard_OVERRIDE;
//! @return The world coordinates of the view position
Standard_EXPORT virtual void GetPosition (double& theX, double& theY, double& theZ) const;
Standard_EXPORT virtual void GetPosition (double& theX, double& theY, double& theZ) const Standard_OVERRIDE;
//! @return The "view up" direction of the view
Standard_EXPORT virtual void GetViewUp (double& theDx, double& theDy, double& theDz) const;
Standard_EXPORT virtual void GetViewUp (double& theDx, double& theDy, double& theDz) const Standard_OVERRIDE;
//! @return The projection direction vector of this view
Standard_EXPORT virtual void GetDirectionOfProjection (double& theDx,
double& theDy,
double& theDz) const;
double& theDz) const Standard_OVERRIDE;
//! @return Three doubles containing scale components of the view transformation
Standard_EXPORT virtual void GetScale (double& theX, double& theY, double& theZ) const;
Standard_EXPORT virtual void GetScale (double& theX, double& theY, double& theZ) const Standard_OVERRIDE;
//! @return The current view's zoom factor (for parallel projection)
Standard_EXPORT virtual double GetParallelScale() const;
Standard_EXPORT virtual double GetParallelScale() const Standard_OVERRIDE;
//! @return The current view angle (for perspective projection)
Standard_EXPORT virtual double GetViewAngle() const;
Standard_EXPORT virtual double GetViewAngle() const Standard_OVERRIDE;
//! @return Two doubles containing the display coordinates of the view window center
Standard_EXPORT virtual void GetViewCenter (double& theX, double& theY) const;
Standard_EXPORT virtual void GetViewCenter (double& theX, double& theY) const Standard_OVERRIDE;
//! Gets window size in screen coordinates in pixels
Standard_EXPORT virtual void GetWindowSize (int& theX, int& theY) const Standard_OVERRIDE;
@ -87,7 +87,7 @@ public:
//! @param [in] theDisplayPnt 2d point of display coordinates
//! @param [out] theWorldPnt 3d point of world coordinates
//! @return true if conversion was successful, false otherwise
Standard_EXPORT virtual bool DisplayToWorld (const gp_XY& theDisplayPnt, gp_XYZ& theWorldPnt) const;
Standard_EXPORT virtual bool DisplayToWorld (const gp_XY& theDisplayPnt, gp_XYZ& theWorldPnt) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(IVtkVTK_View,IVtk_IView)

View File

@ -857,21 +857,21 @@ Standard_Boolean IntTools_Context::IsVertexOnLine
else
{
// Local search may fail. Try to use more precise algo.
Extrema_ExtPC anExt(aPv, aGAC, 1.e-10);
Extrema_ExtPC anExt2(aPv, aGAC, 1.e-10);
Standard_Real aMinDist = RealLast();
Standard_Integer aMinIdx = -1;
for (Standard_Integer anIdx = 1; anIdx <= anExt.NbExt(); anIdx++)
for (Standard_Integer anIdx = 1; anIdx <= anExt2.NbExt(); anIdx++)
{
if ( anExt.IsMin(anIdx) &&
anExt.SquareDistance(anIdx) < aMinDist )
if ( anExt2.IsMin(anIdx) &&
anExt2.SquareDistance(anIdx) < aMinDist )
{
aMinDist = anExt.SquareDistance(anIdx);
aMinDist = anExt2.SquareDistance(anIdx);
aMinIdx = anIdx;
}
}
if (aMinIdx != -1)
{
const Extrema_POnCurv& aPOncurve = anExt.Point(aMinIdx);
const Extrema_POnCurv& aPOncurve = anExt2.Point(aMinIdx);
aT = aPOncurve.Parameter();
if((aT > (aLast + aFirst) * 0.5) ||
@ -909,21 +909,21 @@ Standard_Boolean IntTools_Context::IsVertexOnLine
else
{
// Local search may fail. Try to use more precise algo.
Extrema_ExtPC anExt(aPv, aGAC, 1.e-10);
Extrema_ExtPC anExt2(aPv, aGAC, 1.e-10);
Standard_Real aMinDist = RealLast();
Standard_Integer aMinIdx = -1;
for (Standard_Integer anIdx = 1; anIdx <= anExt.NbExt(); anIdx++)
for (Standard_Integer anIdx = 1; anIdx <= anExt2.NbExt(); anIdx++)
{
if ( anExt.IsMin(anIdx) &&
anExt.SquareDistance(anIdx) < aMinDist )
if ( anExt2.IsMin(anIdx) &&
anExt2.SquareDistance(anIdx) < aMinDist )
{
aMinDist = anExt.SquareDistance(anIdx);
aMinDist = anExt2.SquareDistance(anIdx);
aMinIdx = anIdx;
}
}
if (aMinIdx != -1)
{
const Extrema_POnCurv& aPOncurve = anExt.Point(aMinIdx);
const Extrema_POnCurv& aPOncurve = anExt2.Point(aMinIdx);
aT = aPOncurve.Parameter();
if((aT < (aLast + aFirst) * 0.5) ||

View File

@ -59,8 +59,6 @@ LDOM_CharacterData& LDOM_CharacterData::operator =
void LDOM_CharacterData::setData (const LDOMString& theValue)
{
LDOM_BasicText& aText = (LDOM_BasicText&) Origin ();
if (&aText == NULL)
Standard_ProgramError::Raise("LDOM_CharacterData::setData: called on void");
aText.SetData (theValue, myDocument);
myLength = -1;
}

View File

@ -995,21 +995,22 @@ void OpenGl_ShaderManager::PushMaterialState (const Handle(OpenGl_ShaderProgram)
return;
}
if (typeid (*aState.Aspect()) == typeid (OpenGl_AspectFace))
const OpenGl_Element* anAspect = aState.Aspect();
if (typeid (*anAspect) == typeid (OpenGl_AspectFace))
{
PushAspectFace (myContext, theProgram, dynamic_cast<const OpenGl_AspectFace*> (aState.Aspect()));
PushAspectFace (myContext, theProgram, dynamic_cast<const OpenGl_AspectFace*> (anAspect));
}
else if (typeid (*aState.Aspect()) == typeid (OpenGl_AspectLine))
else if (typeid (*anAspect) == typeid (OpenGl_AspectLine))
{
PushAspectLine (myContext, theProgram, dynamic_cast<const OpenGl_AspectLine*> (aState.Aspect()));
PushAspectLine (myContext, theProgram, dynamic_cast<const OpenGl_AspectLine*> (anAspect));
}
else if (typeid (*aState.Aspect()) == typeid (OpenGl_AspectText))
else if (typeid (*anAspect) == typeid (OpenGl_AspectText))
{
PushAspectText (myContext, theProgram, dynamic_cast<const OpenGl_AspectText*> (aState.Aspect()));
PushAspectText (myContext, theProgram, dynamic_cast<const OpenGl_AspectText*> (anAspect));
}
else if (typeid (*aState.Aspect()) == typeid (OpenGl_AspectMarker))
else if (typeid (*anAspect) == typeid (OpenGl_AspectMarker))
{
PushAspectMarker (myContext, theProgram, dynamic_cast<const OpenGl_AspectMarker*> (aState.Aspect()));
PushAspectMarker (myContext, theProgram, dynamic_cast<const OpenGl_AspectMarker*> (anAspect));
}
theProgram->UpdateState (OpenGl_MATERIALS_STATE, aState.Index());

View File

@ -3006,10 +3006,10 @@ static void WriteGeomTolerance (const Handle(XSControl_WorkSession) &WS,
if (anObject->GetMaxValueModifier() != 0) {
isWithMaxTol = Standard_True;
aMaxLMWU = new StepBasic_LengthMeasureWithUnit();
Handle(StepBasic_MeasureValueMember) aValueMember = new StepBasic_MeasureValueMember();
aValueMember->SetName("LENGTH_MEASURE");
aValueMember->SetReal(anObject->GetMaxValueModifier());
aMaxLMWU->Init(aValueMember, aUnit);
Handle(StepBasic_MeasureValueMember) aModifierValueMember = new StepBasic_MeasureValueMember();
aModifierValueMember->SetName("LENGTH_MEASURE");
aModifierValueMember->SetReal(anObject->GetMaxValueModifier());
aMaxLMWU->Init(aModifierValueMember, aUnit);
Model->AddWithRefs(aMaxLMWU);
}
}

View File

@ -45,7 +45,7 @@ public:
virtual Standard_Boolean SetName(const Standard_CString /*theName*/) Standard_OVERRIDE
{ return Standard_True; }
inline Standard_Integer Kind() const
Standard_Integer Kind() const Standard_OVERRIDE
{return 4;}
Standard_EXPORT virtual Standard_CString EnumText() const Standard_OVERRIDE;

View File

@ -173,7 +173,7 @@ Standard_Integer StepFile_Read
new StepData_StepReaderData(nbhead,nbrec,nbpar); // creation tableau de records
for ( Standard_Integer nr = 1; nr <= nbrec; nr ++) {
int nbarg; char* ident; char* typrec ;
int nbarg; char* ident; char* typrec = 0;
lir_file_rec (&ident, &typrec, &nbarg);
undirec->SetRecord (nr, ident, typrec, nbarg);

View File

@ -104,13 +104,14 @@ public:
// ========================================
//! Returns the ID of the attribute.
Standard_EXPORT const Standard_GUID& ID() const;
Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
//! Undos (and redos) the attribute.
Standard_EXPORT virtual void Restore (const Handle(TDF_Attribute)& with);
Standard_EXPORT virtual void Restore (const Handle(TDF_Attribute)& with) Standard_OVERRIDE;
//! Pastes the attribute to another label.
Standard_EXPORT virtual void Paste (const Handle(TDF_Attribute)& into, const Handle(TDF_RelocationTable)& RT) const;
Standard_EXPORT virtual void Paste (const Handle(TDF_Attribute)& into,
const Handle(TDF_RelocationTable)& RT) const Standard_OVERRIDE;
//! Returns a new empty instance of the attribute.
Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;