1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0029151: GCC 7.1 warnings "this statement may fall through" [-Wimplicit-fallthrough=]

New macro Standard_FALLTHROUGH is defined for use in a switch statement immediately before a case label, if code associated with the previous case label may fall through to that
next label (i.e. does not end with "break" or "return" etc.).
This macro indicates that the fall through is intentional and should not be diagnosed by a compiler that warns on fallthrough.

The macro is inserted in places that currently generate such warning message and where fallthrough is intentional.

Doxygen comments are provided for this and other macros in Standard_Macro.hxx.
This commit is contained in:
abv
2017-09-28 10:26:47 +03:00
parent e2b4dea253
commit b1811c1d2b
34 changed files with 573 additions and 359 deletions

View File

@@ -423,62 +423,76 @@ static TopoDS_Shape ShapeWithType(const TopoDS_Shape theShape,
switch (aType) {
case TopAbs_VERTEX: // can't do something from vertex
break;
case TopAbs_EDGE: {// make wire from edges
if (theType <= TopAbs_SOLID) break;
BRepBuilderAPI_MakeWire aMakeWire;
aMakeWire.Add(aShapes);
if (!aMakeWire.IsDone()) return theShape;
if (theType == TopAbs_WIRE) return aMakeWire.Wire();
aShapes.Clear(); // don't break: we can do something more of it
aShapes.Append(aMakeWire.Wire());
aListIter.Initialize(aShapes);
}
case TopAbs_WIRE: {// make faceS from wires (one per one)
if (theType < TopAbs_SOLID) break;
TopTools_ListOfShape aFaces;
for(;aListIter.More();aListIter.Next()) {
BRepBuilderAPI_MakeFace aMakeFace(TopoDS::Wire(aListIter.Value()));
if (!aMakeFace.IsDone()) aFaces.Append(aMakeFace.Face());
case TopAbs_EDGE:
{
// make wire from edges
if (theType <= TopAbs_SOLID) break;
BRepBuilderAPI_MakeWire aMakeWire;
aMakeWire.Add(aShapes);
if (!aMakeWire.IsDone()) return theShape;
if (theType == TopAbs_WIRE) return aMakeWire.Wire();
aShapes.Clear(); // don't break: we can do something more of it
aShapes.Append(aMakeWire.Wire());
aListIter.Initialize(aShapes);
}
if (theType == TopAbs_FACE) {
if (aFaces.Extent() == 1) return aFaces.First();
return theShape;
Standard_FALLTHROUGH
case TopAbs_WIRE:
{
// make faceS from wires (one per one)
if (theType < TopAbs_SOLID) break;
TopTools_ListOfShape aFaces;
for(;aListIter.More();aListIter.Next()) {
BRepBuilderAPI_MakeFace aMakeFace(TopoDS::Wire(aListIter.Value()));
if (!aMakeFace.IsDone()) aFaces.Append(aMakeFace.Face());
}
if (theType == TopAbs_FACE) {
if (aFaces.Extent() == 1) return aFaces.First();
return theShape;
}
aShapes.Assign(aFaces); // don't break: we can do something more of it
aListIter.Initialize(aShapes);
}
aShapes.Assign(aFaces); // don't break: we can do something more of it
aListIter.Initialize(aShapes);
}
case TopAbs_FACE: {// make shell from faces
if (theType < TopAbs_SOLID) break;
BRep_Builder aShellBuilder;
TopoDS_Shell aShell;
aShellBuilder.MakeShell(aShell);
for(;aListIter.More();aListIter.Next()) aShellBuilder.Add(aShell,TopoDS::Face(aListIter.Value()));
aShell.Closed (BRep_Tool::IsClosed (aShell));
if (theType == TopAbs_SHELL) return aShell;
aShapes.Clear(); // don't break: we can do something more of it
aShapes.Append(aShell);
aListIter.Initialize(aShapes);
}
case TopAbs_SHELL: {// make solids from shells (one per one)
TopTools_ListOfShape aSolids;
for(;aListIter.More();aListIter.Next()) {
BRepBuilderAPI_MakeSolid aMakeSolid(TopoDS::Shell(aListIter.Value()));
if (aMakeSolid.IsDone()) aSolids.Append(aMakeSolid.Solid());
Standard_FALLTHROUGH
case TopAbs_FACE:
{
// make shell from faces
if (theType < TopAbs_SOLID) break;
BRep_Builder aShellBuilder;
TopoDS_Shell aShell;
aShellBuilder.MakeShell(aShell);
for(;aListIter.More();aListIter.Next()) aShellBuilder.Add(aShell,TopoDS::Face(aListIter.Value()));
aShell.Closed (BRep_Tool::IsClosed (aShell));
if (theType == TopAbs_SHELL) return aShell;
aShapes.Clear(); // don't break: we can do something more of it
aShapes.Append(aShell);
aListIter.Initialize(aShapes);
}
if (theType == TopAbs_SOLID) {
if (aSolids.Extent() == 1) return aSolids.First();
return theShape;
Standard_FALLTHROUGH
case TopAbs_SHELL:
{
// make solids from shells (one per one)
TopTools_ListOfShape aSolids;
for(;aListIter.More();aListIter.Next()) {
BRepBuilderAPI_MakeSolid aMakeSolid(TopoDS::Shell(aListIter.Value()));
if (aMakeSolid.IsDone()) aSolids.Append(aMakeSolid.Solid());
}
if (theType == TopAbs_SOLID) {
if (aSolids.Extent() == 1) return aSolids.First();
return theShape;
}
aShapes.Assign(aSolids); // don't break: we can do something more of it
aListIter.Initialize(aShapes);
}
Standard_FALLTHROUGH
case TopAbs_SOLID:
{
// make compsolid from solids
BRep_Builder aCompBuilder;
TopoDS_CompSolid aCompSolid;
aCompBuilder.MakeCompSolid(aCompSolid);
for(;aListIter.More();aListIter.Next()) aCompBuilder.Add(aCompSolid,TopoDS::Solid(aListIter.Value()));
if (theType == TopAbs_COMPSOLID) return aCompSolid;
}
aShapes.Assign(aSolids); // don't break: we can do something more of it
aListIter.Initialize(aShapes);
}
case TopAbs_SOLID: {// make compsolid from solids
BRep_Builder aCompBuilder;
TopoDS_CompSolid aCompSolid;
aCompBuilder.MakeCompSolid(aCompSolid);
for(;aListIter.More();aListIter.Next()) aCompBuilder.Add(aCompSolid,TopoDS::Solid(aListIter.Value()));
if (theType == TopAbs_COMPSOLID) return aCompSolid;
}
}
}
return theShape;