mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-05 13:08:58 +00:00
- GCC: fixed broken `fallthrough` (checked with 7.3 and 8.2) - Clang: added `fallthrough` support - Clang: added `-Wimplicit-fallthrough` checking
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
347dba8501
commit
7d3930a2fd
@@ -306,7 +306,7 @@ class GeneralGenerator : public BaseGenerator {
|
||||
case BASE_TYPE_UNION:
|
||||
// Unions in C# use a generic Table-derived type for better type safety
|
||||
if (lang_.language == IDLOptions::kCSharp) return "TTable";
|
||||
// fall through
|
||||
FLATBUFFERS_FALLTHROUGH(); // else fall thru
|
||||
default: return "Table";
|
||||
}
|
||||
}
|
||||
@@ -327,7 +327,7 @@ class GeneralGenerator : public BaseGenerator {
|
||||
case BASE_TYPE_UINT: return Type(BASE_TYPE_LONG);
|
||||
case BASE_TYPE_VECTOR:
|
||||
if (vectorelem) return DestinationType(type.VectorType(), vectorelem);
|
||||
// else fall thru
|
||||
FLATBUFFERS_FALLTHROUGH(); // else fall thru
|
||||
default: return type;
|
||||
}
|
||||
}
|
||||
@@ -371,7 +371,7 @@ class GeneralGenerator : public BaseGenerator {
|
||||
case BASE_TYPE_UINT: return " & 0xFFFFFFFFL";
|
||||
case BASE_TYPE_VECTOR:
|
||||
if (vectorelem) return DestinationMask(type.VectorType(), vectorelem);
|
||||
// else fall thru
|
||||
FLATBUFFERS_FALLTHROUGH(); // else fall thru
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,6 +130,7 @@ FullType GetFullType(const Type &type) {
|
||||
case ftUnionKey:
|
||||
case ftUnionValue: {
|
||||
FLATBUFFERS_ASSERT(false && "vectors of unions are unsupported");
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
FLATBUFFERS_ASSERT(false && "vector of vectors are unsupported");
|
||||
|
||||
@@ -411,10 +411,8 @@ CheckedError Parser::Next() {
|
||||
}
|
||||
cursor_ += 2;
|
||||
break;
|
||||
} else {
|
||||
// fall thru
|
||||
}
|
||||
FLATBUFFERS_ATTRIBUTE(fallthrough);
|
||||
FLATBUFFERS_FALLTHROUGH(); // else fall thru
|
||||
default:
|
||||
const auto has_sign = (c == '+') || (c == '-');
|
||||
// '-'/'+' and following identifier - can be a predefined constant like:
|
||||
|
||||
@@ -431,7 +431,7 @@ Offset<const Table *> CopyTable(FlatBufferBuilder &fbb,
|
||||
break;
|
||||
}
|
||||
}
|
||||
// FALL-THRU
|
||||
FLATBUFFERS_FALLTHROUGH(); // fall thru
|
||||
default: { // Scalars and structs.
|
||||
auto element_size = GetTypeSize(element_base_type);
|
||||
if (elemobjectdef && elemobjectdef->is_struct())
|
||||
@@ -466,7 +466,7 @@ Offset<const Table *> CopyTable(FlatBufferBuilder &fbb,
|
||||
break;
|
||||
}
|
||||
}
|
||||
// ELSE FALL-THRU
|
||||
FLATBUFFERS_FALLTHROUGH(); // fall thru
|
||||
case reflection::Union:
|
||||
case reflection::String:
|
||||
case reflection::Vector:
|
||||
|
||||
Reference in New Issue
Block a user