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

@@ -92,6 +92,7 @@ LDOMBasicString::LDOMBasicString (const LDOMBasicString& anOther)
memcpy (myVal.ptr, anOther.myVal.ptr, aLen);
break;
}
Standard_FALLTHROUGH
case LDOM_AsciiDoc:
case LDOM_AsciiDocClear:
case LDOM_AsciiHashed:
@@ -148,6 +149,7 @@ LDOMBasicString& LDOMBasicString::operator = (const LDOMBasicString& anOther)
memcpy (myVal.ptr, anOther.myVal.ptr, aLen);
break;
}
Standard_FALLTHROUGH
case LDOM_AsciiDoc:
case LDOM_AsciiDocClear:
case LDOM_AsciiHashed:

View File

@@ -180,6 +180,7 @@ Standard_Boolean LDOMParser::ParseDocument (istream& theIStream, const Standard_
break;
}
isDoctype = Standard_True;
continue;
case LDOM_XmlReader::XML_COMMENT:
continue;
case LDOM_XmlReader::XML_FULL_ELEMENT:
@@ -198,6 +199,9 @@ Standard_Boolean LDOMParser::ParseDocument (istream& theIStream, const Standard_
}
continue;
}
isError = Standard_True;
myError = "Expected comment or end-of-file";
break;
case LDOM_XmlReader::XML_START_ELEMENT:
if (isElement == Standard_False) {
isElement = Standard_True;
@@ -224,11 +228,13 @@ Standard_Boolean LDOMParser::ParseDocument (istream& theIStream, const Standard_
}
isError = Standard_True;
myError = "Expected comment or end-of-file";
break;
case LDOM_XmlReader::XML_END_ELEMENT:
if (endElement()) {
isError = Standard_True;
myError = "User abort at endElement()";
}
break;
case LDOM_XmlReader::XML_EOF:
break;
case LDOM_XmlReader::XML_UNKNOWN:

View File

@@ -47,6 +47,7 @@ LDOMString::LDOMString (const LDOMBasicString& anOther,
break;
case LDOM_AsciiFree:
myType = LDOM_AsciiDoc;
Standard_FALLTHROUGH
case LDOM_AsciiDocClear:
case LDOM_AsciiDoc:
{

View File

@@ -215,6 +215,7 @@ LDOM_XmlReader::RecordType LDOM_XmlReader::ReadRecord (Standard_IStream& theIStr
return XML_UNKNOWN;
case '\0':
if (myEOF == Standard_True) continue;
Standard_FALLTHROUGH
default:
// Limitation: we do not treat '&' as special character
aPtr = (const char *) memchr (myPtr, '<', myEndPtr - myPtr);
@@ -431,6 +432,7 @@ attr_name:
switch (myPtr[0]) {
case '=' :
aState = STATE_ATTRIBUTE_VALUE;
Standard_FALLTHROUGH
case ' ' :
case '\t':
case '\n':
@@ -559,6 +561,7 @@ static Standard_Boolean isName (const char * aString,
aNameEnd = aPtr;
return Standard_False;
}
Standard_FALLTHROUGH
case '.' :
case '-' :
case '_' :