Re: A few warnings on Windows
Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>, Michael Paquier <michael@paquier.xyz>
Cc: Thomas Munro <thomas.munro@enterprisedb.com>,
Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2018-05-02T02:55:47Z
Lists: pgsql-hackers
On 5/1/18 16:48, Tom Lane wrote:
> On more or less the same topic, I just scraped all the compiler warnings
> for HEAD from the buildfarm database, and there seem to be a few other
> things worth cleaning up. One that I'm looking at is that recent gcc
> has a -Wimplicit-fallthrough warning for switch branches not separated
> by a "break" or similar. It can be silenced with a comment similar to
> /* FALLTHROUGH */, but we have not been entirely consistent about
> providing such comments. I'm inclined to run around and fix those
> omissions. Perhaps at some point we should have configure turn that
> warning on if available?
I think it's useful, but I have found it a bit fickle at times.
One issue is <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79750>, which
requires this additional patch
diff --git a/src/interfaces/libpq/fe-secure.c
b/src/interfaces/libpq/fe-secure.c
index cfb77f6d85..a39d50ddcf 100644
--- a/src/interfaces/libpq/fe-secure.c
+++ b/src/interfaces/libpq/fe-secure.c
@@ -363,6 +363,7 @@ pqsecure_raw_write(PGconn *conn, const void *ptr,
size_t len)
/* FALL THRU */
#ifdef ECONNRESET
+ /* FALL THRU */
case ECONNRESET:
#endif
printfPQExpBuffer(&conn->errorMessage,
to build warning-free on some systems.
Another issue that has prevented me in the past from taking this too
seriously is requiring breaks after elog(ERROR) calls. I see you bit
the bullet and added those breaks, which is fair enough. But if gcc
ever fixes this bug
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79959), then as new code
gets added without it, users of older compilers will start getting
warnings. So we might have to craft that configure test to detect that
issue when that time comes.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Commits
-
Suppress some compiler warnings in plperl on Windows.
- 0996e4be047f 11.0 landed
-
Fix compiler warning on Windows.
- fe4ecd08d81c 11.0 landed
-
Change SIZEOF_BOOL to 1 for Windows.
- 6fe25c1358a2 11.0 landed
-
Fix some assorted compiler warnings on Windows.
- b2328bf62b64 11.0 landed
-
Clean up warnings from -Wimplicit-fallthrough.
- 41c912cad159 11.0 landed