Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 17cc133

Browse files
committed
Dial back -Wimplicit-fallthrough to level 3
The additional pain from level 4 is excessive for the gain. Also revert all the source annotation changes to their original wordings, to avoid back-patching pain. Discussion: https://postgr.es/m/31166.1589378554@sss.pgh.pa.us
1 parent 81ca868 commit 17cc133

File tree

34 files changed

+194
-199
lines changed

34 files changed

+194
-199
lines changed

configure

+20-20
Original file line numberDiff line numberDiff line change
@@ -5553,15 +5553,15 @@ fi
55535553

55545554

55555555

5556-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wimplicit-fallthrough=4, for CFLAGS" >&5
5557-
$as_echo_n "checking whether ${CC} supports -Wimplicit-fallthrough=4, for CFLAGS... " >&6; }
5558-
if ${pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_4+:} false; then :
5556+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wimplicit-fallthrough=3, for CFLAGS" >&5
5557+
$as_echo_n "checking whether ${CC} supports -Wimplicit-fallthrough=3, for CFLAGS... " >&6; }
5558+
if ${pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_3+:} false; then :
55595559
$as_echo_n "(cached) " >&6
55605560
else
55615561
pgac_save_CFLAGS=$CFLAGS
55625562
pgac_save_CC=$CC
55635563
CC=${CC}
5564-
CFLAGS="${CFLAGS} -Wimplicit-fallthrough=4"
5564+
CFLAGS="${CFLAGS} -Wimplicit-fallthrough=3"
55655565
ac_save_c_werror_flag=$ac_c_werror_flag
55665566
ac_c_werror_flag=yes
55675567
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -5576,31 +5576,31 @@ main ()
55765576
}
55775577
_ACEOF
55785578
if ac_fn_c_try_compile "$LINENO"; then :
5579-
pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_4=yes
5579+
pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_3=yes
55805580
else
5581-
pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_4=no
5581+
pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_3=no
55825582
fi
55835583
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
55845584
ac_c_werror_flag=$ac_save_c_werror_flag
55855585
CFLAGS="$pgac_save_CFLAGS"
55865586
CC="$pgac_save_CC"
55875587
fi
5588-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_4" >&5
5589-
$as_echo "$pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_4" >&6; }
5590-
if test x"$pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_4" = x"yes"; then
5591-
CFLAGS="${CFLAGS} -Wimplicit-fallthrough=4"
5588+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_3" >&5
5589+
$as_echo "$pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_3" >&6; }
5590+
if test x"$pgac_cv_prog_CC_cflags__Wimplicit_fallthrough_3" = x"yes"; then
5591+
CFLAGS="${CFLAGS} -Wimplicit-fallthrough=3"
55925592
fi
55935593

55945594

5595-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CXX} supports -Wimplicit-fallthrough=4, for CXXFLAGS" >&5
5596-
$as_echo_n "checking whether ${CXX} supports -Wimplicit-fallthrough=4, for CXXFLAGS... " >&6; }
5597-
if ${pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_4+:} false; then :
5595+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CXX} supports -Wimplicit-fallthrough=3, for CXXFLAGS" >&5
5596+
$as_echo_n "checking whether ${CXX} supports -Wimplicit-fallthrough=3, for CXXFLAGS... " >&6; }
5597+
if ${pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_3+:} false; then :
55985598
$as_echo_n "(cached) " >&6
55995599
else
56005600
pgac_save_CXXFLAGS=$CXXFLAGS
56015601
pgac_save_CXX=$CXX
56025602
CXX=${CXX}
5603-
CXXFLAGS="${CXXFLAGS} -Wimplicit-fallthrough=4"
5603+
CXXFLAGS="${CXXFLAGS} -Wimplicit-fallthrough=3"
56045604
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
56055605
ac_cxx_werror_flag=yes
56065606
ac_ext=cpp
@@ -5621,9 +5621,9 @@ main ()
56215621
}
56225622
_ACEOF
56235623
if ac_fn_cxx_try_compile "$LINENO"; then :
5624-
pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_4=yes
5624+
pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_3=yes
56255625
else
5626-
pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_4=no
5626+
pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_3=no
56275627
fi
56285628
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
56295629
ac_ext=c
@@ -5636,10 +5636,10 @@ ac_cxx_werror_flag=$ac_save_cxx_werror_flag
56365636
CXXFLAGS="$pgac_save_CXXFLAGS"
56375637
CXX="$pgac_save_CXX"
56385638
fi
5639-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_4" >&5
5640-
$as_echo "$pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_4" >&6; }
5641-
if test x"$pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_4" = x"yes"; then
5642-
CXXFLAGS="${CXXFLAGS} -Wimplicit-fallthrough=4"
5639+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_3" >&5
5640+
$as_echo "$pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_3" >&6; }
5641+
if test x"$pgac_cv_prog_CXX_cxxflags__Wimplicit_fallthrough_3" = x"yes"; then
5642+
CXXFLAGS="${CXXFLAGS} -Wimplicit-fallthrough=3"
56435643
fi
56445644

56455645

configure.in

+2-2
Original file line numberDiff line numberDiff line change
@@ -496,8 +496,8 @@ if test "$GCC" = yes -a "$ICC" = no; then
496496
PGAC_PROG_CXX_CFLAGS_OPT([-Wendif-labels])
497497
PGAC_PROG_CC_CFLAGS_OPT([-Wmissing-format-attribute])
498498
PGAC_PROG_CXX_CFLAGS_OPT([-Wmissing-format-attribute])
499-
PGAC_PROG_CC_CFLAGS_OPT([-Wimplicit-fallthrough=4])
500-
PGAC_PROG_CXX_CFLAGS_OPT([-Wimplicit-fallthrough=4])
499+
PGAC_PROG_CC_CFLAGS_OPT([-Wimplicit-fallthrough=3])
500+
PGAC_PROG_CXX_CFLAGS_OPT([-Wimplicit-fallthrough=3])
501501
# This was included in -Wall/-Wformat in older GCC versions
502502
PGAC_PROG_CC_CFLAGS_OPT([-Wformat-security])
503503
PGAC_PROG_CXX_CFLAGS_OPT([-Wformat-security])

contrib/pgcrypto/pgp-info.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ pgp_get_keyid(MBuf *pgp_data, char *dst)
169169
break;
170170
case PGP_PKT_SYMENCRYPTED_SESSKEY:
171171
got_symenc_key++;
172-
/* FALLTHROUGH */
172+
/* fall through */
173173
case PGP_PKT_SIGNATURE:
174174
case PGP_PKT_MARKER:
175175
case PGP_PKT_TRUST:

src/backend/access/heap/heapam_handler.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ heapam_relation_copy_for_cluster(Relation OldHeap, Relation NewHeap,
814814
break;
815815
case HEAPTUPLE_RECENTLY_DEAD:
816816
*tups_recently_dead += 1;
817-
/* FALLTHROUGH */
817+
/* fall through */
818818
case HEAPTUPLE_LIVE:
819819
/* Live or recently dead, must copy it */
820820
isdead = false;

src/backend/catalog/dependency.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ findDependentObjects(const ObjectAddress *object,
615615
break;
616616

617617
/* Otherwise, treat this like an internal dependency */
618-
/* FALLTHROUGH */
618+
/* FALL THRU */
619619

620620
case DEPENDENCY_INTERNAL:
621621

src/backend/commands/tablecmds.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -12467,7 +12467,7 @@ ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing, LOCKMODE lock
1246712467
case RELKIND_TOASTVALUE:
1246812468
if (recursing)
1246912469
break;
12470-
/* FALLTHROUGH */
12470+
/* FALL THRU */
1247112471
default:
1247212472
ereport(ERROR,
1247312473
(errcode(ERRCODE_WRONG_OBJECT_TYPE),

src/backend/commands/trigger.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -3877,7 +3877,7 @@ AfterTriggerExecute(EState *estate,
38773877
trig_tuple_slot2))
38783878
elog(ERROR, "failed to fetch tuple2 for AFTER trigger");
38793879
}
3880-
/* FALLTHROUGH */
3880+
/* fall through */
38813881
case AFTER_TRIGGER_FDW_REUSE:
38823882

38833883
/*

src/backend/executor/nodeHash.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ MultiExecParallelHash(HashState *node)
256256
* way, wait for everyone to arrive here so we can proceed.
257257
*/
258258
BarrierArriveAndWait(build_barrier, WAIT_EVENT_HASH_BUILD_ALLOCATING);
259-
/* FALLTHROUGH */
259+
/* Fall through. */
260260

261261
case PHJ_BUILD_HASHING_INNER:
262262

@@ -1181,13 +1181,13 @@ ExecParallelHashIncreaseNumBatches(HashJoinTable hashtable)
11811181
/* All other participants just flush their tuples to disk. */
11821182
ExecParallelHashCloseBatchAccessors(hashtable);
11831183
}
1184-
/* FALLTHROUGH */
1184+
/* Fall through. */
11851185

11861186
case PHJ_GROW_BATCHES_ALLOCATING:
11871187
/* Wait for the above to be finished. */
11881188
BarrierArriveAndWait(&pstate->grow_batches_barrier,
11891189
WAIT_EVENT_HASH_GROW_BATCHES_ALLOCATING);
1190-
/* FALLTHROUGH */
1190+
/* Fall through. */
11911191

11921192
case PHJ_GROW_BATCHES_REPARTITIONING:
11931193
/* Make sure that we have the current dimensions and buckets. */
@@ -1200,7 +1200,7 @@ ExecParallelHashIncreaseNumBatches(HashJoinTable hashtable)
12001200
/* Wait for the above to be finished. */
12011201
BarrierArriveAndWait(&pstate->grow_batches_barrier,
12021202
WAIT_EVENT_HASH_GROW_BATCHES_REPARTITIONING);
1203-
/* FALLTHROUGH */
1203+
/* Fall through. */
12041204

12051205
case PHJ_GROW_BATCHES_DECIDING:
12061206

@@ -1255,7 +1255,7 @@ ExecParallelHashIncreaseNumBatches(HashJoinTable hashtable)
12551255
dsa_free(hashtable->area, pstate->old_batches);
12561256
pstate->old_batches = InvalidDsaPointer;
12571257
}
1258-
/* FALLTHROUGH */
1258+
/* Fall through. */
12591259

12601260
case PHJ_GROW_BATCHES_FINISHING:
12611261
/* Wait for the above to complete. */
@@ -1533,13 +1533,13 @@ ExecParallelHashIncreaseNumBuckets(HashJoinTable hashtable)
15331533
/* Clear the flag. */
15341534
pstate->growth = PHJ_GROWTH_OK;
15351535
}
1536-
/* FALLTHROUGH */
1536+
/* Fall through. */
15371537

15381538
case PHJ_GROW_BUCKETS_ALLOCATING:
15391539
/* Wait for the above to complete. */
15401540
BarrierArriveAndWait(&pstate->grow_buckets_barrier,
15411541
WAIT_EVENT_HASH_GROW_BUCKETS_ALLOCATING);
1542-
/* FALLTHROUGH */
1542+
/* Fall through. */
15431543

15441544
case PHJ_GROW_BUCKETS_REINSERTING:
15451545
/* Reinsert all tuples into the hash table. */

src/backend/executor/nodeHashjoin.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ ExecHashJoinImpl(PlanState *pstate, bool parallel)
340340
else
341341
node->hj_JoinState = HJ_NEED_NEW_OUTER;
342342

343-
/* FALLTHROUGH */
343+
/* FALL THRU */
344344

345345
case HJ_NEED_NEW_OUTER:
346346

@@ -413,7 +413,7 @@ ExecHashJoinImpl(PlanState *pstate, bool parallel)
413413
/* OK, let's scan the bucket for matches */
414414
node->hj_JoinState = HJ_SCAN_BUCKET;
415415

416-
/* FALLTHROUGH */
416+
/* FALL THRU */
417417

418418
case HJ_SCAN_BUCKET:
419419

@@ -1137,13 +1137,13 @@ ExecParallelHashJoinNewBatch(HashJoinState *hjstate)
11371137
if (BarrierArriveAndWait(batch_barrier,
11381138
WAIT_EVENT_HASH_BATCH_ELECTING))
11391139
ExecParallelHashTableAlloc(hashtable, batchno);
1140-
/* FALLTHROUGH */
1140+
/* Fall through. */
11411141

11421142
case PHJ_BATCH_ALLOCATING:
11431143
/* Wait for allocation to complete. */
11441144
BarrierArriveAndWait(batch_barrier,
11451145
WAIT_EVENT_HASH_BATCH_ALLOCATING);
1146-
/* FALLTHROUGH */
1146+
/* Fall through. */
11471147

11481148
case PHJ_BATCH_LOADING:
11491149
/* Start (or join in) loading tuples. */
@@ -1163,7 +1163,7 @@ ExecParallelHashJoinNewBatch(HashJoinState *hjstate)
11631163
sts_end_parallel_scan(inner_tuples);
11641164
BarrierArriveAndWait(batch_barrier,
11651165
WAIT_EVENT_HASH_BATCH_LOADING);
1166-
/* FALLTHROUGH */
1166+
/* Fall through. */
11671167

11681168
case PHJ_BATCH_PROBING:
11691169

src/backend/executor/nodeLimit.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ ExecLimit(PlanState *pstate)
6969
*/
7070
recompute_limits(node);
7171

72-
/* FALLTHROUGH */
72+
/* FALL THRU */
7373

7474
case LIMIT_RESCAN:
7575

@@ -216,7 +216,7 @@ ExecLimit(PlanState *pstate)
216216
}
217217

218218
Assert(node->lstate == LIMIT_WINDOWEND_TIES);
219-
/* FALLTHROUGH */
219+
/* FALL THRU */
220220

221221
case LIMIT_WINDOWEND_TIES:
222222
if (ScanDirectionIsForward(direction))

src/backend/libpq/auth.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2123,7 +2123,7 @@ pam_passwd_conv_proc(int num_msg, const struct pam_message **msg,
21232123
ereport(LOG,
21242124
(errmsg("error from underlying PAM layer: %s",
21252125
msg[i]->msg)));
2126-
/* FALLTHROUGH */
2126+
/* FALL THROUGH */
21272127
case PAM_TEXT_INFO:
21282128
/* we don't bother to log TEXT_INFO messages */
21292129
if ((reply[i].resp = strdup("")) == NULL)

src/backend/optimizer/util/clauses.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1582,7 +1582,7 @@ find_nonnullable_rels_walker(Node *node, bool top_level)
15821582
* the intersection of the sets of nonnullable rels, just as
15831583
* for OR. Fall through to share code.
15841584
*/
1585-
/* FALLTHROUGH */
1585+
/* FALL THRU */
15861586
case OR_EXPR:
15871587

15881588
/*
@@ -1807,7 +1807,7 @@ find_nonnullable_vars_walker(Node *node, bool top_level)
18071807
* the intersection of the sets of nonnullable vars, just as
18081808
* for OR. Fall through to share code.
18091809
*/
1810-
/* FALLTHROUGH */
1810+
/* FALL THRU */
18111811
case OR_EXPR:
18121812

18131813
/*

src/backend/parser/parse_utilcmd.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column)
737737
errmsg("primary key constraints are not supported on foreign tables"),
738738
parser_errposition(cxt->pstate,
739739
constraint->location)));
740-
/* FALLTHROUGH */
740+
/* FALL THRU */
741741

742742
case CONSTR_UNIQUE:
743743
if (cxt->isforeign)

src/backend/partitioning/partprune.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -2571,7 +2571,7 @@ get_matching_list_bounds(PartitionPruneContext *context,
25712571

25722572
case BTGreaterEqualStrategyNumber:
25732573
inclusive = true;
2574-
/* FALLTHROUGH */
2574+
/* fall through */
25752575
case BTGreaterStrategyNumber:
25762576
off = partition_list_bsearch(partsupfunc,
25772577
partcollation,
@@ -2606,7 +2606,7 @@ get_matching_list_bounds(PartitionPruneContext *context,
26062606

26072607
case BTLessEqualStrategyNumber:
26082608
inclusive = true;
2609-
/* FALLTHROUGH */
2609+
/* fall through */
26102610
case BTLessStrategyNumber:
26112611
off = partition_list_bsearch(partsupfunc,
26122612
partcollation,
@@ -2853,7 +2853,7 @@ get_matching_range_bounds(PartitionPruneContext *context,
28532853

28542854
case BTGreaterEqualStrategyNumber:
28552855
inclusive = true;
2856-
/* FALLTHROUGH */
2856+
/* fall through */
28572857
case BTGreaterStrategyNumber:
28582858

28592859
/*
@@ -2934,7 +2934,7 @@ get_matching_range_bounds(PartitionPruneContext *context,
29342934

29352935
case BTLessEqualStrategyNumber:
29362936
inclusive = true;
2937-
/* FALLTHROUGH */
2937+
/* fall through */
29382938
case BTLessStrategyNumber:
29392939

29402940
/*

src/backend/postmaster/postmaster.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -5902,19 +5902,19 @@ bgworker_should_start_now(BgWorkerStartTime start_time)
59025902
case PM_RUN:
59035903
if (start_time == BgWorkerStart_RecoveryFinished)
59045904
return true;
5905-
/* FALLTHROUGH */
5905+
/* fall through */
59065906

59075907
case PM_HOT_STANDBY:
59085908
if (start_time == BgWorkerStart_ConsistentState)
59095909
return true;
5910-
/* FALLTHROUGH */
5910+
/* fall through */
59115911

59125912
case PM_RECOVERY:
59135913
case PM_STARTUP:
59145914
case PM_INIT:
59155915
if (start_time == BgWorkerStart_PostmasterStart)
59165916
return true;
5917-
/* FALLTHROUGH */
5917+
/* fall through */
59185918

59195919
}
59205920

0 commit comments

Comments
 (0)