Explicit switch/case fall-throughs to avoid compiler warnings.

GCC 7 added `-Wimplicit-fallthrough` to warn for not explicitly specified switch/case fall-throughs.

According to https://gcc.gnu.org/gcc-7/changes.html, to suppress that warning we could either use `__attribute__(fallthrough)`, which didn't seem to work for earlier GCC versions, or a `/* fallthrough */` comment just before the following `case`.

Previously Citus code had the fall-through comments inside the brackets, which didn't seem to suppress the warning. Putting a `/* fallthrough */` comment outside the brackets and right before the `case` fixes the problem.
pull/1497/head^2
Hadi Moshayedi 2017-07-19 11:41:59 -04:00 committed by GitHub
parent b873e6fcc8
commit 953df34d22
2 changed files with 2 additions and 1 deletions

View File

@ -166,6 +166,7 @@ RelayEventExtendNames(Node *parseTree, char *schemaName, uint64 shardId)
*/
}
/* fallthrough */
case T_CreateStmt:
{
CreateStmt *createStmt = (CreateStmt *) parseTree;

View File

@ -4448,9 +4448,9 @@ isSimpleNode(Node *node, Node *parentNode, int prettyFlags)
return false;
}
/* else do the same stuff as for T_SubLink et al. */
/* FALL THROUGH */
}
/* fallthrough */
case T_SubLink:
case T_NullTest:
case T_BooleanTest: