From bbb72f0b737e84553e19352d940f7e367f111c8e Mon Sep 17 00:00:00 2001 From: Heiko Becker Date: Mon, 8 May 2017 22:35:55 +0200 Subject: [PATCH] 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. --- src/idl_gen_general.cpp | 4 ++-- src/reflection.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/idl_gen_general.cpp b/src/idl_gen_general.cpp index 1e9f3b6a1..5e5b1e229 100644 --- a/src/idl_gen_general.cpp +++ b/src/idl_gen_general.cpp @@ -301,7 +301,7 @@ Type DestinationType(const Type &type, bool vectorelem) { case BASE_TYPE_VECTOR: if (vectorelem) return DestinationType(type.VectorType(), vectorelem); - // else fall thru: + // else fall thru default: return type; } } @@ -348,7 +348,7 @@ std::string DestinationMask(const Type &type, bool vectorelem) { case BASE_TYPE_VECTOR: if (vectorelem) return DestinationMask(type.VectorType(), vectorelem); - // else fall thru: + // else fall thru default: return ""; } } diff --git a/src/reflection.cpp b/src/reflection.cpp index cb30c7ff7..3c66b8bff 100644 --- a/src/reflection.cpp +++ b/src/reflection.cpp @@ -420,8 +420,8 @@ Offset CopyTable(FlatBufferBuilder &fbb, offset = fbb.CreateVector(elements).o; break; } - // FALL-THRU: } + // FALL-THRU default: { // Scalars and structs. auto element_size = GetTypeSize(element_base_type); if (elemobjectdef && elemobjectdef->is_struct()) @@ -458,8 +458,8 @@ Offset CopyTable(FlatBufferBuilder &fbb, subobjectdef.bytesize()); break; } - // else: FALL-THRU: } + // ELSE FALL-THRU case reflection::Union: case reflection::String: case reflection::Vector: