Re: VS 2015 support in src/tools/msvc - Mailing list pgsql-hackers

From Christian Ullrich
Subject Re: VS 2015 support in src/tools/msvc
Date
Msg-id AM2PR06MB069012E632FC3C8D1FC8AD6CD46E0@AM2PR06MB0690.eurprd06.prod.outlook.com
Whole thread Raw
In response to Re: VS 2015 support in src/tools/msvc  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: VS 2015 support in src/tools/msvc
List pgsql-hackers
* From: Andrew Dunstan [mailto:andrew@dunslane.net]

> 4. The compiler complains about one of Microsoft's own header files -
> essentially it dislikes the=is construct:
> 
>     typedef enum { ... };
> 
> It would be nice to make it shut up about it.

I doubt that's possible; the declaration *is* wrong after all. We could turn off the warning:

#pragma warning(push)
#pragma warning(disable : 1234, or whatever the number is)
#include <whatever.h>
#pragma warning(pop)

> 5. It also complains about us casting a pid_t to a HANDLE in
> pg_basebackup.c. Not sure what to do about that.

The thing that's being cast is not a PID, but a HANDLE to a process. pid_t is a typedef for int (in port/win32.h),
thereforeis always 32 bits, while HANDLE is actually void*. However, Microsoft guarantees that kernel32 HANDLEs (this
includesthose to threads and processes) fit into 32 bits on AMD64.
 

Source: https://msdn.microsoft.com/en-us/library/windows/desktop/ee872017(v=vs.85).aspx, third bullet point.

So we can simply silence the warning by casting explicitly.

-- 
Christian




pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: kqueue
Next
From: Gavin Flower
Date:
Subject: Re: max_parallel_degree > 0 for 9.6 beta