Commit bbb72f0b authored by Heiko Becker's avatar Heiko Becker Committed by Wouter van Oortmerssen

Tweak fallthrough comments to get recognized by gcc7 (#4298)

GCC gained a new warning, -Wimplicit-fallthrough, which warns about
implicitly falling through a case statement. The regular expressions
used at the default level (-Wimplicit-fallthrough=3) don't match with
a colon at the end. The comment also needs to be followed (after
optional whitespace and other comments) by a 'case' or 'default'
keyword, i.e. it will not be recognized with a '}' between the comment
and the keyword.
parent 8f8a27d6
...@@ -301,7 +301,7 @@ Type DestinationType(const Type &type, bool vectorelem) { ...@@ -301,7 +301,7 @@ Type DestinationType(const Type &type, bool vectorelem) {
case BASE_TYPE_VECTOR: case BASE_TYPE_VECTOR:
if (vectorelem) if (vectorelem)
return DestinationType(type.VectorType(), vectorelem); return DestinationType(type.VectorType(), vectorelem);
// else fall thru: // else fall thru
default: return type; default: return type;
} }
} }
...@@ -348,7 +348,7 @@ std::string DestinationMask(const Type &type, bool vectorelem) { ...@@ -348,7 +348,7 @@ std::string DestinationMask(const Type &type, bool vectorelem) {
case BASE_TYPE_VECTOR: case BASE_TYPE_VECTOR:
if (vectorelem) if (vectorelem)
return DestinationMask(type.VectorType(), vectorelem); return DestinationMask(type.VectorType(), vectorelem);
// else fall thru: // else fall thru
default: return ""; default: return "";
} }
} }
......
...@@ -420,8 +420,8 @@ Offset<const Table *> CopyTable(FlatBufferBuilder &fbb, ...@@ -420,8 +420,8 @@ Offset<const Table *> CopyTable(FlatBufferBuilder &fbb,
offset = fbb.CreateVector(elements).o; offset = fbb.CreateVector(elements).o;
break; break;
} }
// FALL-THRU:
} }
// FALL-THRU
default: { // Scalars and structs. default: { // Scalars and structs.
auto element_size = GetTypeSize(element_base_type); auto element_size = GetTypeSize(element_base_type);
if (elemobjectdef && elemobjectdef->is_struct()) if (elemobjectdef && elemobjectdef->is_struct())
...@@ -458,8 +458,8 @@ Offset<const Table *> CopyTable(FlatBufferBuilder &fbb, ...@@ -458,8 +458,8 @@ Offset<const Table *> CopyTable(FlatBufferBuilder &fbb,
subobjectdef.bytesize()); subobjectdef.bytesize());
break; break;
} }
// else: FALL-THRU:
} }
// ELSE FALL-THRU
case reflection::Union: case reflection::Union:
case reflection::String: case reflection::String:
case reflection::Vector: case reflection::Vector:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment