aboutsummaryrefslogtreecommitdiff
path: root/contrib
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 /contrib
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 'contrib')
-rw-r--r--contrib/btree_gin/btree_gin.c1
-rw-r--r--contrib/pageinspect/hashfuncs.c4
2 files changed, 5 insertions, 0 deletions
diff --git a/contrib/btree_gin/btree_gin.c b/contrib/btree_gin/btree_gin.c
index d262c18e893..b6d22d2b008 100644
--- a/contrib/btree_gin/btree_gin.c
+++ b/contrib/btree_gin/btree_gin.c
@@ -88,6 +88,7 @@ gin_btree_extract_query(FunctionCallInfo fcinfo,
case BTGreaterEqualStrategyNumber:
case BTGreaterStrategyNumber:
*ptr_partialmatch = true;
+ /* FALLTHROUGH */
case BTEqualStrategyNumber:
entries[0] = datum;
break;
diff --git a/contrib/pageinspect/hashfuncs.c b/contrib/pageinspect/hashfuncs.c
index b48fdfa153b..c49adf207cb 100644
--- a/contrib/pageinspect/hashfuncs.c
+++ b/contrib/pageinspect/hashfuncs.c
@@ -97,18 +97,22 @@ verify_hash_page(bytea *raw_page, int flags)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("page is not a hash meta page")));
+ break;
case LH_BUCKET_PAGE | LH_OVERFLOW_PAGE:
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("page is not a hash bucket or overflow page")));
+ break;
case LH_OVERFLOW_PAGE:
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("page is not a hash overflow page")));
+ break;
default:
elog(ERROR,
"hash page of type %08x not in mask %08x",
pagetype, flags);
+ break;
}
}