I noticed in CI builds of PL/Java with PG 13 that -Wimplicit-fallthrough=3 in pg_config's CFLAGS was causing some switch case fallthrough warnings after an elog(ERROR. [1]
I added my own pg_unreachable() after the elog(ERROR, ...) calls [2] and that did away with the warnings. But it looks odd, and shouldn't it be unnecessary if elog is supplying its own pg_unreachable() in the elevel >= ERROR case? [3] Has anyone else seen this behavior? Am I doing something that stops gcc from recognizing ERROR as a compile-time constant? Is it just a gcc bug? (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 seems to be the gcc version on the Travis runner. Regards, -Chap [1] https://travis-ci.com/github/tada/pljava/jobs/447208803#L694 AFAICT, the #L694 doesn't really take you to line 694 in a Travis log because they collapse lines so the browser will not see the anchor, so one must click to expand the containing line range first. Irksome. Copied below. [2] https://github.com/tada/pljava/blame/2c8d992/pljava-so/src/main/c/type/Type.c#L246 [3] https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/include/utils/elog.h;h=a16f925#l104 In file included from /usr/include/postgresql/13/server/postgres.h:47:0, from /home/travis/build/tada/pljava/pljava-so/src/main/c/type/Type.c:13: /usr/include/postgresql/13/server/utils/elog.h:125:5: warning: this statement may fall through [-Wimplicit-fallthrough=] do { \ ^ /usr/include/postgresql/13/server/utils/elog.h:145:2: note: in expansion of macro ‘ereport_domain’ ereport_domain(elevel, TEXTDOMAIN, __VA_ARGS__) ^~~~~~~~~~~~~~ /usr/include/postgresql/13/server/utils/elog.h:215:2: note: in expansion of macro ‘ereport’ ereport(elevel, errmsg_internal(__VA_ARGS__)) ^~~~~~~ /home/travis/build/tada/pljava/pljava-so/src/main/c/type/Type.c:256:3: note: in expansion of macro ‘elog’ elog(ERROR, "COERCEVIAIO not implemented from (regtype) %d to %d", ^~~~ /home/travis/build/tada/pljava/pljava-so/src/main/c/type/Type.c:258:2: note: here case COERCION_PATH_ARRAYCOERCE: ^~~~