]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Use fallthrough attribute instead of comment
authorPeter Eisentraut <peter@eisentraut.org>
Thu, 19 Feb 2026 07:41:03 +0000 (08:41 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Thu, 19 Feb 2026 07:51:12 +0000 (08:51 +0100)
Instead of using comments to mark fallthrough switch cases, use the
fallthrough attribute.  This will (in the future, not here) allow
supporting other compilers besides gcc.  The commenting convention is
only supported by gcc, the attribute is supported by clang, and in the
fullness of time the C23 standard attribute would allow supporting
other compilers as well.

Right now, we package the attribute into a macro called
pg_fallthrough.  This commit defines that macro and replaces the
existing comments with that macro invocation.

We also raise the level of the gcc -Wimplicit-fallthrough= option from
3 to 5 to enforce the use of the attribute.

Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Discussion: https://www.postgresql.org/message-id/flat/76a8efcd-925a-4eaf-bdd1-d972cd1a32ff%40eisentraut.org

66 files changed:
configure
configure.ac
contrib/btree_gin/btree_gin.c
contrib/ltree/ltxtquery_io.c
contrib/pg_trgm/trgm_gin.c
contrib/pg_trgm/trgm_gist.c
contrib/pgcrypto/pgp-info.c
meson.build
src/backend/access/heap/heapam_handler.c
src/backend/access/nbtree/nbtpreprocesskeys.c
src/backend/bootstrap/bootstrap.c
src/backend/catalog/dependency.c
src/backend/catalog/objectaddress.c
src/backend/catalog/pg_shdepend.c
src/backend/commands/explain.c
src/backend/commands/tablecmds.c
src/backend/commands/trigger.c
src/backend/executor/nodeAgg.c
src/backend/executor/nodeHash.c
src/backend/executor/nodeHashjoin.c
src/backend/executor/nodeLimit.c
src/backend/executor/nodeTidrangescan.c
src/backend/libpq/auth.c
src/backend/optimizer/plan/planner.c
src/backend/optimizer/util/clauses.c
src/backend/parser/parse_jsontable.c
src/backend/parser/parse_utilcmd.c
src/backend/partitioning/partprune.c
src/backend/postmaster/postmaster.c
src/backend/regex/regc_lex.c
src/backend/regex/regcomp.c
src/backend/replication/logical/reorderbuffer.c
src/backend/replication/logical/worker.c
src/backend/replication/walreceiver.c
src/backend/replication/walreceiverfuncs.c
src/backend/storage/aio/aio.c
src/backend/tcop/postgres.c
src/backend/tcop/utility.c
src/backend/utils/adt/datetime.c
src/backend/utils/adt/formatting.c
src/backend/utils/adt/jsonb.c
src/backend/utils/adt/jsonb_util.c
src/backend/utils/adt/jsonpath.c
src/backend/utils/adt/numeric.c
src/backend/utils/adt/ruleutils.c
src/backend/utils/adt/timestamp.c
src/backend/utils/adt/xml.c
src/backend/utils/cache/catcache.c
src/backend/utils/mb/mbutils.c
src/backend/utils/misc/guc.c
src/backend/utils/misc/guc_funcs.c
src/backend/utils/sort/tuplestore.c
src/bin/pgbench/pgbench.c
src/common/hashfn.c
src/common/wchar.c
src/include/c.h
src/include/common/hashfn_unstable.h
src/interfaces/ecpg/pgtypeslib/interval.c
src/interfaces/libpq/fe-secure.c
src/pl/plpgsql/src/pl_exec.c
src/pl/tcl/pltcl.c
src/port/snprintf.c
src/test/modules/test_json_parser/test_json_parser_incremental.c
src/timezone/zic.c
src/tools/pg_bsd_indent/indent.c
src/tools/pg_bsd_indent/parse.c

index a10a2c85c6ab43c2e6b1ff3500666388784e04fc..a6eab396299de5ca94f98d59d1e32c45fc979588 100755 (executable)
--- a/configure
+++ b/configure
@@ -5616,15 +5616,15 @@ fi
 
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wimplicit-fallthrough=3, for CFLAGS" >&5
-$as_echo_n "checking whether ${CC} supports -Wimplicit-fallthrough=3, for CFLAGS... " >&6; }
-if ${pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_3+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wimplicit-fallthrough=5, for CFLAGS" >&5
+$as_echo_n "checking whether ${CC} supports -Wimplicit-fallthrough=5, for CFLAGS... " >&6; }
+if ${pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_5+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   pgac_save_CFLAGS=$CFLAGS
 pgac_save_CC=$CC
 CC=${CC}
-CFLAGS="${CFLAGS} -Wimplicit-fallthrough=3"
+CFLAGS="${CFLAGS} -Wimplicit-fallthrough=5"
 ac_save_c_werror_flag=$ac_c_werror_flag
 ac_c_werror_flag=yes
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -5639,31 +5639,31 @@ main ()
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_3=yes
+  pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_5=yes
 else
-  pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_3=no
+  pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_5=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_c_werror_flag=$ac_save_c_werror_flag
 CFLAGS="$pgac_save_CFLAGS"
 CC="$pgac_save_CC"
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_3" >&5
-$as_echo "$pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_3" >&6; }
-if test x"$pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_3" = x"yes"; then
-  CFLAGS="${CFLAGS} -Wimplicit-fallthrough=3"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_5" >&5
+$as_echo "$pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_5" >&6; }
+if test x"$pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_5" = x"yes"; then
+  CFLAGS="${CFLAGS} -Wimplicit-fallthrough=5"
 fi
 
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CXX} supports -Wimplicit-fallthrough=3, for CXXFLAGS" >&5
-$as_echo_n "checking whether ${CXX} supports -Wimplicit-fallthrough=3, for CXXFLAGS... " >&6; }
-if ${pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_3+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CXX} supports -Wimplicit-fallthrough=5, for CXXFLAGS" >&5
+$as_echo_n "checking whether ${CXX} supports -Wimplicit-fallthrough=5, for CXXFLAGS... " >&6; }
+if ${pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_5+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   pgac_save_CXXFLAGS=$CXXFLAGS
 pgac_save_CXX=$CXX
 CXX=${CXX}
-CXXFLAGS="${CXXFLAGS} -Wimplicit-fallthrough=3"
+CXXFLAGS="${CXXFLAGS} -Wimplicit-fallthrough=5"
 ac_save_cxx_werror_flag=$ac_cxx_werror_flag
 ac_cxx_werror_flag=yes
 ac_ext=cpp
@@ -5684,9 +5684,9 @@ main ()
 }
 _ACEOF
 if ac_fn_cxx_try_compile "$LINENO"; then :
-  pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_3=yes
+  pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_5=yes
 else
-  pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_3=no
+  pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_5=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_ext=c
@@ -5699,10 +5699,10 @@ ac_cxx_werror_flag=$ac_save_cxx_werror_flag
 CXXFLAGS="$pgac_save_CXXFLAGS"
 CXX="$pgac_save_CXX"
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_3" >&5
-$as_echo "$pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_3" >&6; }
-if test x"$pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_3" = x"yes"; then
-  CXXFLAGS="${CXXFLAGS} -Wimplicit-fallthrough=3"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_5" >&5
+$as_echo "$pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_5" >&6; }
+if test x"$pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_5" = x"yes"; then
+  CXXFLAGS="${CXXFLAGS} -Wimplicit-fallthrough=5"
 fi
 
 
index 814e64a967efa934d6bb9d72db7f7a5acf40c494..455ba31f1d1d5e267a3b42412e0232b9527cf5c3 100644 (file)
@@ -556,8 +556,8 @@ if test "$GCC" = yes -a "$ICC" = no; then
   PGAC_PROG_CXX_CFLAGS_OPT([-Wendif-labels])
   PGAC_PROG_CC_CFLAGS_OPT([-Wmissing-format-attribute])
   PGAC_PROG_CXX_CFLAGS_OPT([-Wmissing-format-attribute])
-  PGAC_PROG_CC_CFLAGS_OPT([-Wimplicit-fallthrough=3])
-  PGAC_PROG_CXX_CFLAGS_OPT([-Wimplicit-fallthrough=3])
+  PGAC_PROG_CC_CFLAGS_OPT([-Wimplicit-fallthrough=5])
+  PGAC_PROG_CXX_CFLAGS_OPT([-Wimplicit-fallthrough=5])
   PGAC_PROG_CC_CFLAGS_OPT([-Wcast-function-type])
   PGAC_PROG_CXX_CFLAGS_OPT([-Wcast-function-type])
   PGAC_PROG_CC_CFLAGS_OPT([-Wshadow=compatible-local])
