From: Tom Lane Date: Tue, 1 May 2018 23:35:08 +0000 (-0400) Subject: Clean up warnings from -Wimplicit-fallthrough. X-Git-Tag: REL_11_BETA1~124 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=41c912cad;p=postgresql Clean up warnings from -Wimplicit-fallthrough. 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 --- diff --git a/contrib/btree_gin/btree_gin.c b/contrib/btree_gin/btree_gin.c index d262c18e89..b6d22d2b00 100644 --- a/contrib/btree_gin/btree_gin.c +++ b/contrib/btree_gin/btree_gin.c @@ -88,6 +88,7 @@ gin_btree_extract_query(FunctionCallInfo fcinfo, case BTGreaterEqualStrategyNumber: case BTGreaterStrategyNumber: *ptr_partialmatch = true; + /* FALLTHROUGH */ case BTEqualStrategyNumber: entries[0] = datum; break; diff --git a/contrib/pageinspect/hashfuncs.c b/contrib/pageinspect/hashfuncs.c index b48fdfa153..c49adf207c 100644 --- a/contrib/pageinspect/hashfuncs.c +++ b/contrib/pageinspect/hashfuncs.c @@ -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; } } diff --git a/src/backend/access/hash/hashfunc.c b/src/backend/access/hash/hashfunc.c index 1aa0b25d38..a0060a633d 100644 --- a/src/backend/access/hash/hashfunc.c +++ b/src/backend/access/hash/hashfunc.c @@ -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 */ diff --git a/src/backend/catalog/objectaddress.c b/src/backend/catalog/objectaddress.c index ef3ea64bd0..d371c47842 100644 --- a/src/backend/catalog/objectaddress.c +++ b/src/backend/catalog/objectaddress.c @@ -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, diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index e1a62a1bce..73d94b7235 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -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: diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c index c4aa4c0974..3a3223bffb 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -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), diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index 88a95896b6..57519fe8d6 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -3338,6 +3338,7 @@ ltrmark:; case HeapTupleInvisible: elog(ERROR, "attempted to lock invisible tuple"); + break; default: ReleaseBuffer(buffer); diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index 51d5bd01d3..3d12f9c76f 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -2741,6 +2741,7 @@ EvalPlanQualFetch(EState *estate, Relation relation, int lockmode, case HeapTupleInvisible: elog(ERROR, "attempted to lock invisible tuple"); + break; default: ReleaseBuffer(buffer); diff --git a/src/backend/executor/execReplication.c b/src/backend/executor/execReplication.c index 0333ccd0fe..4fbdfc0a09 100644 --- a/src/backend/executor/execReplication.c +++ b/src/backend/executor/execReplication.c @@ -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; diff --git a/src/backend/executor/nodeLockRows.c b/src/backend/executor/nodeLockRows.c index ace126cbf2..30de8a95ab 100644 --- a/src/backend/executor/nodeLockRows.c +++ b/src/backend/executor/nodeLockRows.c @@ -256,6 +256,7 @@ lnext: case HeapTupleInvisible: elog(ERROR, "attempted to lock invisible tuple"); + break; default: elog(ERROR, "unrecognized heap_lock_tuple status: %u", diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index 71314e73bc..c4c841cdd7 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -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()) diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index 5a36367446..babb62dae1 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -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; } } ; diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c index da5ede866c..17b54b20cc 100644 --- a/src/backend/parser/parse_utilcmd.c +++ b/src/backend/parser/parse_utilcmd.c @@ -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; } } } diff --git a/src/backend/regex/regc_lex.c b/src/backend/regex/regc_lex.c index 2c6551ca74..38617b79fd 100644 --- a/src/backend/regex/regc_lex.c +++ b/src/backend/regex/regc_lex.c @@ -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 */ diff --git a/src/backend/regex/regcomp.c b/src/backend/regex/regcomp.c index 51385509bb..eb1f3d57a8 100644 --- a/src/backend/regex/regcomp.c +++ b/src/backend/regex/regcomp.c @@ -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); diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 5095a4f686..3828cae921 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -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; diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c index 0cfc297b65..a45e093de7 100644 --- a/src/backend/utils/adt/acl.c +++ b/src/backend/utils/adt/acl.c @@ -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); diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c index 3f0f65c295..633fb9bf54 100644 --- a/src/backend/utils/adt/datetime.c +++ b/src/backend/utils/adt/datetime.c @@ -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) diff --git a/src/backend/utils/adt/numeric.c b/src/backend/utils/adt/numeric.c index 6f40072971..c56d5afcb3 100644 --- a/src/backend/utils/adt/numeric.c +++ b/src/backend/utils/adt/numeric.c @@ -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: diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index 74e1cd8afb..065238b0fe 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -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: diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c index 103f91ae62..265b1db7f6 100644 --- a/src/backend/utils/adt/timestamp.c +++ b/src/backend/utils/adt/timestamp.c @@ -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; diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 6eae3d62cc..e1c51c5481 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -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) { diff --git a/src/backend/utils/sort/tuplestore.c b/src/backend/utils/sort/tuplestore.c index d602753ca9..5560a3e1f6 100644 --- a/src/backend/utils/sort/tuplestore.c +++ b/src/backend/utils/sort/tuplestore.c @@ -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; diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c index 78b8f1706c..21a52c2020 100644 --- a/src/bin/pgbench/pgbench.c +++ b/src/bin/pgbench/pgbench.c @@ -1978,6 +1978,8 @@ evalStandardFunc(TState *thread, CState *st, Assert(0); } } + + break; /* NOTREACHED */ } /* integer bitwise operators */ diff --git a/src/interfaces/ecpg/pgtypeslib/interval.c b/src/interfaces/ecpg/pgtypeslib/interval.c index 0510f5289c..4fdbcd01cc 100644 --- a/src/interfaces/ecpg/pgtypeslib/interval.c +++ b/src/interfaces/ecpg/pgtypeslib/interval.c @@ -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) diff --git a/src/interfaces/ecpg/preproc/ecpg.c b/src/interfaces/ecpg/preproc/ecpg.c index 7fdc4ee596..9a94e39545 100644 --- a/src/interfaces/ecpg/preproc/ecpg.c +++ b/src/interfaces/ecpg/preproc/ecpg.c @@ -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; diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c index 047fce372e..228d1c0d00 100644 --- a/src/pl/plpgsql/src/pl_exec.c +++ b/src/pl/plpgsql/src/pl_exec.c @@ -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", diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c index 07fdc75127..12f7b13780 100644 --- a/src/pl/tcl/pltcl.c +++ b/src/pl/tcl/pltcl.c @@ -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: