aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2018-05-01 19:35:08 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2018-05-01 19:35:08 -0400
commit41c912cad15955b5f9270ef3688a44e91d410d3d (patch)
tree829397c0ab0c3fdd1863b3ddc9cd9caffc5a3729 /src/backend/executor
parent1667148a4dd98cea28b8b53d57dbc1eece1b0b5c (diff)
downloadpostgresql-41c912cad15955b5f9270ef3688a44e91d410d3d.tar.gz
postgresql-41c912cad15955b5f9270ef3688a44e91d410d3d.zip
Clean up warnings from -Wimplicit-fallthrough.
Recent gcc can warn about switch-case fall throughs that are not explicitly labeled as intentional. This seems like a good thing, so clean up the warnings exposed thereby by labeling all such cases with comments that gcc will recognize. In files that already had one or more suitable comments, I generally matched the existing style of those. Otherwise I went with /* FALLTHROUGH */, which is one of the spellings approved at the more-restrictive-than-default level -Wimplicit-fallthrough=4. (At the default level you can also spell it /* FALL ?THRU */, and it's not picky about case. What you can't do is include additional text in the same comment, so some existing comments containing versions of this aren't good enough.) Testing with gcc 8.0.1 (Fedora 28's current version), I found that I also had to put explicit "break"s after elog(ERROR) or ereport(ERROR); apparently, for this purpose gcc doesn't recognize that those don't return. That seems like possibly a gcc bug, but it's fine because in most places we did that anyway; so this amounts to a visit from the style police. Discussion: https://postgr.es/m/15083.1525207729@sss.pgh.pa.us
Diffstat (limited to 'src/backend/executor')
-rw-r--r--src/backend/executor/execMain.c1
-rw-r--r--src/backend/executor/execReplication.c2
-rw-r--r--src/backend/executor/nodeLockRows.c1
-rw-r--r--src/backend/executor/nodeModifyTable.c2
4 files changed, 6 insertions, 0 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index 51d5bd01d38..3d12f9c76fd 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -2741,6 +2741,7 @@ EvalPlanQualFetch(EState *estate, Relation relation, int lockmode,
case HeapTupleInvisible:
elog(ERROR, "attempted to lock invisible tuple");
+ break;
default:
ReleaseBuffer(buffer);
diff --git a/src/backend/executor/execReplication.c b/src/backend/executor/execReplication.c
index 0333ccd0fed..4fbdfc0a099 100644
--- a/src/backend/executor/execReplication.c
+++ b/src/backend/executor/execReplication.c
@@ -202,6 +202,7 @@ retry:
goto retry;
case HeapTupleInvisible:
elog(ERROR, "attempted to lock invisible tuple");
+ break;
default:
elog(ERROR, "unexpected heap_lock_tuple status: %u", res);
break;
@@ -365,6 +366,7 @@ retry:
goto retry;
case HeapTupleInvisible:
elog(ERROR, "attempted to lock invisible tuple");
+ break;
default:
elog(ERROR, "unexpected heap_lock_tuple status: %u", res);
break;
diff --git a/src/backend/executor/nodeLockRows.c b/src/backend/executor/nodeLockRows.c
index ace126cbf24..30de8a95ab8 100644
--- a/src/backend/executor/nodeLockRows.c
+++ b/src/backend/executor/nodeLockRows.c
@@ -256,6 +256,7 @@ lnext:
case HeapTupleInvisible:
elog(ERROR, "attempted to lock invisible tuple");
+ break;
default:
elog(ERROR, "unrecognized heap_lock_tuple status: %u",
diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c
index 71314e73bcf..c4c841cdd79 100644
--- a/src/backend/executor/nodeModifyTable.c
+++ b/src/backend/executor/nodeModifyTable.c
@@ -1390,6 +1390,7 @@ ExecOnConflictUpdate(ModifyTableState *mtstate,
/* This shouldn't happen */
elog(ERROR, "attempted to lock invisible tuple");
+ break;
case HeapTupleSelfUpdated:
@@ -1399,6 +1400,7 @@ ExecOnConflictUpdate(ModifyTableState *mtstate,
* seen this row to conflict with.
*/
elog(ERROR, "unexpected self-updated tuple");
+ break;
case HeapTupleUpdated:
if (IsolationUsesXactSnapshot())