index afb8b3820af263872effd959453db7d93cea0d03..8dfbaa4781d963547aa7c1cdda2d70f6461437ac 100644 (file)
@@ -120,7 +120,7 @@ gin_btree_extract_query(FunctionCallInfo fcinfo,
                case BTGreaterEqualStrategyNumber:
                case BTGreaterStrategyNumber:
                        *ptr_partialmatch = true;
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                case BTEqualStrategyNumber:
                        /* If we have a conversion function, apply it */
                        if (cvt_fns && cvt_fns[rhs_code])
index d15f323539303f8c93d88f21e9b3848951d73d36..f4296880c035a484a46fd723245bfedb5edf2a96 100644 (file)
@@ -277,7 +277,7 @@ makepol(QPRS_STATE *state)
                        case ERR:
                                if (SOFT_ERROR_OCCURRED(state->escontext))
                                        return ERR;
-                               /* fall through */
+                               pg_fallthrough;
                        default:
                                ereturn(state->escontext, ERR,
                                                (errcode(ERRCODE_SYNTAX_ERROR),
index 014bb3c848cd19a734d7f74917e9fee927a3db6a..5766b3e99553ad641eba4929768cd9e3fb70b69b 100644 (file)
@@ -99,7 +99,7 @@ gin_extract_query_trgm(PG_FUNCTION_ARGS)
 #ifndef IGNORECASE
                        elog(ERROR, "cannot handle ~~* with case-sensitive trigrams");
 #endif
-                       /* FALL THRU */
+                       pg_fallthrough;
                case LikeStrategyNumber:
 
                        /*
@@ -113,7 +113,7 @@ gin_extract_query_trgm(PG_FUNCTION_ARGS)
 #ifndef IGNORECASE
                        elog(ERROR, "cannot handle ~* with case-sensitive trigrams");
 #endif
-                       /* FALL THRU */
+                       pg_fallthrough;
                case RegExpStrategyNumber:
                        trg = createTrgmNFA(val, PG_GET_COLLATION(),
                                                                &graph, CurrentMemoryContext);
@@ -224,7 +224,7 @@ gin_trgm_consistent(PG_FUNCTION_ARGS)
 #ifndef IGNORECASE
                        elog(ERROR, "cannot handle ~~* with case-sensitive trigrams");
 #endif
-                       /* FALL THRU */
+                       pg_fallthrough;
                case LikeStrategyNumber:
                case EqualStrategyNumber:
                        /* Check if all extracted trigrams are presented. */
@@ -242,7 +242,7 @@ gin_trgm_consistent(PG_FUNCTION_ARGS)
 #ifndef IGNORECASE
                        elog(ERROR, "cannot handle ~* with case-sensitive trigrams");
 #endif
-                       /* FALL THRU */
+                       pg_fallthrough;
                case RegExpStrategyNumber:
                        if (nkeys < 1)
                        {
@@ -310,7 +310,7 @@ gin_trgm_triconsistent(PG_FUNCTION_ARGS)
 #ifndef IGNORECASE
                        elog(ERROR, "cannot handle ~~* with case-sensitive trigrams");
 #endif
-                       /* FALL THRU */
+                       pg_fallthrough;
                case LikeStrategyNumber:
                case EqualStrategyNumber:
                        /* Check if all extracted trigrams are presented. */
@@ -328,7 +328,7 @@ gin_trgm_triconsistent(PG_FUNCTION_ARGS)
 #ifndef IGNORECASE
                        elog(ERROR, "cannot handle ~* with case-sensitive trigrams");
 #endif
-                       /* FALL THRU */
+                       pg_fallthrough;
                case RegExpStrategyNumber:
                        if (nkeys < 1)
                        {
index 685275a0f9bbad091dd37187821bbe8d5f96c93c..11812b2984e546f61615ea2b2ae58aab4b7b389b 100644 (file)
@@ -248,7 +248,7 @@ gtrgm_consistent(PG_FUNCTION_ARGS)
 #ifndef IGNORECASE
                                elog(ERROR, "cannot handle ~~* with case-sensitive trigrams");
 #endif
-                               /* FALL THRU */
+                               pg_fallthrough;
                        case LikeStrategyNumber:
                                qtrg = generate_wildcard_trgm(VARDATA(query),
                                                                                          querysize - VARHDRSZ);
@@ -257,7 +257,7 @@ gtrgm_consistent(PG_FUNCTION_ARGS)
 #ifndef IGNORECASE
                                elog(ERROR, "cannot handle ~* with case-sensitive trigrams");
 #endif
-                               /* FALL THRU */
+                               pg_fallthrough;
                        case RegExpStrategyNumber:
                                qtrg = createTrgmNFA(query, PG_GET_COLLATION(),
                                                                         &graph, fcinfo->flinfo->fn_mcxt);
@@ -345,7 +345,7 @@ gtrgm_consistent(PG_FUNCTION_ARGS)
 #ifndef IGNORECASE
                        elog(ERROR, "cannot handle ~~* with case-sensitive trigrams");
 #endif
-                       /* FALL THRU */
+                       pg_fallthrough;
                case LikeStrategyNumber:
                case EqualStrategyNumber:
                        /* Wildcard and equal search are inexact */
@@ -387,7 +387,7 @@ gtrgm_consistent(PG_FUNCTION_ARGS)
 #ifndef IGNORECASE
                        elog(ERROR, "cannot handle ~* with case-sensitive trigrams");
 #endif
-                       /* FALL THRU */
+                       pg_fallthrough;
                case RegExpStrategyNumber:
                        /* Regexp search is inexact */
                        *recheck = true;
index 83dc60486bd98628e9ee0add3623f0b19e60bf83..6c2be4713ab71d310a53eba67b57461809f8d48a 100644 (file)
@@ -169,7 +169,7 @@ pgp_get_keyid(MBuf *pgp_data, char *dst)
                                break;
                        case PGP_PKT_SYMENCRYPTED_SESSKEY:
                                got_symenc_key++;
-                               /* fall through */
+                               pg_fallthrough;
                        case PGP_PKT_SIGNATURE:
                        case PGP_PKT_MARKER:
                        case PGP_PKT_TRUST:
index f6d5842d85279156224c06ff0e02a5953201c19c..055e96315d0fd9b9d5aeefe948f0db64622c3f9a 100644 (file)
@@ -2154,7 +2154,7 @@ common_warning_flags = [
   '-Werror=unguarded-availability-new',
   '-Wendif-labels',
   '-Wmissing-format-attribute',
-  '-Wimplicit-fallthrough=3',
+  '-Wimplicit-fallthrough=5',
   '-Wcast-function-type',
   '-Wshadow=compatible-local',
   # This was included in -Wall/-Wformat in older GCC versions
index cbef73e5d4b1d33559855c9279dbd088f6ebb8c8..b83e2013d5080026fb7c77f7268619fdef5ae549 100644 (file)
@@ -861,7 +861,7 @@ heapam_relation_copy_for_cluster(Relation OldHeap, Relation NewHeap,
                                break;
                        case HEAPTUPLE_RECENTLY_DEAD:
                                *tups_recently_dead += 1;
-                               /* fall through */
+                               pg_fallthrough;
                        case HEAPTUPLE_LIVE:
                                /* Live or recently dead, must copy it */
                                isdead = false;
index b028b0c3e887f213a0ddd29a583877cbf5370d39..39c0a5d610f9f49b71c5d794f63f14233a939943 100644 (file)
@@ -1198,7 +1198,7 @@ _bt_saoparray_shrink(IndexScanDesc scan, ScanKey arraysk, ScanKey skey,
        {
                case BTLessStrategyNumber:
                        cmpexact = 1;           /* exclude exact match, if any */
-                       /* FALL THRU */
+                       pg_fallthrough;
                case BTLessEqualStrategyNumber:
                        if (cmpresult >= cmpexact)
                                matchelem++;
@@ -1220,7 +1220,7 @@ _bt_saoparray_shrink(IndexScanDesc scan, ScanKey arraysk, ScanKey skey,
                        break;
                case BTGreaterEqualStrategyNumber:
                        cmpexact = 1;           /* include exact match, if any */
-                       /* FALL THRU */
+                       pg_fallthrough;
                case BTGreaterStrategyNumber:
                        if (cmpresult >= cmpexact)
                                matchelem++;
index 8d601c363b490785b14c75157ddd8858b59eea55..e7699be55aaa39095d710554efb6d98af2612388 100644 (file)
@@ -234,7 +234,7 @@ BootstrapModeMain(int argc, char *argv[], bool check_only)
                                                        (errcode(ERRCODE_SYNTAX_ERROR),
                                                         errmsg("--%s must be first argument", optarg)));
 
-                               /* FALLTHROUGH */
+                               pg_fallthrough;
                        case 'c':
                                {
                                        char       *name,
index 7564965fa18d872f1a72da1e46aadec099edadb0..570c434ede8372015ea9b6bf00b063d061304dda 100644 (file)
@@ -641,7 +641,7 @@ findDependentObjects(const ObjectAddress *object,
                                        break;
 
                                /* Otherwise, treat this like an internal dependency */
-                               /* FALL THRU */
+                               pg_fallthrough;
 
                        case DEPENDENCY_INTERNAL:
 
index 13d73f8909cacd33338da9ccab4de46e8c2b9473..d32aaff2821141dfeeebeaa5757ea8eb21de0a8f 100644 (file)
@@ -2232,7 +2232,7 @@ pg_get_object_address(PG_FUNCTION_ARGS)
                                                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                                                 errmsg("name list length must be exactly %d", 1)));
                        /* fall through to check args length */
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                case OBJECT_DOMCONSTRAINT:
                case OBJECT_CAST:
                case OBJECT_PUBLICATION_REL:
@@ -2257,7 +2257,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 */
+                       pg_fallthrough;
                case OBJECT_OPERATOR:
                        if (list_length(args) != 2)
                                ereport(ERROR,
index 3db41ecd74f79ae3feddfa205cb7d576ff8ed3a3..c9998531b2f4c8734ea4c5ce2f0f94611acafa80 100644 (file)
@@ -1458,7 +1458,7 @@ shdepDropOwned(List *roleids, DropBehavior behavior)
                                                                                                sdepForm->objid);
                                                break;
                                        }
-                                       /* FALLTHROUGH */
+                                       pg_fallthrough;
 
                                case SHARED_DEPENDENCY_OWNER:
 
index b9587983f8800930cabe4ea561ee1a32a1e1fa94..93918a223b8d700f71eb934d741191977ec55925 100644 (file)
@@ -2012,7 +2012,7 @@ ExplainNode(PlanState *planstate, List *ancestors,
                        show_tablesample(((SampleScan *) plan)->tablesample,
                                                         planstate, ancestors, es);
                        /* fall through to print additional fields the same as SeqScan */
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                case T_SeqScan:
                case T_ValuesScan:
                case T_CteScan:
index f976c0e5c7ea0d35650bce9cc5a16fa81977258b..2f5b7007ff9ec981408c3ad23d75acccd9dff74a 100644 (file)
@@ -16192,7 +16192,7 @@ ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing, LOCKMODE lock
                case RELKIND_TOASTVALUE:
                        if (recursing)
                                break;
-                       /* FALL THRU */
+                       pg_fallthrough;
                default:
                        ereport(ERROR,
                                        (errcode(ERRCODE_WRONG_OBJECT_TYPE),
index 8df915f63fb997b3f2f9bba6b89b978b07600152..98d402c0a3be7cca16628fe66e61238a4ec5d09f 100644 (file)
@@ -4392,7 +4392,7 @@ AfterTriggerExecute(EState *estate,
                                                                                         trig_tuple_slot2))
                                        elog(ERROR, "failed to fetch tuple2 for AFTER trigger");
                        }
-                       /* fall through */
+                       pg_fallthrough;
                case AFTER_TRIGGER_FDW_REUSE:
 
                        /*
index baa76596ac23422ecccc5ae00d496f978dc02cd6..7d487a165fa50c1f517bcc0945bcd2aa1b655cdb 100644 (file)
@@ -2257,7 +2257,7 @@ ExecAgg(PlanState *pstate)
                        case AGG_HASHED:
                                if (!node->table_filled)
                                        agg_fill_hash_table(node);
-                               /* FALLTHROUGH */
+                               pg_fallthrough;
                        case AGG_MIXED:
                                result = agg_retrieve_hash_table(node);
                                break;
index f5d3edb90e2dde0b0ad90c6dae2fe2140d6b2c85..c0eb5a1f0c52724b29eb85c33f73da0b24d978cd 100644 (file)
@@ -258,7 +258,7 @@ MultiExecParallelHash(HashState *node)
                         * way, wait for everyone to arrive here so we can proceed.
                         */
                        BarrierArriveAndWait(build_barrier, WAIT_EVENT_HASH_BUILD_ALLOCATE);
-                       /* Fall through. */
+                       pg_fallthrough;
 
                case PHJ_BUILD_HASH_INNER:
 
@@ -1330,13 +1330,13 @@ ExecParallelHashIncreaseNumBatches(HashJoinTable hashtable)
                                /* All other participants just flush their tuples to disk. */
                                ExecParallelHashCloseBatchAccessors(hashtable);
                        }
-                       /* Fall through. */
+                       pg_fallthrough;
 
                case PHJ_GROW_BATCHES_REALLOCATE:
                        /* Wait for the above to be finished. */
                        BarrierArriveAndWait(&pstate->grow_batches_barrier,
                                                                 WAIT_EVENT_HASH_GROW_BATCHES_REALLOCATE);
-                       /* Fall through. */
+                       pg_fallthrough;
 
                case PHJ_GROW_BATCHES_REPARTITION:
                        /* Make sure that we have the current dimensions and buckets. */
@@ -1349,7 +1349,7 @@ ExecParallelHashIncreaseNumBatches(HashJoinTable hashtable)
                        /* Wait for the above to be finished. */
                        BarrierArriveAndWait(&pstate->grow_batches_barrier,
                                                                 WAIT_EVENT_HASH_GROW_BATCHES_REPARTITION);
-                       /* Fall through. */
+                       pg_fallthrough;
 
                case PHJ_GROW_BATCHES_DECIDE:
 
@@ -1411,7 +1411,7 @@ ExecParallelHashIncreaseNumBatches(HashJoinTable hashtable)
                                dsa_free(hashtable->area, pstate->old_batches);
                                pstate->old_batches = InvalidDsaPointer;
                        }
-                       /* Fall through. */
+                       pg_fallthrough;
 
                case PHJ_GROW_BATCHES_FINISH:
                        /* Wait for the above to complete. */
@@ -1689,13 +1689,13 @@ ExecParallelHashIncreaseNumBuckets(HashJoinTable hashtable)
                                /* Clear the flag. */
                                pstate->growth = PHJ_GROWTH_OK;
                        }
-                       /* Fall through. */
+                       pg_fallthrough;
 
                case PHJ_GROW_BUCKETS_REALLOCATE:
                        /* Wait for the above to complete. */
                        BarrierArriveAndWait(&pstate->grow_buckets_barrier,
                                                                 WAIT_EVENT_HASH_GROW_BUCKETS_REALLOCATE);
-                       /* Fall through. */
+                       pg_fallthrough;
 
                case PHJ_GROW_BUCKETS_REINSERT:
                        /* Reinsert all tuples into the hash table. */
index 114620a81373d15e6559d56d85e3d981aaec8504..5aa8a09b26523580083de74a0e989aa94d8390ea 100644 (file)
@@ -416,7 +416,7 @@ ExecHashJoinImpl(PlanState *pstate, bool parallel)
                                else
                                        node->hj_JoinState = HJ_NEED_NEW_OUTER;
 
-                               /* FALL THRU */
+                               pg_fallthrough;
 
                        case HJ_NEED_NEW_OUTER:
 
@@ -505,7 +505,7 @@ ExecHashJoinImpl(PlanState *pstate, bool parallel)
                                /* OK, let's scan the bucket for matches */
                                node->hj_JoinState = HJ_SCAN_BUCKET;
 
-                               /* FALL THRU */
+                               pg_fallthrough;
 
                        case HJ_SCAN_BUCKET:
 
@@ -1313,13 +1313,13 @@ ExecParallelHashJoinNewBatch(HashJoinState *hjstate)
                                        if (BarrierArriveAndWait(batch_barrier,
                                                                                         WAIT_EVENT_HASH_BATCH_ELECT))
                                                ExecParallelHashTableAlloc(hashtable, batchno);
-                                       /* Fall through. */
+                                       pg_fallthrough;
 
                                case PHJ_BATCH_ALLOCATE:
                                        /* Wait for allocation to complete. */
                                        BarrierArriveAndWait(batch_barrier,
                                                                                 WAIT_EVENT_HASH_BATCH_ALLOCATE);
-                                       /* Fall through. */
+                                       pg_fallthrough;
 
                                case PHJ_BATCH_LOAD:
                                        /* Start (or join in) loading tuples. */
@@ -1339,7 +1339,7 @@ ExecParallelHashJoinNewBatch(HashJoinState *hjstate)
                                        sts_end_parallel_scan(inner_tuples);
                                        BarrierArriveAndWait(batch_barrier,
                                                                                 WAIT_EVENT_HASH_BATCH_LOAD);
-                                       /* Fall through. */
+                                       pg_fallthrough;
 
                                case PHJ_BATCH_PROBE:
 
index c40a73dcf17a80fd376f6a58e94963907f96a71f..8f75cbbead2a9a251a644f6059f5013c07b79bb1 100644 (file)
@@ -68,7 +68,7 @@ ExecLimit(PlanState *pstate)
                         */
                        recompute_limits(node);
 
-                       /* FALL THRU */
+                       pg_fallthrough;
 
                case LIMIT_RESCAN:
 
@@ -215,7 +215,7 @@ ExecLimit(PlanState *pstate)
                        }
 
                        Assert(node->lstate == LIMIT_WINDOWEND_TIES);
-                       /* FALL THRU */
+                       pg_fallthrough;
 
                case LIMIT_WINDOWEND_TIES:
                        if (ScanDirectionIsForward(direction))
index 4aa28918e903d1a7e190cfadc3874037d9325086..503817da65b9194b362b505a76f991ebabfb72c7 100644 (file)
@@ -79,13 +79,13 @@ MakeTidOpExpr(OpExpr *expr, TidRangeScanState *tidstate)
        {
                case TIDLessEqOperator:
                        tidopexpr->inclusive = true;
-                       /* fall through */
+                       pg_fallthrough;
                case TIDLessOperator:
                        tidopexpr->exprtype = invert ? TIDEXPR_LOWER_BOUND : TIDEXPR_UPPER_BOUND;
                        break;
                case TIDGreaterEqOperator:
                        tidopexpr->inclusive = true;
-                       /* fall through */
+                       pg_fallthrough;
                case TIDGreaterOperator:
                        tidopexpr->exprtype = invert ? TIDEXPR_UPPER_BOUND : TIDEXPR_LOWER_BOUND;
                        break;
index 795bfed8d1936ef69a896c1dba92b249c2a7da91..e04aa2e68ed3aa997032505731e88301c15790c7 100644 (file)
@@ -2002,7 +2002,7 @@ pam_passwd_conv_proc(int num_msg, PG_PAM_CONST struct pam_message **msg,
                                ereport(LOG,
                                                (errmsg("error from underlying PAM layer: %s",
                                                                msg[i]->msg)));
-                               /* FALL THROUGH */
+                               pg_fallthrough;
                        case PAM_TEXT_INFO:
                                /* we don't bother to log TEXT_INFO messages */
                                if ((reply[i].resp = strdup("")) == NULL)
index 006b32819694a2aaa8e1191ffa4b1b95bce98855..42604a0f75c1973e993bf5ea3fef334c565d6a3a 100644 (file)
@@ -3464,11 +3464,11 @@ adjust_group_pathkeys_for_groupagg(PlannerInfo *root)
                                        case PATHKEYS_BETTER2:
                                                /* 'pathkeys' are stronger, use these ones instead */
                                                currpathkeys = pathkeys;
-                                               /* FALLTHROUGH */
+                                               pg_fallthrough;
 
                                        case PATHKEYS_BETTER1:
                                                /* 'pathkeys' are less strict */
-                                               /* FALLTHROUGH */
+                                               pg_fallthrough;
 
                                        case PATHKEYS_EQUAL:
                                                /* mark this aggregate as covered by 'currpathkeys' */
index 504a30d8836858a4482709a4f519c0ee283bb816..a41d81734cf0078a0e705270c42f330c9f1e1abf 100644 (file)
@@ -1547,7 +1547,7 @@ find_nonnullable_rels_walker(Node *node, bool top_level)
                                 * the intersection of the sets of nonnullable rels, just as
                                 * for OR.  Fall through to share code.
                                 */
-                               /* FALL THRU */
+                               pg_fallthrough;
                        case OR_EXPR:
 
                                /*
@@ -1805,7 +1805,7 @@ find_nonnullable_vars_walker(Node *node, bool top_level)
                                 * the intersection of the sets of nonnullable vars, just as
                                 * for OR.  Fall through to share code.
                                 */
-                               /* FALL THRU */
+                               pg_fallthrough;
                        case OR_EXPR:
 
                                /*
index c28ae99dee83dd8647c66fa91c8f8a0e41099ef1..32a1e8629b2095ef56de680a7cc1d2ac77d0eba5 100644 (file)
@@ -312,7 +312,7 @@ transformJsonTableColumns(JsonTableParseContext *cxt, List *columns,
                                        rawc->wrapper != JSW_UNSPEC)
                                        rawc->coltype = JTC_FORMATTED;
 
-                               /* FALLTHROUGH */
+                               pg_fallthrough;
                        case JTC_FORMATTED:
                        case JTC_EXISTS:
                                {
index b5f4c72459d912225a6abe0753df923fdd5f31f4..cc244c49e9e0f7622d3a71b65f1df94d46ed08d0 100644 (file)
@@ -918,7 +918,7 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column)
                                                         errmsg("primary key constraints are not supported on foreign tables"),
                                                         parser_errposition(cxt->pstate,
                                                                                                constraint->location)));
-                               /* FALL THRU */
+                               pg_fallthrough;
 
                        case CONSTR_UNIQUE:
                                if (cxt->isforeign)
index a4bbb10a3b7ebb3590bf85d9044f9a517bbb3fc7..6d979a08fd3eeab913cdde3c2392737a2eb5dc7b 100644 (file)
@@ -2880,7 +2880,7 @@ get_matching_list_bounds(PartitionPruneContext *context,
 
                case BTGreaterEqualStrategyNumber:
                        inclusive = true;
-                       /* fall through */
+                       pg_fallthrough;
                case BTGreaterStrategyNumber:
                        off = partition_list_bsearch(partsupfunc,
                                                                                 partcollation,
@@ -2915,7 +2915,7 @@ get_matching_list_bounds(PartitionPruneContext *context,
 
                case BTLessEqualStrategyNumber:
                        inclusive = true;
-                       /* fall through */
+                       pg_fallthrough;
                case BTLessStrategyNumber:
                        off = partition_list_bsearch(partsupfunc,
                                                                                 partcollation,
@@ -3162,7 +3162,7 @@ get_matching_range_bounds(PartitionPruneContext *context,
 
                case BTGreaterEqualStrategyNumber:
                        inclusive = true;
-                       /* fall through */
+                       pg_fallthrough;
                case BTGreaterStrategyNumber:
 
                        /*
@@ -3243,7 +3243,7 @@ get_matching_range_bounds(PartitionPruneContext *context,
 
                case BTLessEqualStrategyNumber:
                        inclusive = true;
-                       /* fall through */
+                       pg_fallthrough;
                case BTLessStrategyNumber:
 
                        /*
@@ -3726,19 +3726,19 @@ match_boolean_partition_clause(Oid partopfamily, Expr *clause, Expr *partkey,
                        {
                                case IS_NOT_TRUE:
                                        *notclause = true;
-                                       /* fall through */
+                                       pg_fallthrough;
                                case IS_TRUE:
                                        *outconst = (Expr *) makeBoolConst(true, false);
                                        return PARTCLAUSE_MATCH_CLAUSE;
                                case IS_NOT_FALSE:
                                        *notclause = true;
-                                       /* fall through */
+                                       pg_fallthrough;
                                case IS_FALSE:
                                        *outconst = (Expr *) makeBoolConst(false, false);
                                        return PARTCLAUSE_MATCH_CLAUSE;
                                case IS_NOT_UNKNOWN:
                                        *notclause = true;
-                                       /* fall through */
+                                       pg_fallthrough;
                                case IS_UNKNOWN:
                                        return PARTCLAUSE_MATCH_NULLNESS;
                                default:
index 70c7645582ea88adfa22f6df93b999b24e8e6f51..3fac46c402b20490989baa85b0fb38166342b694 100644 (file)
@@ -625,7 +625,7 @@ PostmasterMain(int argc, char *argv[])
                                                        (errcode(ERRCODE_SYNTAX_ERROR),
                                                         errmsg("--%s must be first argument", optarg)));
 
-                               /* FALLTHROUGH */
+                               pg_fallthrough;
                        case 'c':
                                {
                                        char       *name,
@@ -4217,12 +4217,12 @@ bgworker_should_start_now(BgWorkerStartTime start_time)
                case PM_RUN:
                        if (start_time == BgWorkerStart_RecoveryFinished)
                                return true;
-                       /* fall through */
+                       pg_fallthrough;
 
                case PM_HOT_STANDBY:
                        if (start_time == BgWorkerStart_ConsistentState)
                                return true;
-                       /* fall through */
+                       pg_fallthrough;
 
                case PM_RECOVERY:
                case PM_STARTUP:
index 9087ef95af3e9a5442ad8ac9d5610dd762fb182d..55df64f9adeb3867358d49908303e7b1345298be 100644 (file)
@@ -743,7 +743,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 */
+                       pg_fallthrough;
                case CHR('0'):
                        NOTE(REG_UUNPORT);
                        v->now--;                       /* put first digit back */
index 3e18e4a78a20211b609b8c10fac76544bc870ae7..820995332bac0b760ef186533865136d2e090640 100644 (file)
@@ -975,7 +975,7 @@ parseqatom(struct vars *v,
                        /* legal in EREs due to specification botch */
                        NOTE(REG_UPBOTCH);
                        /* fall through into case PLAIN */
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                case PLAIN:
                        onechr(v, v->nextvalue, lp, rp);
                        okcolors(v->nfa, v->cm);
index 94b2b29945c82b0362a14e4e47c4fd37eb1d4100..e832fa0d8eab5201dd94351b4da77f4a983cfbec 100644 (file)
@@ -2322,6 +2322,7 @@ ReorderBufferProcessTXN(ReorderBuffer *rb, ReorderBufferTXN *txn,
                                        change->action = REORDER_BUFFER_CHANGE_INSERT;
 
                                        /* intentionally fall through */
+                                       pg_fallthrough;
                                case REORDER_BUFFER_CHANGE_INSERT:
                                case REORDER_BUFFER_CHANGE_UPDATE:
                                case REORDER_BUFFER_CHANGE_DELETE:
index f179d081846cad35faa36914fb7fbac109ecc7f3..29933f53011cd2207dd4b2387fa08ce0fef936c7 100644 (file)
@@ -839,7 +839,7 @@ handle_streamed_transaction(LogicalRepMsgType action, StringInfo s)
                         */
                        pa_switch_to_partial_serialize(winfo, false);
 
-                       /* fall through */
+                       pg_fallthrough;
                case TRANS_LEADER_PARTIAL_SERIALIZE:
                        stream_write_change(action, &original_msg);
 
@@ -1586,7 +1586,7 @@ apply_handle_stream_prepare(StringInfo s)
                         */
                        pa_switch_to_partial_serialize(winfo, true);
 
-                       /* fall through */
+                       pg_fallthrough;
                case TRANS_LEADER_PARTIAL_SERIALIZE:
                        Assert(winfo);
 
@@ -1808,7 +1808,7 @@ apply_handle_stream_start(StringInfo s)
                         */
                        pa_switch_to_partial_serialize(winfo, !first_segment);
 
-                       /* fall through */
+                       pg_fallthrough;
                case TRANS_LEADER_PARTIAL_SERIALIZE:
                        Assert(winfo);
 
@@ -1923,7 +1923,7 @@ apply_handle_stream_stop(StringInfo s)
                         */
                        pa_switch_to_partial_serialize(winfo, true);
 
-                       /* fall through */
+                       pg_fallthrough;
                case TRANS_LEADER_PARTIAL_SERIALIZE:
                        stream_write_change(LOGICAL_REP_MSG_STREAM_STOP, s);
                        stream_stop_internal(stream_xid);
@@ -2169,7 +2169,7 @@ apply_handle_stream_abort(StringInfo s)
                         */
                        pa_switch_to_partial_serialize(winfo, true);
 
-                       /* fall through */
+                       pg_fallthrough;
                case TRANS_LEADER_PARTIAL_SERIALIZE:
                        Assert(winfo);
 
@@ -2442,7 +2442,7 @@ apply_handle_stream_commit(StringInfo s)
                         */
                        pa_switch_to_partial_serialize(winfo, true);
 
-                       /* fall through */
+                       pg_fallthrough;
                case TRANS_LEADER_PARTIAL_SERIALIZE:
                        Assert(winfo);
 
index 10e64a7d1f4081cc9e3bdbc9a831bc982f89cb2c..7c1b8757d7d4b98b699e1400a0585f7365ce3d90 100644 (file)
@@ -192,7 +192,7 @@ WalReceiverMain(const void *startup_data, size_t startup_data_len)
                case WALRCV_STOPPING:
                        /* If we've already been requested to stop, don't start up. */
                        walrcv->walRcvState = WALRCV_STOPPED;
-                       /* fall through */
+                       pg_fallthrough;
 
                case WALRCV_STOPPED:
                        SpinLockRelease(&walrcv->mutex);
index 42e3e170bc044528d13e3c46844a43a8991fd824..e62e8a20420bd459510d1e86c00838ce781f666b 100644 (file)
@@ -216,7 +216,7 @@ ShutdownWalRcv(void)
                case WALRCV_WAITING:
                case WALRCV_RESTARTING:
                        walrcv->walRcvState = WALRCV_STOPPING;
-                       /* fall through */
+                       pg_fallthrough;
                case WALRCV_STOPPING:
                        walrcvpid = walrcv->pid;
                        break;
index d2c9cd6f20a10f12b5cbb3fc60bb1583f6bff873..e4ae3031fef48195bcaca03f6638b5abaca2ffd0 100644 (file)
@@ -622,7 +622,7 @@ pgaio_io_wait(PgAioHandle *ioh, uint64 ref_generation)
                                        pgaio_method_ops->wait_one(ioh, ref_generation);
                                        continue;
                                }
-                               /* fallthrough */
+                               pg_fallthrough;
 
                                /* waiting for owner to submit */
                        case PGAIO_HS_DEFINED:
index 21de158adbba4d733c4c2b2b17d5515bb37bdeaa..d01a09dd0c417e5eb6fbe74752b3d56a07b93418 100644 (file)
@@ -3900,7 +3900,7 @@ process_postgres_switches(int argc, char *argv[], GucContext ctx,
                                                        (errcode(ERRCODE_SYNTAX_ERROR),
                                                         errmsg("--%s must be first argument", optarg)));
 
-                               /* FALLTHROUGH */
+                               pg_fallthrough;
                        case 'c':
                                {
                                        char       *name,
@@ -5024,7 +5024,7 @@ PostgresMain(const char *dbname, const char *username)
                                /* for the cumulative statistics system */
                                pgStatSessionEndCause = DISCONNECT_CLIENT_EOF;
 
-                               /* FALLTHROUGH */
+                               pg_fallthrough;
 
                        case PqMsg_Terminate:
 
index 34dd6e18df56e8a6061acd566b5ab08d9342bcb6..bf707f2d57ffb5c1de07ac7f356326c547810ca2 100644 (file)
@@ -2001,7 +2001,7 @@ ExecDropStmt(DropStmt *stmt, bool isTopLevel)
                        if (stmt->concurrent)
                                PreventInTransactionBlock(isTopLevel,
                                                                                  "DROP INDEX CONCURRENTLY");
-                       /* fall through */
+                       pg_fallthrough;
 
                case OBJECT_TABLE:
                case OBJECT_SEQUENCE:
index 8dc0ac50625e3f4c0be2e38fd4322625521400a5..90946db72ff5923283a4c2e622b130d8357cf8f6 100644 (file)
@@ -3594,7 +3594,7 @@ DecodeInterval(char **field, int *ftype, int nf, int range,
                                 * handle signed float numbers and signed year-month values.
                                 */
 
-                               /* FALLTHROUGH */
+                               pg_fallthrough;
 
                        case DTK_DATE:
                        case DTK_NUMBER:
@@ -4028,7 +4028,7 @@ DecodeISO8601Interval(char *str,
                                                continue;
                                        }
                                        /* Else fall through to extended alternative format */
-                                       /* FALLTHROUGH */
+                                       pg_fallthrough;
                                case '-':               /* ISO 8601 4.4.3.3 Alternative Format,
                                                                 * Extended */
                                        if (havefield)
@@ -4111,7 +4111,7 @@ DecodeISO8601Interval(char *str,
                                                return 0;
                                        }
                                        /* Else fall through to extended alternative format */
-                                       /* FALLTHROUGH */
+                                       pg_fallthrough;
                                case ':':               /* ISO 8601 4.4.3.3 Alternative Format,
                                                                 * Extended */
                                        if (havefield)
index 7720911a6a9127bfcaccad651686db022f2fe2c8..0716aff22b6208a5adb3aa15236131dde0d964f3 100644 (file)
@@ -1236,7 +1236,7 @@ NUMDesc_prepare(NUMDesc *num, FormatNode *n)
                case NUM_D:
                        num->flag |= NUM_F_LDECIMAL;
                        num->need_locale = true;
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                case NUM_DEC:
                        if (IS_DECIMAL(num))
                                ereport(ERROR,
@@ -3022,7 +3022,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col
                                s += strlen(s);
                                break;
                        case DCH_RM:
-                               /* FALLTHROUGH */
+                               pg_fallthrough;
                        case DCH_rm:
 
                                /*
@@ -3300,7 +3300,7 @@ DCH_from_char(FormatNode *node, const char *in, TmFromChar *out,
                        case DCH_FF5:
                        case DCH_FF6:
                                out->ff = n->key->id - DCH_FF1 + 1;
-                               /* FALLTHROUGH */
+                               pg_fallthrough;
                        case DCH_US:            /* microsecond */
                                len = from_char_parse_int_len(&out->us, &s,
                                                                                          n->key->id == DCH_US ? 6 :
@@ -3354,7 +3354,7 @@ DCH_from_char(FormatNode *node, const char *in, TmFromChar *out,
                                        }
                                        /* otherwise parse it like OF */
                                }
-                               /* FALLTHROUGH */
+                               pg_fallthrough;
                        case DCH_OF:
                                /* OF is equivalent to TZH or TZH:TZM */
                                /* see TZH comments below */
index 28e7f80d77f0793c788368eb2062eab319f577fa..0a3a77ee786a5582e6805be1581e86cc2765746c 100644 (file)
@@ -772,7 +772,7 @@ datum_to_jsonb_internal(Datum val, bool is_null, JsonbInState *result,
                        case JSONTYPE_CAST:
                                /* cast to JSON, and then process as JSON */
                                val = OidFunctionCall1(outfuncoid, val);
-                               /* FALL THROUGH */
+                               pg_fallthrough;
                        case JSONTYPE_JSON:
                                {
                                        /* parse the json right into the existing result object */
index e085042f912eb3f98c67e43d80f1d1dd17dc14c4..91fb9ea09bf4f39b98b1494fd24c411afd3587fc 100644 (file)
@@ -721,7 +721,7 @@ pushJsonbValueScalar(JsonbInState *pstate, JsonbIteratorToken seq,
                        uniqueifyJsonbObject(&ppstate->contVal,
                                                                 ppstate->unique_keys,
                                                                 ppstate->skip_nulls);
-                       /* fall through! */
+                       pg_fallthrough;
                case WJB_END_ARRAY:
                        /* Steps here common to WJB_END_OBJECT case */
                        Assert(!scalarVal);
index 18a8046d6cf416a14bba7dae5a2d6775bc0dd75f..d70ff1eaa546886377028a55a2a5814a15fe5ee7 100644 (file)
@@ -351,7 +351,7 @@ flattenJsonPathParseItem(StringInfo buf, int *result, struct Node *escontext,
                        break;
                case jpiFilter:
                        argNestingLevel++;
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                case jpiIsUnknown:
                case jpiNot:
                case jpiPlus:
@@ -487,13 +487,13 @@ alignStringInfoInt(StringInfo buf)
        {
                case 3:
                        appendStringInfoCharMacro(buf, 0);
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                case 2:
                        appendStringInfoCharMacro(buf, 0);
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                case 1:
                        appendStringInfoCharMacro(buf, 0);
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                default:
                        break;
        }
@@ -1021,7 +1021,7 @@ jspInitByBuffer(JsonPathItem *v, char *base, int32 pos)
                case jpiKey:
                case jpiVariable:
                        read_int32(v->content.value.datalen, base, pos);
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                case jpiNumeric:
                case jpiBool:
                        v->content.value.data = base + pos;
@@ -1433,7 +1433,7 @@ jspIsMutableWalker(JsonPathItem *jpi, struct JsonPathMutableContext *cxt)
 
                                        jspIsMutableWalker(&from, cxt);
                                }
-                               /* FALLTHROUGH */
+                               pg_fallthrough;
 
                        case jpiAnyArray:
                                if (!cxt->lax)
index 3bd3635d98aeec9008fc080bcd6b9ca00cd945c1..d25b8ad505dc7b8eab18fd205db8e45c7d8c3123 100644 (file)
@@ -2378,13 +2378,13 @@ numeric_abbrev_convert_var(const NumericVar *var, NumericSortSupport *nss)
                {
                        default:
                                result |= ((int64) var->digits[3]);
-                               /* FALLTHROUGH */
+                               pg_fallthrough;
                        case 3:
                                result |= ((int64) var->digits[2]) << 14;
-                               /* FALLTHROUGH */
+                               pg_fallthrough;
                        case 2:
                                result |= ((int64) var->digits[1]) << 28;
-                               /* FALLTHROUGH */
+                               pg_fallthrough;
                        case 1:
                                result |= ((int64) var->digits[0]) << 42;
                                break;
@@ -8818,22 +8818,22 @@ mul_var_short(const NumericVar *var1, const NumericVar *var2,
                        term = PRODSUM5(var1digits, 0, var2digits, 4) + carry;
                        res_digits[5] = (NumericDigit) (term % NBASE);
                        carry = term / NBASE;
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                case 5:
                        term = PRODSUM4(var1digits, 0, var2digits, 3) + carry;
                        res_digits[4] = (NumericDigit) (term % NBASE);
                        carry = term / NBASE;
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                case 4:
                        term = PRODSUM3(var1digits, 0, var2digits, 2) + carry;
                        res_digits[3] = (NumericDigit) (term % NBASE);
                        carry = term / NBASE;
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                case 3:
                        term = PRODSUM2(var1digits, 0, var2digits, 1) + carry;
                        res_digits[2] = (NumericDigit) (term % NBASE);
                        carry = term / NBASE;
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                case 2:
                        term = PRODSUM1(var1digits, 0, var2digits, 0) + carry;
                        res_digits[1] = (NumericDigit) (term % NBASE);
index 89cbdd3b1e7bb9fe7bc9822aa2e7bb3268d1a431..f16f15357859a51f284838cdd42b4d1f36d1a7aa 100644 (file)
@@ -9001,7 +9001,7 @@ isSimpleNode(Node *node, Node *parentNode, int prettyFlags)
                                }
                                /* else do the same stuff as for T_SubLink et al. */
                        }
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
 
                case T_SubLink:
                case T_NullTest:
index 8deb2369471c99d5756f800ca24e0e5d5f14f005..e2603183f1c084045ee633b58087904c6ea131fa 100644 (file)
@@ -4744,14 +4744,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 */
+                               pg_fallthrough;
                        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 */
+                               pg_fallthrough;
                        case DTK_DECADE:
                                /* see comments in timestamptz_trunc */
                                if (val != DTK_MILLENNIUM && val != DTK_CENTURY)
@@ -4761,25 +4761,25 @@ timestamp_trunc(PG_FUNCTION_ARGS)
                                        else
                                                tm->tm_year = -((8 - (tm->tm_year - 1)) / 10) * 10;
                                }
-                               /* FALL THRU */
+                               pg_fallthrough;
                        case DTK_YEAR:
                                tm->tm_mon = 1;
-                               /* FALL THRU */
+                               pg_fallthrough;
                        case DTK_QUARTER:
                                tm->tm_mon = (3 * ((tm->tm_mon - 1) / 3)) + 1;
-                               /* FALL THRU */
+                               pg_fallthrough;
                        case DTK_MONTH:
                                tm->tm_mday = 1;
-                               /* FALL THRU */
+                               pg_fallthrough;
                        case DTK_DAY:
                                tm->tm_hour = 0;
-                               /* FALL THRU */
+                               pg_fallthrough;
                        case DTK_HOUR:
                                tm->tm_min = 0;
-                               /* FALL THRU */
+                               pg_fallthrough;
                        case DTK_MINUTE:
                                tm->tm_sec = 0;
-                               /* FALL THRU */
+                               pg_fallthrough;
                        case DTK_SECOND:
                                fsec = 0;
                                break;
@@ -4990,14 +4990,14 @@ timestamptz_trunc_internal(text *units, TimestampTz timestamp, pg_tz *tzp)
                                        tm->tm_year = ((tm->tm_year + 999) / 1000) * 1000 - 999;
                                else
                                        tm->tm_year = -((999 - (tm->tm_year - 1)) / 1000) * 1000 + 1;
-                               /* FALL THRU */
+                               pg_fallthrough;
                        case DTK_CENTURY:
                                /* truncating to the century? as above: -100, 1, 101... */
                                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 */
+                               pg_fallthrough;
                        case DTK_DECADE:
 
                                /*
@@ -5011,26 +5011,26 @@ timestamptz_trunc_internal(text *units, TimestampTz timestamp, pg_tz *tzp)
                                        else
                                                tm->tm_year = -((8 - (tm->tm_year - 1)) / 10) * 10;
                                }
-                               /* FALL THRU */
+                               pg_fallthrough;
                        case DTK_YEAR:
                                tm->tm_mon = 1;
-                               /* FALL THRU */
+                               pg_fallthrough;
                        case DTK_QUARTER:
                                tm->tm_mon = (3 * ((tm->tm_mon - 1) / 3)) + 1;
-                               /* FALL THRU */
+                               pg_fallthrough;
                        case DTK_MONTH:
                                tm->tm_mday = 1;
-                               /* FALL THRU */
+                               pg_fallthrough;
                        case DTK_DAY:
                                tm->tm_hour = 0;
                                redotz = true;  /* for all cases >= DAY */
-                               /* FALL THRU */
+                               pg_fallthrough;
                        case DTK_HOUR:
                                tm->tm_min = 0;
-                               /* FALL THRU */
+                               pg_fallthrough;
                        case DTK_MINUTE:
                                tm->tm_sec = 0;
-                               /* FALL THRU */
+                               pg_fallthrough;
                        case DTK_SECOND:
                                fsec = 0;
                                break;
@@ -5171,33 +5171,33 @@ interval_trunc(PG_FUNCTION_ARGS)
                        case DTK_MILLENNIUM:
                                /* caution: C division may have negative remainder */
                                tm->tm_year = (tm->tm_year / 1000) * 1000;
-                               /* FALL THRU */
+                               pg_fallthrough;
                        case DTK_CENTURY:
                                /* caution: C division may have negative remainder */
                                tm->tm_year = (tm->tm_year / 100) * 100;
-                               /* FALL THRU */
+                               pg_fallthrough;
                        case DTK_DECADE:
                                /* caution: C division may have negative remainder */
                                tm->tm_year = (tm->tm_year / 10) * 10;
-                               /* FALL THRU */
+                               pg_fallthrough;
                        case DTK_YEAR:
                                tm->tm_mon = 0;
-                               /* FALL THRU */
+                               pg_fallthrough;
                        case DTK_QUARTER:
                                tm->tm_mon = 3 * (tm->tm_mon / 3);
-                               /* FALL THRU */
+                               pg_fallthrough;
                        case DTK_MONTH:
                                tm->tm_mday = 0;
-                               /* FALL THRU */
+                               pg_fallthrough;
                        case DTK_DAY:
                                tm->tm_hour = 0;
-                               /* FALL THRU */
+                               pg_fallthrough;
                        case DTK_HOUR:
                                tm->tm_min = 0;
-                               /* FALL THRU */
+                               pg_fallthrough;
                        case DTK_MINUTE:
                                tm->tm_sec = 0;
-                               /* FALL THRU */
+                               pg_fallthrough;
                        case DTK_SECOND:
                                tm->tm_usec = 0;
                                break;
index fcb13e7c0a1c9d06c5d89571fc00687a1364cb92..ac675d50212c0958319b5f4c5b1ef865ec17d3b8 100644 (file)
@@ -2186,7 +2186,7 @@ xml_errorHandler(void *data, PgXmlErrorPtr error)
                        if (error->code == XML_ERR_NOT_WELL_BALANCED &&
                                xmlerrcxt->err_occurred)
                                return;
-                       /* fall through */
+                       pg_fallthrough;
 
                case XML_FROM_NONE:
                case XML_FROM_MEMORY:
index 681aa923403f0af10a7db1af9f0897f6da792648..519089322f407765ece5c4836ec667b3bef9f68b 100644 (file)
@@ -357,15 +357,15 @@ CatalogCacheComputeHashValue(CatCache *cache, int nkeys,
                case 4:
                        oneHash = (cc_hashfunc[3]) (v4);
                        hashValue ^= pg_rotate_left32(oneHash, 24);
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                case 3:
                        oneHash = (cc_hashfunc[2]) (v3);
                        hashValue ^= pg_rotate_left32(oneHash, 16);
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                case 2:
                        oneHash = (cc_hashfunc[1]) (v2);
                        hashValue ^= pg_rotate_left32(oneHash, 8);
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                case 1:
                        oneHash = (cc_hashfunc[0]) (v1);
                        hashValue ^= oneHash;
@@ -403,21 +403,21 @@ CatalogCacheComputeTupleHashValue(CatCache *cache, int nkeys, HeapTuple tuple)
                                                         cc_tupdesc,
                                                         &isNull);
                        Assert(!isNull);
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                case 3:
                        v3 = fastgetattr(tuple,
                                                         cc_keyno[2],
                                                         cc_tupdesc,
                                                         &isNull);
                        Assert(!isNull);
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                case 2:
                        v2 = fastgetattr(tuple,
                                                         cc_keyno[1],
                                                         cc_tupdesc,
                                                         &isNull);
                        Assert(!isNull);
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                case 1:
                        v1 = fastgetattr(tuple,
                                                         cc_keyno[0],
index f3f94d46542c58cb233832c409ce089d6c7b11c6..78f4d5e202cdc4b7d1309c81bfeaf16efa0c5f0c 100644 (file)
@@ -1501,7 +1501,7 @@ pg_utf8_increment(unsigned char *charptr, int length)
                                charptr[3]++;
                                break;
                        }
-                       /* FALL THRU */
+                       pg_fallthrough;
                case 3:
                        a = charptr[2];
                        if (a < 0xBF)
@@ -1509,7 +1509,7 @@ pg_utf8_increment(unsigned char *charptr, int length)
                                charptr[2]++;
                                break;
                        }
-                       /* FALL THRU */
+                       pg_fallthrough;
                case 2:
                        a = charptr[1];
                        switch (*charptr)
@@ -1529,7 +1529,7 @@ pg_utf8_increment(unsigned char *charptr, int length)
                                charptr[1]++;
                                break;
                        }
-                       /* FALL THRU */
+                       pg_fallthrough;
                case 1:
                        a = *charptr;
                        if (a == 0x7F || a == 0xDF || a == 0xEF || a == 0xF4)
index ae9d5f3fb7013043e6afe7da233c4557241ef9df..d77502838c441679f6cf7e4600af41cb3e7d7341 100644 (file)
@@ -3415,7 +3415,7 @@ set_config_with_handle(const char *name, config_handle *handle,
                                }
                        }
                        /* fall through to process the same as PGC_BACKEND */
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                case PGC_BACKEND:
                        if (context == PGC_SIGHUP)
                        {
index 4f3e40bf4702615cfccb61bdc34e9b39d364694e..8524dd3a981872807d36879e7f8c15395bd9a535 100644 (file)
@@ -139,7 +139,7 @@ ExecSetVariableStmt(VariableSetStmt *stmt, bool isTopLevel)
                case VAR_SET_DEFAULT:
                        if (stmt->is_local)
                                WarnNoTransactionBlock(isTopLevel, "SET LOCAL");
-                       /* fall through */
+                       pg_fallthrough;
                case VAR_RESET:
                        (void) set_config_option(stmt->name,
                                                                         NULL,
index e57fa5bca64a90739bee5cf8e4d0bc88a3467470..afba82f28a299d95792868613c49a56005518bf5 100644 (file)
@@ -1024,7 +1024,7 @@ tuplestore_gettuple(Tuplestorestate *state, bool forward,
                                                        (errcode_for_file_access(),
                                                         errmsg("could not seek in tuplestore temporary file")));
                        state->status = TSS_READFILE;
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
 
                case TSS_READFILE:
                        *should_free = true;
index 58735871c1796ec4ae9f24825e08878519dc9241..cb4e986092e2a8e035e76fa4d25d730a9f0371b4 100644 (file)
@@ -3394,7 +3394,7 @@ readCommandResponse(CState *st, MetaCommand meta, char *varprefix)
                                                commandError(st, PQresultErrorMessage(res));
                                        goto error;
                                }
-                               /* fall through */
+                               pg_fallthrough;
 
                        default:
                                /* anything else is unexpected */
@@ -3607,7 +3607,7 @@ getTransactionStatus(PGconn *con)
                        /* PQTRANS_UNKNOWN is expected given a broken connection */
                        if (PQstatus(con) == CONNECTION_BAD)
                                return TSTATUS_CONN_ERROR;
-                       /* fall through */
+                       pg_fallthrough;
                case PQTRANS_ACTIVE:
                default:
 
@@ -5720,7 +5720,7 @@ postprocess_sql_command(Command *my_command)
                        break;
                case QUERY_PREPARED:
                        my_command->prepname = psprintf("P_%d", prepnum++);
-                       /* fall through */
+                       pg_fallthrough;
                case QUERY_EXTENDED:
                        if (!parseQuery(my_command))
                                exit(1);
index 0efe95568c04a2882b90206888966be629f95219..c7a0626f96f62b54e33060b7c5a63347583c71ab 100644 (file)
@@ -178,13 +178,13 @@ hash_bytes(const unsigned char *k, int keylen)
                {
                        case 11:
                                c += ((uint32) k[10] << 8);
-                               /* fall through */
+                               pg_fallthrough;
                        case 10:
                                c += ((uint32) k[9] << 16);
-                               /* fall through */
+                               pg_fallthrough;
                        case 9:
                                c += ((uint32) k[8] << 24);
-                               /* fall through */
+                               pg_fallthrough;
                        case 8:
                                /* the lowest byte of c is reserved for the length */
                                b += ka[1];
@@ -192,22 +192,22 @@ hash_bytes(const unsigned char *k, int keylen)
                                break;
                        case 7:
                                b += ((uint32) k[6] << 8);
-                               /* fall through */
+                               pg_fallthrough;
                        case 6:
                                b += ((uint32) k[5] << 16);
-                               /* fall through */
+                               pg_fallthrough;
                        case 5:
                                b += ((uint32) k[4] << 24);
-                               /* fall through */
+                               pg_fallthrough;
                        case 4:
                                a += ka[0];
                                break;
                        case 3:
                                a += ((uint32) k[2] << 8);
-                               /* fall through */
+                               pg_fallthrough;
                        case 2:
                                a += ((uint32) k[1] << 16);
-                               /* fall through */
+                               pg_fallthrough;
                        case 1:
                                a += ((uint32) k[0] << 24);
                                /* case 0: nothing left to add */
@@ -217,13 +217,13 @@ hash_bytes(const unsigned char *k, int keylen)
                {
                        case 11:
                                c += ((uint32) k[10] << 24);
-                               /* fall through */
+                               pg_fallthrough;
                        case 10:
                                c += ((uint32) k[9] << 16);
-                               /* fall through */
+                               pg_fallthrough;
                        case 9:
                                c += ((uint32) k[8] << 8);
-                               /* fall through */
+                               pg_fallthrough;
                        case 8:
                                /* the lowest byte of c is reserved for the length */
                                b += ka[1];
@@ -231,22 +231,22 @@ hash_bytes(const unsigned char *k, int keylen)
                                break;
                        case 7:
                                b += ((uint32) k[6] << 16);
-                               /* fall through */
+                               pg_fallthrough;
                        case 6:
                                b += ((uint32) k[5] << 8);
-                               /* fall through */
+                               pg_fallthrough;
                        case 5:
                                b += k[4];
-                               /* fall through */
+                               pg_fallthrough;
                        case 4:
                                a += ka[0];
                                break;
                        case 3:
                                a += ((uint32) k[2] << 16);
-                               /* fall through */
+                               pg_fallthrough;
                        case 2:
                                a += ((uint32) k[1] << 8);
-                               /* fall through */
+                               pg_fallthrough;
                        case 1:
                                a += k[0];
                                /* case 0: nothing left to add */
@@ -280,35 +280,35 @@ hash_bytes(const unsigned char *k, int keylen)
                {
                        case 11:
                                c += ((uint32) k[10] << 8);
-                               /* fall through */
+                               pg_fallthrough;
                        case 10:
                                c += ((uint32) k[9] << 16);
-                               /* fall through */
+                               pg_fallthrough;
                        case 9:
                                c += ((uint32) k[8] << 24);
-                               /* fall through */
+                               pg_fallthrough;
                        case 8:
                                /* the lowest byte of c is reserved for the length */
                                b += k[7];
-                               /* fall through */
+                               pg_fallthrough;
                        case 7:
                                b += ((uint32) k[6] << 8);
-                               /* fall through */
+                               pg_fallthrough;
                        case 6:
                                b += ((uint32) k[5] << 16);
-                               /* fall through */
+                               pg_fallthrough;
                        case 5:
                                b += ((uint32) k[4] << 24);
-                               /* fall through */
+                               pg_fallthrough;
                        case 4:
                                a += k[3];
-                               /* fall through */
+                               pg_fallthrough;
                        case 3:
                                a += ((uint32) k[2] << 8);
-                               /* fall through */
+                               pg_fallthrough;
                        case 2:
                                a += ((uint32) k[1] << 16);
-                               /* fall through */
+                               pg_fallthrough;
                        case 1:
                                a += ((uint32) k[0] << 24);
                                /* case 0: nothing left to add */
@@ -318,35 +318,35 @@ hash_bytes(const unsigned char *k, int keylen)
                {
                        case 11:
                                c += ((uint32) k[10] << 24);
-                               /* fall through */
+                               pg_fallthrough;
                        case 10:
                                c += ((uint32) k[9] << 16);
-                               /* fall through */
+                               pg_fallthrough;
                        case 9:
                                c += ((uint32) k[8] << 8);
-                               /* fall through */
+                               pg_fallthrough;
                        case 8:
                                /* the lowest byte of c is reserved for the length */
                                b += ((uint32) k[7] << 24);
-                               /* fall through */
+                               pg_fallthrough;
                        case 7:
                                b += ((uint32) k[6] << 16);
-                               /* fall through */
+                               pg_fallthrough;
                        case 6:
                                b += ((uint32) k[5] << 8);
-                               /* fall through */
+                               pg_fallthrough;
                        case 5:
                                b += k[4];
-                               /* fall through */
+                               pg_fallthrough;
                        case 4:
                                a += ((uint32) k[3] << 24);
-                               /* fall through */
+                               pg_fallthrough;
                        case 3:
                                a += ((uint32) k[2] << 16);
-                               /* fall through */
+                               pg_fallthrough;
                        case 2:
                                a += ((uint32) k[1] << 8);
-                               /* fall through */
+                               pg_fallthrough;
                        case 1:
                                a += k[0];
                                /* case 0: nothing left to add */
@@ -417,13 +417,13 @@ hash_bytes_extended(const unsigned char *k, int keylen, uint64 seed)
                {
                        case 11:
                                c += ((uint32) k[10] << 8);
-                               /* fall through */
+                               pg_fallthrough;
                        case 10:
                                c += ((uint32) k[9] << 16);
-                               /* fall through */
+                               pg_fallthrough;
                        case 9:
                                c += ((uint32) k[8] << 24);
-                               /* fall through */
+                               pg_fallthrough;
                        case 8:
                                /* the lowest byte of c is reserved for the length */
                                b += ka[1];
@@ -431,22 +431,22 @@ hash_bytes_extended(const unsigned char *k, int keylen, uint64 seed)
                                break;
                        case 7:
                                b += ((uint32) k[6] << 8);
-                               /* fall through */
+                               pg_fallthrough;
                        case 6:
                                b += ((uint32) k[5] << 16);
-                               /* fall through */
+                               pg_fallthrough;
                        case 5:
                                b += ((uint32) k[4] << 24);
-                               /* fall through */
+                               pg_fallthrough;
                        case 4:
                                a += ka[0];
                                break;
                        case 3:
                                a += ((uint32) k[2] << 8);
-                               /* fall through */
+                               pg_fallthrough;
                        case 2:
                                a += ((uint32) k[1] << 16);
-                               /* fall through */
+                               pg_fallthrough;
                        case 1:
                                a += ((uint32) k[0] << 24);
                                /* case 0: nothing left to add */
@@ -456,13 +456,13 @@ hash_bytes_extended(const unsigned char *k, int keylen, uint64 seed)
                {
                        case 11:
                                c += ((uint32) k[10] << 24);
-                               /* fall through */
+                               pg_fallthrough;
                        case 10:
                                c += ((uint32) k[9] << 16);
-                               /* fall through */
+                               pg_fallthrough;
                        case 9:
                                c += ((uint32) k[8] << 8);
-                               /* fall through */
+                               pg_fallthrough;
                        case 8:
                                /* the lowest byte of c is reserved for the length */
                                b += ka[1];
@@ -470,22 +470,22 @@ hash_bytes_extended(const unsigned char *k, int keylen, uint64 seed)
                                break;
                        case 7:
                                b += ((uint32) k[6] << 16);
-                               /* fall through */
+                               pg_fallthrough;
                        case 6:
                                b += ((uint32) k[5] << 8);
-                               /* fall through */
+                               pg_fallthrough;
                        case 5:
                                b += k[4];
-                               /* fall through */
+                               pg_fallthrough;
                        case 4:
                                a += ka[0];
                                break;
                        case 3:
                                a += ((uint32) k[2] << 16);
-                               /* fall through */
+                               pg_fallthrough;
                        case 2:
                                a += ((uint32) k[1] << 8);
-                               /* fall through */
+                               pg_fallthrough;
                        case 1:
                                a += k[0];
                                /* case 0: nothing left to add */
@@ -519,35 +519,35 @@ hash_bytes_extended(const unsigned char *k, int keylen, uint64 seed)
                {
                        case 11:
                                c += ((uint32) k[10] << 8);
-                               /* fall through */
+                               pg_fallthrough;
                        case 10:
                                c += ((uint32) k[9] << 16);
-                               /* fall through */
+                               pg_fallthrough;
                        case 9:
                                c += ((uint32) k[8] << 24);
-                               /* fall through */
+                               pg_fallthrough;
                        case 8:
                                /* the lowest byte of c is reserved for the length */
                                b += k[7];
-                               /* fall through */
+                               pg_fallthrough;
                        case 7:
                                b += ((uint32) k[6] << 8);
-                               /* fall through */
+                               pg_fallthrough;
                        case 6:
                                b += ((uint32) k[5] << 16);
-                               /* fall through */
+                               pg_fallthrough;
                        case 5:
                                b += ((uint32) k[4] << 24);
-                               /* fall through */
+                               pg_fallthrough;
                        case 4:
                                a += k[3];
-                               /* fall through */
+                               pg_fallthrough;
                        case 3:
                                a += ((uint32) k[2] << 8);
-                               /* fall through */
+                               pg_fallthrough;
                        case 2:
                                a += ((uint32) k[1] << 16);
-                               /* fall through */
+                               pg_fallthrough;
                        case 1:
                                a += ((uint32) k[0] << 24);
                                /* case 0: nothing left to add */
@@ -557,35 +557,35 @@ hash_bytes_extended(const unsigned char *k, int keylen, uint64 seed)
                {
                        case 11:
                                c += ((uint32) k[10] << 24);
-                               /* fall through */
+                               pg_fallthrough;
                        case 10:
                                c += ((uint32) k[9] << 16);
-                               /* fall through */
+                               pg_fallthrough;
                        case 9:
                                c += ((uint32) k[8] << 8);
-                               /* fall through */
+                               pg_fallthrough;
                        case 8:
                                /* the lowest byte of c is reserved for the length */
                                b += ((uint32) k[7] << 24);
-                               /* fall through */
+                               pg_fallthrough;
                        case 7:
                                b += ((uint32) k[6] << 16);
-                               /* fall through */
+                               pg_fallthrough;
                        case 6:
                                b += ((uint32) k[5] << 8);
-                               /* fall through */
+                               pg_fallthrough;
                        case 5:
                                b += k[4];
-                               /* fall through */
+                               pg_fallthrough;
                        case 4:
                                a += ((uint32) k[3] << 24);
-                               /* fall through */
+                               pg_fallthrough;
                        case 3:
                                a += ((uint32) k[2] << 16);
-                               /* fall through */
+                               pg_fallthrough;
                        case 2:
                                a += ((uint32) k[1] << 8);
-                               /* fall through */
+                               pg_fallthrough;
                        case 1:
                                a += k[0];
                                /* case 0: nothing left to add */
index eb15ee594979ac5a254782b44ffa9e3407c49140..e7b6595b042c573e87a6a31bb0a6860756c83b91 100644 (file)
@@ -2021,12 +2021,12 @@ pg_utf8_islegal(const unsigned char *source, int length)
                        a = source[3];
                        if (a < 0x80 || a > 0xBF)
                                return false;
-                       /* FALL THRU */
+                       pg_fallthrough;
                case 3:
                        a = source[2];
                        if (a < 0x80 || a > 0xBF)
                                return false;
-                       /* FALL THRU */
+                       pg_fallthrough;
                case 2:
                        a = source[1];
                        switch (*source)
@@ -2052,7 +2052,7 @@ pg_utf8_islegal(const unsigned char *source, int length)
                                                return false;
                                        break;
                        }
-                       /* FALL THRU */
+                       pg_fallthrough;
                case 1:
                        a = *source;
                        if (a >= 0x80 && a < 0xC2)
index a249674f02640e739fe918cc5d076bb6772b7ffa..7ee4751992f7dbe18af97b9cb216acff15bc8a53 100644 (file)
 #define pg_attribute_unused()
 #endif
 
+/*
+ * pg_fallthrough indicates that the fall through from the previous case is
+ * intentional.
+ */
+#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) || (defined(__cplusplus) && __cplusplus >= 201703L)
+#define pg_fallthrough [[fallthrough]]
+#elif __has_attribute(fallthrough)
+#define pg_fallthrough __attribute__((fallthrough))
+#else
+#define pg_fallthrough
+#endif
+
 /*
  * pg_nodiscard means the compiler should warn if the result of a function
  * call is ignored.  The name "nodiscard" is chosen in alignment with the C23
index 6966daa2b09431e8a605f41f88dc80dd2678c058..06bdf6d58669c14a3be214dda6ed2871c24ac16b 100644 (file)
@@ -158,23 +158,23 @@ fasthash_accum(fasthash_state *hs, const char *k, size_t len)
                        break;
                case 7:
                        hs->accum |= (uint64) k[6] << 8;
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                case 6:
                        hs->accum |= (uint64) k[5] << 16;
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                case 5:
                        hs->accum |= (uint64) k[4] << 24;
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                case 4:
                        memcpy(&lower_four, k, sizeof(lower_four));
                        hs->accum |= (uint64) lower_four << 32;
                        break;
                case 3:
                        hs->accum |= (uint64) k[2] << 40;
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                case 2:
                        hs->accum |= (uint64) k[1] << 48;
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                case 1:
                        hs->accum |= (uint64) k[0] << 56;
                        break;
@@ -189,23 +189,23 @@ fasthash_accum(fasthash_state *hs, const char *k, size_t len)
                        break;
                case 7:
                        hs->accum |= (uint64) k[6] << 48;
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                case 6:
                        hs->accum |= (uint64) k[5] << 40;
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                case 5:
                        hs->accum |= (uint64) k[4] << 32;
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                case 4:
                        memcpy(&lower_four, k, sizeof(lower_four));
                        hs->accum |= lower_four;
                        break;
                case 3:
                        hs->accum |= (uint64) k[2] << 16;
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                case 2:
                        hs->accum |= (uint64) k[1] << 8;
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
                case 1:
                        hs->accum |= (uint64) k[0];
                        break;
index 936a6883816886e8dd311fd6a7ba45a7af98e840..e452a088f9e5400a8dcd728a0d56b022eecf4563 100644 (file)
@@ -184,7 +184,7 @@ DecodeISO8601Interval(char *str,
                                                continue;
                                        }
                                        /* Else fall through to extended alternative format */
-                                       /* FALLTHROUGH */
+                                       pg_fallthrough;
                                case '-':               /* ISO 8601 4.4.3.3 Alternative Format,
                                                                 * Extended */
                                        if (havefield)
@@ -263,7 +263,7 @@ DecodeISO8601Interval(char *str,
                                                return 0;
                                        }
                                        /* Else fall through to extended alternative format */
-                                       /* FALLTHROUGH */
+                                       pg_fallthrough;
                                case ':':               /* ISO 8601 4.4.3.3 Alternative Format,
                                                                 * Extended */
                                        if (havefield)
@@ -391,7 +391,7 @@ DecodeInterval(char **field, int *ftype, int nf,    /* int range, */
                                        tmask = DTK_M(TZ);
                                        break;
                                }
-                               /* FALL THROUGH */
+                               pg_fallthrough;
 
                        case DTK_DATE:
                        case DTK_NUMBER:
index 399fe7adf6220ef866e6a64ef29934202b81dbb1..31d5b48d3f92a79615368a31cd15069319da372d 100644 (file)
@@ -379,7 +379,7 @@ retry_masked:
                                /* Set flag for EPIPE */
                                REMEMBER_EPIPE(spinfo, true);
 
-                               /* FALL THRU */
+                               pg_fallthrough;
 
                        case ECONNRESET:
                                conn->write_failed = true;
index 723048ab8338cddd0c5e2d5ec03ca912996f71e0..84552e32c87047ddddddd806b7f1da8f87e2a40e 100644 (file)
@@ -3230,7 +3230,7 @@ exec_stmt_return(PLpgSQL_execstate *estate, PLpgSQL_stmt_return *stmt)
                                /* fulfill promise if needed, then handle like regular var */
                                plpgsql_fulfill_promise(estate, (PLpgSQL_var *) retvar);
 
-                               /* FALL THRU */
+                               pg_fallthrough;
 
                        case PLPGSQL_DTYPE_VAR:
                                {
@@ -3362,7 +3362,7 @@ exec_stmt_return_next(PLpgSQL_execstate *estate,
                                /* fulfill promise if needed, then handle like regular var */
                                plpgsql_fulfill_promise(estate, (PLpgSQL_var *) retvar);
 
-                               /* FALL THRU */
+                               pg_fallthrough;
 
                        case PLPGSQL_DTYPE_VAR:
                                {
@@ -5299,7 +5299,7 @@ exec_eval_datum(PLpgSQL_execstate *estate,
                        /* fulfill promise if needed, then handle like regular var */
                        plpgsql_fulfill_promise(estate, (PLpgSQL_var *) datum);
 
-                       /* FALL THRU */
+                       pg_fallthrough;
 
                case PLPGSQL_DTYPE_VAR:
                        {
index 187698ccdd25c814690693eceb32b8b4502f75ff..b7318f7261eee324218f607fa8872adbc4695abe 100644 (file)
@@ -2545,7 +2545,7 @@ pltcl_process_SPI_result(Tcl_Interp *interp,
                                break;
                        }
                        /* fall through for utility returning tuples */
-                       /* FALLTHROUGH */
+                       pg_fallthrough;
 
                case SPI_OK_SELECT:
                case SPI_OK_INSERT_RETURNING:
index 56c7036753c2d6584a68f913f464df1d13b09355..5deee44d3a2000773260cbc92ae9752de27c5abb 100644 (file)
@@ -462,7 +462,7 @@ nextch2:
                                /* set zero padding if no nonzero digits yet */
                                if (accum == 0 && !pointflag)
                                        zpad = '0';
-                               /* FALL THRU */
+                               pg_fallthrough;
                        case '1':
                        case '2':
                        case '3':
index 6bc559f7bf8adb56af59846bd379dc1844859d33..8fbd180c8616e861a14eeebeea2f1a0e286040f3 100644 (file)
@@ -113,7 +113,7 @@ main(int argc, char **argv)
                {
                        case 'r':                       /* chunk range */
                                run_chunk_ranges = true;
-                               /* fall through */
+                               pg_fallthrough;
                        case 'c':                       /* chunk size */
                                chunk_size = strtou64(optarg, NULL, 10);
                                if (chunk_size > BUFSIZE)
index 8dcc7b337a770323d1223e7e9dde865ecad5ad84..2f36486a350b596eddeb65746f8c9aa9b6800b4c 100644 (file)
@@ -1395,19 +1395,19 @@ gethms(char const *string, char const *errstring)
                        break;
                case 8:
                        ok = '0' <= xr && xr <= '9';
-                       /* fallthrough */
+                       pg_fallthrough;
                case 7:
                        ok &= ssx == '.';
                        if (ok && noise)
                                warning(_("fractional seconds rejected by"
                                                  " pre-2018 versions of zic"));
-                       /* fallthrough */
+                       pg_fallthrough;
                case 5:
                        ok &= mmx == ':';
-                       /* fallthrough */
+                       pg_fallthrough;
                case 3:
                        ok &= hhx == ':';
-                       /* fallthrough */
+                       pg_fallthrough;
                case 1:
                        break;
        }
index 2622cc6227af059c81ae2f9720769150984cac3c..6e550ff310fa29ed6b20deb1e0c96c269cff48f7 100644 (file)
@@ -352,7 +352,7 @@ main(int argc, char **argv)
                    }
                    goto sw_buffer;
                }
-               /* FALLTHROUGH */
+               pg_fallthrough;
            default:            /* it is the start of a normal statement */
                {
                    int remove_newlines;
@@ -922,7 +922,7 @@ check_type:
        case structure:
            if (ps.p_l_follow > 0)
                goto copy_id;
-               /* FALLTHROUGH */
+           pg_fallthrough;
        case decl:              /* we have a declaration type (int, etc.) */
            parse(decl);        /* let parser worry about indentation */
            if (ps.last_token == rparen && ps.tos <= 1) {
index e707da639c71e8b0e00e394463c9b513276ec09b..94cea72439378e5f36e7560c7779e62474decd87 100644 (file)
@@ -96,7 +96,7 @@ parse(int tk) /* tk: the code for the construct scanned */
                 */
                ps.i_l_follow = ps.il[ps.tos--];
        /* the rest is the same as for dolit and forstmt */
-       /* FALLTHROUGH */
+       pg_fallthrough;
     case dolit:                /* 'do' */
     case forstmt:              /* for (...) */
        ps.p_stack[++ps.tos] = tk;
@@ -303,7 +303,7 @@ reduce(void)
            case swstmt:
                /* <switch> <stmt> */
                case_ind = ps.cstk[ps.tos - 1];
-               /* FALLTHROUGH */
+               pg_fallthrough;
            case decl:          /* finish of a declaration */
            case elsehead:
                /* <<if> <stmt> else> <stmt> */