]> granicus.if.org Git - postgresql/commitdiff
Clean up warnings from -Wimplicit-fallthrough.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 1 May 2018 23:35:08 +0000 (19:35 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 1 May 2018 23:35:08 +0000 (19:35 -0400)
Recent gcc can warn about switch-case fall throughs that are not
explicitly labeled as intentional.  This seems like a good thing,
so clean up the warnings exposed thereby by labeling all such
cases with comments that gcc will recognize.

In files that already had one or more suitable comments, I generally
matched the existing style of those.  Otherwise I went with
/* FALLTHROUGH */, which is one of the spellings approved at the
more-restrictive-than-default level -Wimplicit-fallthrough=4.
(At the default level you can also spell it /* FALL ?THRU */,
and it's not picky about case.  What you can't do is include
additional text in the same comment, so some existing comments
containing versions of this aren't good enough.)

Testing with gcc 8.0.1 (Fedora 28's current version), I found that
I also had to put explicit "break"s after elog(ERROR) or ereport(ERROR);
apparently, for this purpose gcc doesn't recognize that those don't
return.  That seems like possibly a gcc bug, but it's fine because
in most places we did that anyway; so this amounts to a visit from the
style police.

Discussion: https://postgr.es/m/15083.1525207729@sss.pgh.pa.us

28 files changed:
contrib/btree_gin/btree_gin.c
contrib/pageinspect/hashfuncs.c
src/backend/access/hash/hashfunc.c
src/backend/catalog/objectaddress.c
src/backend/commands/explain.c
src/backend/commands/indexcmds.c
src/backend/commands/trigger.c
src/backend/executor/execMain.c
src/backend/executor/execReplication.c
src/backend/executor/nodeLockRows.c
src/backend/executor/nodeModifyTable.c
src/backend/parser/gram.y
src/backend/parser/parse_utilcmd.c
src/backend/regex/regc_lex.c
src/backend/regex/regcomp.c
src/backend/tcop/postgres.c
src/backend/utils/adt/acl.c
src/backend/utils/adt/datetime.c
src/backend/utils/adt/numeric.c
src/backend/utils/adt/ruleutils.c
src/backend/utils/adt/timestamp.c
src/backend/utils/misc/guc.c
src/backend/utils/sort/tuplestore.c
src/bin/pgbench/pgbench.c
src/interfaces/ecpg/pgtypeslib/interval.c
src/interfaces/ecpg/preproc/ecpg.c
src/pl/plpgsql/src/pl_exec.c
src/pl/tcl/pltcl.c

index d262c18e893a6f1482c16c377719587a54b7dd2d..b6d22d2b008d5a1c74a92da472e13bf2d7505573 100644 (file)
@@ -88,6 +88,7 @@ gin_btree_extract_query(FunctionCallInfo fcinfo,
                case BTGreaterEqualStrategyNumber:
                case BTGreaterStrategyNumber:
                        *ptr_partialmatch = true;
+                       /* FALLTHROUGH */
                case BTEqualStrategyNumber:
                        entries[0] = datum;
                        break;
index b48fdfa153be03791f1715bfb29894c9720a14ae..c49adf207cb3c396cd07b73a54d6a127b9264e5f 100644 (file)
@@ -97,18 +97,22 @@ verify_hash_page(bytea *raw_page, int flags)
                                ereport(ERROR,
                                                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                                                 errmsg("page is not a hash meta page")));
+                               break;
                        case LH_BUCKET_PAGE | LH_OVERFLOW_PAGE:
                                ereport(ERROR,
                                                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                                                 errmsg("page is not a hash bucket or overflow page")));
+                               break;
                        case LH_OVERFLOW_PAGE:
                                ereport(ERROR,
                                                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                                                 errmsg("page is not a hash overflow page")));
+                               break;
                        default:
                                elog(ERROR,
                                         "hash page of type %08x not in mask %08x",
                                         pagetype, flags);
+                               break;
                }
        }
 
index 1aa0b25d38a119a313b1bae2d4a7183b4906b172..a0060a633db59c01dd940dce4e87a45a387e4bce 100644 (file)
@@ -466,9 +466,9 @@ hash_any(register const unsigned char *k, register int keylen)
                                /* fall through */
                        case 9:
                                c += ((uint32) k[8] << 24);
-                               /* the lowest byte of c is reserved for the length */
                                /* fall through */
                        case 8:
+                               /* the lowest byte of c is reserved for the length */
                                b += ka[1];
                                a += ka[0];
                                break;
@@ -505,9 +505,9 @@ hash_any(register const unsigned char *k, register int keylen)
                                /* fall through */
                        case 9:
                                c += ((uint32) k[8] << 8);
-                               /* the lowest byte of c is reserved for the length */
                                /* fall through */
                        case 8:
+                               /* the lowest byte of c is reserved for the length */
                                b += ka[1];
                                a += ka[0];
                                break;
@@ -558,57 +558,77 @@ hash_any(register const unsigned char *k, register int keylen)
 
                /* handle the last 11 bytes */
 #ifdef WORDS_BIGENDIAN
-               switch (len)                    /* all the case statements fall through */
+               switch (len)
                {
                        case 11:
                                c += ((uint32) k[10] << 8);
+                               /* fall through */
                        case 10:
                                c += ((uint32) k[9] << 16);
+                               /* fall through */
                        case 9:
                                c += ((uint32) k[8] << 24);
-                               /* the lowest byte of c is reserved for the length */
+                               /* fall through */
                        case 8:
+                               /* the lowest byte of c is reserved for the length */
                                b += k[7];
+                               /* fall through */
                        case 7:
                                b += ((uint32) k[6] << 8);
+                               /* fall through */
                        case 6:
                                b += ((uint32) k[5] << 16);
+                               /* fall through */
                        case 5:
                                b += ((uint32) k[4] << 24);
+                               /* fall through */
                        case 4:
                                a += k[3];
+                               /* fall through */
                        case 3:
                                a += ((uint32) k[2] << 8);
+                               /* fall through */
                        case 2:
                                a += ((uint32) k[1] << 16);
+                               /* fall through */
                        case 1:
                                a += ((uint32) k[0] << 24);
                                /* case 0: nothing left to add */
                }
 #else                                                  /* !WORDS_BIGENDIAN */
-               switch (len)                    /* all the case statements fall through */
+               switch (len)
                {
                        case 11:
                                c += ((uint32) k[10] << 24);
+                               /* fall through */
                        case 10:
                                c += ((uint32) k[9] << 16);
+                               /* fall through */
                        case 9:
                                c += ((uint32) k[8] << 8);
-                               /* the lowest byte of c is reserved for the length */
+                               /* fall through */
                        case 8:
+                               /* the lowest byte of c is reserved for the length */
                                b += ((uint32) k[7] << 24);
+                               /* fall through */
                        case 7:
                                b += ((uint32) k[6] << 16);
+                               /* fall through */
                        case 6:
                                b += ((uint32) k[5] << 8);
+                               /* fall through */
                        case 5:
                                b += k[4];
+                               /* fall through */
                        case 4:
                                a += ((uint32) k[3] << 24);
+                               /* fall through */
                        case 3:
                                a += ((uint32) k[2] << 16);
+                               /* fall through */
                        case 2:
                                a += ((uint32) k[1] << 8);
+                               /* fall through */
                        case 1:
                                a += k[0];
                                /* case 0: nothing left to add */
@@ -686,9 +706,9 @@ hash_any_extended(register const unsigned char *k, register int keylen,
                                /* fall through */
                        case 9:
                                c += ((uint32) k[8] << 24);
-                               /* the lowest byte of c is reserved for the length */
                                /* fall through */
                        case 8:
+                               /* the lowest byte of c is reserved for the length */
                                b += ka[1];
                                a += ka[0];
                                break;
@@ -725,9 +745,9 @@ hash_any_extended(register const unsigned char *k, register int keylen,
                                /* fall through */
                        case 9:
                                c += ((uint32) k[8] << 8);
-                               /* the lowest byte of c is reserved for the length */
                                /* fall through */
                        case 8:
+                               /* the lowest byte of c is reserved for the length */
                                b += ka[1];
                                a += ka[0];
                                break;
@@ -778,57 +798,77 @@ hash_any_extended(register const unsigned char *k, register int keylen,
 
                /* handle the last 11 bytes */
 #ifdef WORDS_BIGENDIAN
-               switch (len)                    /* all the case statements fall through */
+               switch (len)
                {
                        case 11:
                                c += ((uint32) k[10] << 8);
+                               /* fall through */
                        case 10:
                                c += ((uint32) k[9] << 16);
+                               /* fall through */
                        case 9:
                                c += ((uint32) k[8] << 24);
-                               /* the lowest byte of c is reserved for the length */
+                               /* fall through */
                        case 8:
+                               /* the lowest byte of c is reserved for the length */
                                b += k[7];
+                               /* fall through */
                        case 7:
                                b += ((uint32) k[6] << 8);
+                               /* fall through */
                        case 6:
                                b += ((uint32) k[5] << 16);
+                               /* fall through */
                        case 5:
                                b += ((uint32) k[4] << 24);
+                               /* fall through */
                        case 4:
                                a += k[3];
+                               /* fall through */
                        case 3:
                                a += ((uint32) k[2] << 8);
+                               /* fall through */
                        case 2:
                                a += ((uint32) k[1] << 16);
+                               /* fall through */
                        case 1:
                                a += ((uint32) k[0] << 24);
                                /* case 0: nothing left to add */
                }
 #else                                                  /* !WORDS_BIGENDIAN */
-               switch (len)                    /* all the case statements fall through */
+               switch (len)
                {
                        case 11:
                                c += ((uint32) k[10] << 24);
+                               /* fall through */
                        case 10:
                                c += ((uint32) k[9] << 16);
+                               /* fall through */
                        case 9:
                                c += ((uint32) k[8] << 8);
-                               /* the lowest byte of c is reserved for the length */
+                               /* fall through */
                        case 8:
+                               /* the lowest byte of c is reserved for the length */
                                b += ((uint32) k[7] << 24);
+                               /* fall through */
                        case 7:
                                b += ((uint32) k[6] << 16);
+                               /* fall through */
                        case 6:
                                b += ((uint32) k[5] << 8);
+                               /* fall through */
                        case 5:
                                b += k[4];
+                               /* fall through */
                        case 4:
                                a += ((uint32) k[3] << 24);
+                               /* fall through */
                        case 3:
                                a += ((uint32) k[2] << 16);
+                               /* fall through */
                        case 2:
                                a += ((uint32) k[1] << 8);
+                               /* fall through */
                        case 1:
                                a += k[0];
                                /* case 0: nothing left to add */
index ef3ea64bd0fb83092c8f5562fa49f1107f70e9b0..d371c47842e2cb88821dba0ff6bea1fadaa4cc2c 100644 (file)
@@ -2092,6 +2092,7 @@ pg_get_object_address(PG_FUNCTION_ARGS)
                                                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                                                 errmsg("name list length must be at least %d", 3)));
                        /* fall through to check args length */
+                       /* FALLTHROUGH */
                case OBJECT_OPERATOR:
                        if (list_length(args) != 2)
                                ereport(ERROR,
index e1a62a1bce918177ed08b180cbac42143701497b..73d94b72356d7c628ebd25b0cc8fd8edccba2d49 100644 (file)
@@ -1479,7 +1479,8 @@ ExplainNode(PlanState *planstate, List *ancestors,
                case T_SampleScan:
                        show_tablesample(((SampleScan *) plan)->tablesample,
                                                         planstate, ancestors, es);
-                       /* FALL THRU to print additional fields the same as SeqScan */
+                       /* fall through to print additional fields the same as SeqScan */
+                       /* FALLTHROUGH */
                case T_SeqScan:
                case T_ValuesScan:
                case T_CteScan:
index c4aa4c0974d7a6317dfec2f6d745b6bc1ace9621..3a3223bffb53d3dd6d1ec0e5a615db2fbd8b2498 100644 (file)
@@ -440,6 +440,7 @@ DefineIndex(Oid relationId,
                                        (errcode(ERRCODE_WRONG_OBJECT_TYPE),
                                         errmsg("cannot create index on foreign table \"%s\"",
                                                        RelationGetRelationName(rel))));
+                       break;
                default:
                        ereport(ERROR,
                                        (errcode(ERRCODE_WRONG_OBJECT_TYPE),
index 88a95896b6f51a258b2eb7c7322f3e01feb3deae..57519fe8d64751a4ea18d0e43f098272f5a8159d 100644 (file)
@@ -3338,6 +3338,7 @@ ltrmark:;
 
                        case HeapTupleInvisible:
                                elog(ERROR, "attempted to lock invisible tuple");
+                               break;
 
                        default:
                                ReleaseBuffer(buffer);
index 51d5bd01d388a38c6dbf41214df56064ca4b3b23..3d12f9c76fdfc2d5180f9f734b16811f17c9c1df 100644 (file)
@@ -2741,6 +2741,7 @@ EvalPlanQualFetch(EState *estate, Relation relation, int lockmode,
 
                                case HeapTupleInvisible:
                                        elog(ERROR, "attempted to lock invisible tuple");
+                                       break;
 
                                default:
                                        ReleaseBuffer(buffer);
index 0333ccd0fed8f60d90d8afab6ddb1b39167e633a..4fbdfc0a099838ba85c48a9d7775570d5149f6f4 100644 (file)
@@ -202,6 +202,7 @@ retry:
                                goto retry;
                        case HeapTupleInvisible:
                                elog(ERROR, "attempted to lock invisible tuple");
+                               break;
                        default:
                                elog(ERROR, "unexpected heap_lock_tuple status: %u", res);
                                break;
@@ -365,6 +366,7 @@ retry:
                                goto retry;
                        case HeapTupleInvisible:
                                elog(ERROR, "attempted to lock invisible tuple");
+                               break;
                        default:
                                elog(ERROR, "unexpected heap_lock_tuple status: %u", res);
                                break;
index ace126cbf24a829c08c4d0918e7a9c9ab1597811..30de8a95ab8e2d63858932d75123e06bedcdeba5 100644 (file)
@@ -256,6 +256,7 @@ lnext:
 
                        case HeapTupleInvisible:
                                elog(ERROR, "attempted to lock invisible tuple");
+                               break;
 
                        default:
                                elog(ERROR, "unrecognized heap_lock_tuple status: %u",
index 71314e73bcf3c618c4780eb8b0e5459bf5f5ea21..c4c841cdd794d1054201a343ced4ce05b2cfe227 100644 (file)
@@ -1390,6 +1390,7 @@ ExecOnConflictUpdate(ModifyTableState *mtstate,
 
                        /* This shouldn't happen */
                        elog(ERROR, "attempted to lock invisible tuple");
+                       break;
 
                case HeapTupleSelfUpdated:
 
@@ -1399,6 +1400,7 @@ ExecOnConflictUpdate(ModifyTableState *mtstate,
                         * seen this row to conflict with.
                         */
                        elog(ERROR, "unexpected self-updated tuple");
+                       break;
 
                case HeapTupleUpdated:
                        if (IsolationUsesXactSnapshot())
index 5a363674464fac07a2dbd84c48089e62353fd0f0..babb62dae11800191682f42471d47fd075482dd6 100644 (file)
@@ -14855,18 +14855,21 @@ RoleId:               RoleSpec
                                                                         errmsg("role name \"%s\" is reserved",
                                                                                        "public"),
                                                                         parser_errposition(@1)));
+                                                       break;
                                                case ROLESPEC_SESSION_USER:
                                                        ereport(ERROR,
                                                                        (errcode(ERRCODE_RESERVED_NAME),
                                                                         errmsg("%s cannot be used as a role name here",
                                                                                        "SESSION_USER"),
                                                                         parser_errposition(@1)));
+                                                       break;
                                                case ROLESPEC_CURRENT_USER:
                                                        ereport(ERROR,
                                                                        (errcode(ERRCODE_RESERVED_NAME),
                                                                         errmsg("%s cannot be used as a role name here",
                                                                                        "CURRENT_USER"),
                                                                         parser_errposition(@1)));
+                                                       break;
                                        }
                                }
                        ;
index da5ede866cc7371f8c20a61253332019340941c6..17b54b20cccc1434af13d79192cf8f37b9e56722 100644 (file)
@@ -3829,12 +3829,14 @@ validateInfiniteBounds(ParseState *pstate, List *blist)
                                                (errcode(ERRCODE_DATATYPE_MISMATCH),
                                                 errmsg("every bound following MAXVALUE must also be MAXVALUE"),
                                                 parser_errposition(pstate, exprLocation((Node *) prd))));
+                               break;
 
                        case PARTITION_RANGE_DATUM_MINVALUE:
                                ereport(ERROR,
                                                (errcode(ERRCODE_DATATYPE_MISMATCH),
                                                 errmsg("every bound following MINVALUE must also be MINVALUE"),
                                                 parser_errposition(pstate, exprLocation((Node *) prd))));
+                               break;
                }
        }
 }
index 2c6551ca746625b8b574defb471d3664feb39cb1..38617b79fd146df87158e2f033fdc21b16ec7a10 100644 (file)
@@ -875,6 +875,7 @@ lexescape(struct vars *v)
                        /* oops, doesn't look like it's a backref after all... */
                        v->now = save;
                        /* and fall through into octal number */
+                       /* FALLTHROUGH */
                case CHR('0'):
                        NOTE(REG_UUNPORT);
                        v->now--;                       /* put first digit back */
index 51385509bbaeae5c22a239ddde73c7c8b842f981..eb1f3d57a8630c6ce3f57c9eac97257be742dedb 100644 (file)
@@ -909,7 +909,8 @@ parseqatom(struct vars *v,
                        }
                        /* legal in EREs due to specification botch */
                        NOTE(REG_UPBOTCH);
-                       /* fallthrough into case PLAIN */
+                       /* fall through into case PLAIN */
+                       /* FALLTHROUGH */
                case PLAIN:
                        onechr(v, v->nextvalue, lp, rp);
                        okcolors(v->nfa, v->cm);
index 5095a4f6867dff9a6bc52df301c288374896d9a2..3828cae921dc29d8a281a4dd44556936c517635f 100644 (file)
@@ -2762,7 +2762,8 @@ RecoveryConflictInterrupt(ProcSignalReason reason)
                                if (!IsWaitingForLock())
                                        return;
 
-                               /* Intentional drop through to check wait for pin */
+                               /* Intentional fall through to check wait for pin */
+                               /* FALLTHROUGH */
 
                        case PROCSIG_RECOVERY_CONFLICT_BUFFERPIN:
 
@@ -2775,7 +2776,8 @@ RecoveryConflictInterrupt(ProcSignalReason reason)
 
                                MyProc->recoveryConflictPending = true;
 
-                               /* Intentional drop through to error handling */
+                               /* Intentional fall through to error handling */
+                               /* FALLTHROUGH */
 
                        case PROCSIG_RECOVERY_CONFLICT_LOCK:
                        case PROCSIG_RECOVERY_CONFLICT_TABLESPACE:
@@ -2819,7 +2821,8 @@ RecoveryConflictInterrupt(ProcSignalReason reason)
                                        break;
                                }
 
-                               /* Intentional drop through to session cancel */
+                               /* Intentional fall through to session cancel */
+                               /* FALLTHROUGH */
 
                        case PROCSIG_RECOVERY_CONFLICT_DATABASE:
                                RecoveryConflictPending = true;
index 0cfc297b65921112765bb5ecef58a1559d78c29c..a45e093de791040beeeea4876e5d78b879e9bc9e 100644 (file)
@@ -5216,6 +5216,7 @@ get_rolespec_tuple(const RoleSpec *role)
                                        (errcode(ERRCODE_UNDEFINED_OBJECT),
                                         errmsg("role \"%s\" does not exist", "public")));
                        tuple = NULL;           /* make compiler happy */
+                       break;
 
                default:
                        elog(ERROR, "unexpected role type %d", role->roletype);
index 3f0f65c2956542dae5ea9b3f8a175a1b9619ce20..633fb9bf541579c39db70b3b25de4c0ce06ca0fa 100644 (file)
@@ -3146,7 +3146,7 @@ DecodeInterval(char **field, int *ftype, int nf, int range,
                                 * handle signed float numbers and signed year-month values.
                                 */
 
-                               /* FALL THROUGH */
+                               /* FALLTHROUGH */
 
                        case DTK_DATE:
                        case DTK_NUMBER:
@@ -3577,6 +3577,7 @@ DecodeISO8601Interval(char *str,
                                                continue;
                                        }
                                        /* Else fall through to extended alternative format */
+                                       /* FALLTHROUGH */
                                case '-':               /* ISO 8601 4.4.3.3 Alternative Format,
                                                                 * Extended */
                                        if (havefield)
@@ -3655,6 +3656,7 @@ DecodeISO8601Interval(char *str,
                                                return 0;
                                        }
                                        /* Else fall through to extended alternative format */
+                                       /* FALLTHROUGH */
                                case ':':               /* ISO 8601 4.4.3.3 Alternative Format,
                                                                 * Extended */
                                        if (havefield)
index 6f400729713bfd942cc196b81d50bf25e4757315..c56d5afcb3bf921619c8456b6c8a6147840e52b9 100644 (file)
@@ -1522,6 +1522,7 @@ width_bucket_numeric(PG_FUNCTION_ARGS)
                        ereport(ERROR,
                                        (errcode(ERRCODE_INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION),
                                         errmsg("lower bound cannot equal upper bound")));
+                       break;
 
                        /* bound1 < bound2 */
                case -1:
index 74e1cd8afb17aaf8a3097983285485489261505b..065238b0fe0f35383bef4c59bb2f99593f0a9883 100644 (file)
@@ -7481,8 +7481,8 @@ 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:
index 103f91ae6243f7a67d0946e6c5ae9f58dc3c93c6..265b1db7f60299f126a16a6886c186f4becbd47d 100644 (file)
@@ -3830,12 +3830,14 @@ timestamp_trunc(PG_FUNCTION_ARGS)
                                        tm->tm_year = ((tm->tm_year + 999) / 1000) * 1000 - 999;
                                else
                                        tm->tm_year = -((999 - (tm->tm_year - 1)) / 1000) * 1000 + 1;
+                               /* FALL THRU */
                        case DTK_CENTURY:
                                /* see comments in timestamptz_trunc */
                                if (tm->tm_year > 0)
                                        tm->tm_year = ((tm->tm_year + 99) / 100) * 100 - 99;
                                else
                                        tm->tm_year = -((99 - (tm->tm_year - 1)) / 100) * 100 + 1;
+                               /* FALL THRU */
                        case DTK_DECADE:
                                /* see comments in timestamptz_trunc */
                                if (val != DTK_MILLENNIUM && val != DTK_CENTURY)
@@ -3845,18 +3847,25 @@ timestamp_trunc(PG_FUNCTION_ARGS)
                                        else
                                                tm->tm_year = -((8 - (tm->tm_year - 1)) / 10) * 10;
                                }
+                               /* FALL THRU */
                        case DTK_YEAR:
                                tm->tm_mon = 1;
+                               /* FALL THRU */
                        case DTK_QUARTER:
                                tm->tm_mon = (3 * ((tm->tm_mon - 1) / 3)) + 1;
+                               /* FALL THRU */
                        case DTK_MONTH:
                                tm->tm_mday = 1;
+                               /* FALL THRU */
                        case DTK_DAY:
                                tm->tm_hour = 0;
+                               /* FALL THRU */
                        case DTK_HOUR:
                                tm->tm_min = 0;
+                               /* FALL THRU */
                        case DTK_MINUTE:
                                tm->tm_sec = 0;
+                               /* FALL THRU */
                        case DTK_SECOND:
                                fsec = 0;
                                break;
@@ -4072,28 +4081,36 @@ interval_trunc(PG_FUNCTION_ARGS)
                {
                        switch (val)
                        {
-                                       /* fall through */
                                case DTK_MILLENNIUM:
                                        /* caution: C division may have negative remainder */
                                        tm->tm_year = (tm->tm_year / 1000) * 1000;
+                                       /* FALL THRU */
                                case DTK_CENTURY:
                                        /* caution: C division may have negative remainder */
                                        tm->tm_year = (tm->tm_year / 100) * 100;
+                                       /* FALL THRU */
                                case DTK_DECADE:
                                        /* caution: C division may have negative remainder */
                                        tm->tm_year = (tm->tm_year / 10) * 10;
+                                       /* FALL THRU */
                                case DTK_YEAR:
                                        tm->tm_mon = 0;
+                                       /* FALL THRU */
                                case DTK_QUARTER:
                                        tm->tm_mon = 3 * (tm->tm_mon / 3);
+                                       /* FALL THRU */
                                case DTK_MONTH:
                                        tm->tm_mday = 0;
+                                       /* FALL THRU */
                                case DTK_DAY:
                                        tm->tm_hour = 0;
+                                       /* FALL THRU */
                                case DTK_HOUR:
                                        tm->tm_min = 0;
+                                       /* FALL THRU */
                                case DTK_MINUTE:
                                        tm->tm_sec = 0;
+                                       /* FALL THRU */
                                case DTK_SECOND:
                                        fsec = 0;
                                        break;
index 6eae3d62ccfd397bc4c0795d25379c7a8ab25839..e1c51c54812e337563ba43c534869a0be557bc8d 100644 (file)
@@ -5391,6 +5391,7 @@ AtEOXact_GUC(bool isCommit, int nestLevel)
                                {
                                        case GUC_SAVE:
                                                Assert(false);  /* can't get here */
+                                               break;
 
                                        case GUC_SET:
                                                /* next level always becomes SET */
@@ -6257,7 +6258,8 @@ set_config_option(const char *name, const char *value,
                                                                name)));
                                return 0;
                        }
-                       /* FALL THRU to process the same as PGC_BACKEND */
+                       /* fall through to process the same as PGC_BACKEND */
+                       /* FALLTHROUGH */
                case PGC_BACKEND:
                        if (context == PGC_SIGHUP)
                        {
index d602753ca96403959a6426e7c231ffbd3847274c..5560a3e1f6c3f9545652a23602212a91f3620ca2 100644 (file)
@@ -972,7 +972,7 @@ tuplestore_gettuple(Tuplestorestate *state, bool forward,
                                                        (errcode_for_file_access(),
                                                         errmsg("could not seek in tuplestore temporary file: %m")));
                        state->status = TSS_READFILE;
-                       /* FALL THRU into READFILE case */
+                       /* FALLTHROUGH */
 
                case TSS_READFILE:
                        *should_free = true;
index 78b8f1706ca016de0916d373d082fd5eb3f19e23..21a52c2020f3f97ea542639f8ab7a490f874974a 100644 (file)
@@ -1978,6 +1978,8 @@ evalStandardFunc(TState *thread, CState *st,
                                                        Assert(0);
                                        }
                                }
+
+                               break;                  /* NOTREACHED */
                        }
 
                        /* integer bitwise operators */
index 0510f5289c8bf5224ada9673dc4f15ef6383879e..4fdbcd01cc705d8d61b827c7fd2198bd0258c00b 100644 (file)
@@ -184,6 +184,7 @@ DecodeISO8601Interval(char *str,
                                                continue;
                                        }
                                        /* Else fall through to extended alternative format */
+                                       /* FALLTHROUGH */
                                case '-':               /* ISO 8601 4.4.3.3 Alternative Format,
                                                                 * Extended */
                                        if (havefield)
@@ -262,6 +263,7 @@ DecodeISO8601Interval(char *str,
                                                return 0;
                                        }
                                        /* Else fall through to extended alternative format */
+                                       /* FALLTHROUGH */
                                case ':':               /* ISO 8601 4.4.3.3 Alternative Format,
                                                                 * Extended */
                                        if (havefield)
index 7fdc4ee596b34e66dee2d9309656cb57817f359c..9a94e395455fd67281c24943cf80be1ec506ddda 100644 (file)
@@ -189,8 +189,8 @@ main(int argc, char *const argv[])
                                break;
                        case 'h':
                                header_mode = true;
-                               /* this must include "-c" to make sense */
-                               /* so do not place a "break;" here */
+                               /* this must include "-c" to make sense, so fall through */
+                               /* FALLTHROUGH */
                        case 'c':
                                auto_create_c = true;
                                break;
index 047fce372e265d1f3399652584260bfdfebc5753..228d1c0d00cada49f0aedfc63822546d72878b8c 100644 (file)
@@ -3968,14 +3968,17 @@ exec_prepare_plan(PLpgSQL_execstate *estate,
                                ereport(ERROR,
                                                (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                                                 errmsg("cannot COPY to/from client in PL/pgSQL")));
+                               break;
                        case SPI_ERROR_TRANSACTION:
                                ereport(ERROR,
                                                (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                                                 errmsg("cannot begin/end transactions in PL/pgSQL"),
                                                 errhint("Use a BEGIN block with an EXCEPTION clause instead.")));
+                               break;
                        default:
                                elog(ERROR, "SPI_prepare_params failed for \"%s\": %s",
                                         expr->query, SPI_result_code_string(SPI_result));
+                               break;
                }
        }
        if (keepplan)
@@ -4115,15 +4118,19 @@ exec_stmt_execsql(PLpgSQL_execstate *estate,
                        ereport(ERROR,
                                        (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                                         errmsg("cannot COPY to/from client in PL/pgSQL")));
+                       break;
+
                case SPI_ERROR_TRANSACTION:
                        ereport(ERROR,
                                        (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                                         errmsg("cannot begin/end transactions in PL/pgSQL"),
                                         errhint("Use a BEGIN block with an EXCEPTION clause instead.")));
+                       break;
 
                default:
                        elog(ERROR, "SPI_execute_plan_with_paramlist failed executing query \"%s\": %s",
                                 expr->query, SPI_result_code_string(rc));
+                       break;
        }
 
        /* All variants should save result info for GET DIAGNOSTICS */
@@ -4299,11 +4306,14 @@ exec_stmt_dynexecute(PLpgSQL_execstate *estate,
                        ereport(ERROR,
                                        (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                                         errmsg("cannot COPY to/from client in PL/pgSQL")));
+                       break;
+
                case SPI_ERROR_TRANSACTION:
                        ereport(ERROR,
                                        (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                                         errmsg("cannot begin/end transactions in PL/pgSQL"),
                                         errhint("Use a BEGIN block with an EXCEPTION clause instead.")));
+                       break;
 
                default:
                        elog(ERROR, "SPI_execute failed executing query \"%s\": %s",
index 07fdc75127182e0014a5f2cbf3fd22864fec5a39..12f7b13780957089e0e8e9a8fc25ca67c8ba25a1 100644 (file)
@@ -2451,7 +2451,8 @@ pltcl_process_SPI_result(Tcl_Interp *interp,
                                Tcl_SetObjResult(interp, Tcl_NewIntObj(0));
                                break;
                        }
-                       /* FALL THRU for utility returning tuples */
+                       /* fall through for utility returning tuples */
+                       /* FALLTHROUGH */
 
                case SPI_OK_SELECT:
                case SPI_OK_INSERT_RETURNING: