From 953df34d221f37767fb52ef27d47b7c48be9ef76 Mon Sep 17 00:00:00 2001 From: Hadi Moshayedi Date: Wed, 19 Jul 2017 11:41:59 -0400 Subject: [PATCH] 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. --- src/backend/distributed/relay/relay_event_utility.c | 1 + src/backend/distributed/utils/ruleutils_96.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/backend/distributed/relay/relay_event_utility.c b/src/backend/distributed/relay/relay_event_utility.c index 3c50b206b..de2a75da6 100644 --- a/src/backend/distributed/relay/relay_event_utility.c +++ b/src/backend/distributed/relay/relay_event_utility.c @@ -166,6 +166,7 @@ RelayEventExtendNames(Node *parseTree, char *schemaName, uint64 shardId) */ } + /* fallthrough */ case T_CreateStmt: { CreateStmt *createStmt = (CreateStmt *) parseTree; diff --git a/src/backend/distributed/utils/ruleutils_96.c b/src/backend/distributed/utils/ruleutils_96.c index 3e4a38ddf..dbd976341 100644 --- a/src/backend/distributed/utils/ruleutils_96.c +++ b/src/backend/distributed/utils/ruleutils_96.c @@ -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: