Re: A few warnings on Windows

Thomas Munro <thomas.munro@enterprisedb.com>

From: Thomas Munro <thomas.munro@enterprisedb.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Michael Paquier <michael@paquier.xyz>, Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2018-05-02T01:26:17Z
Lists: pgsql-hackers

Attachments

On Wed, May 2, 2018 at 12:51 PM, Thomas Munro
<thomas.munro@enterprisedb.com> wrote:
> On Wed, May 2, 2018 at 11:39 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> We'll soon find out.
>
> Nope -- and I think that's because we only actually use stdbool.h
> instead of our own macros if we think sizeof(bool) is exactly 1.  But
> we don't because pg_config.h.win32 says:
>
> #define SIZEOF_BOOL 0
>
> Perhaps that's what Peter E meant when he said "Windows could use some
> manual adjustments in pg_config.h.win32 if anyone
> cares"[1].  Should we just change this to 1?  I'm going to go and test
> that now.  From googling sizeof(bool) am aware that ancient VC (before
> 5.0 more than 20 years ago) had a header that defined bool as int, but
> that seems irrelevant now, right?

That compiles and runs the main checks (except tablespace which I
suppress) cleanly for me and I assume it really is using
stdbool.h this time.  Hopefully plperl will be happier this way.

Since my earlier test, a new entirely independent warning arrived with
commit 41c912ca:

  c:\projects\postgres\src\bin\pgbench\pgbench.c(2327): warning C4715:
'evalStandardFunc' : not all control paths return a value
[C:\projects\postgres\pgbench.vcxproj]

Patch for that attached, too.

-- 
Thomas Munro
http://www.enterprisedb.com

Commits

  1. Suppress some compiler warnings in plperl on Windows.

  2. Fix compiler warning on Windows.

  3. Change SIZEOF_BOOL to 1 for Windows.

  4. Fix some assorted compiler warnings on Windows.

  5. Clean up warnings from -Wimplicit-fallthrough.