mirror of https://github.com/postgres/postgres
windows: Set UMDF_USING_NTSTATUS globally, include ntstatus.h
We'd like to use precompiled headers on windows to reduce compile times. Right now we rely on defining UMDF_USING_NTSTATUS before including postgres.h in a few select places - which doesn't work with precompiled headers. Instead define it globally. When UMDF_USING_NTSTATUS is defined we need to explicitly include ntstatus.h, winternl.h to get a comparable set of symbols. Right now these includes would be required in a number of non-platform-specific .c files - to avoid that, include them in win32_port.h. Based on my measurements that doesn't increase compile times measurably. Reviewed-by: Thomas Munro <thomas.munro@gmail.com> Discussion: https://postgr.es/m/20220927011951.j3h4o7n6bhf7dwau@awork3.anarazel.de
This commit is contained in:
parent
a1b3bca1c8
commit
b8d8a4593a
|
@ -48,12 +48,21 @@
|
||||||
* significantly. WIN32_LEAN_AND_MEAN reduces that a bit. It'd be better to
|
* significantly. WIN32_LEAN_AND_MEAN reduces that a bit. It'd be better to
|
||||||
* remove the include of windows.h (as well as indirect inclusions of it) from
|
* remove the include of windows.h (as well as indirect inclusions of it) from
|
||||||
* such a central place, but until then...
|
* such a central place, but until then...
|
||||||
|
*
|
||||||
|
* To be able to include ntstatus.h tell windows.h to not declare NTSTATUS by
|
||||||
|
* temporarily defining UMDF_USING_NTSTATUS, otherwise we'll get warning about
|
||||||
|
* macro redefinitions, as windows.h also defines NTSTATUS (yuck). That in
|
||||||
|
* turn requires including ntstatus.h, winternl.h to get common symbols.
|
||||||
*/
|
*/
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#define UMDF_USING_NTSTATUS
|
||||||
|
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <ntstatus.h>
|
||||||
|
#include <winternl.h>
|
||||||
|
|
||||||
#undef small
|
#undef small
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
|
@ -14,12 +14,6 @@
|
||||||
#ifndef WIN32NTDLL_H
|
#ifndef WIN32NTDLL_H
|
||||||
#define WIN32NTDLL_H
|
#define WIN32NTDLL_H
|
||||||
|
|
||||||
/*
|
|
||||||
* Because this includes NT headers that normally conflict with Win32 headers,
|
|
||||||
* any translation unit that includes it should #define UMDF_USING_NTSTATUS
|
|
||||||
* before including <windows.h>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <ntstatus.h>
|
#include <ntstatus.h>
|
||||||
#include <winternl.h>
|
#include <winternl.h>
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,6 @@
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|
||||||
#define UMDF_USING_NTSTATUS
|
|
||||||
|
|
||||||
#ifndef FRONTEND
|
#ifndef FRONTEND
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define UMDF_USING_NTSTATUS
|
|
||||||
|
|
||||||
#ifdef FRONTEND
|
#ifdef FRONTEND
|
||||||
#include "postgres_fe.h"
|
#include "postgres_fe.h"
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -13,8 +13,6 @@
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define UMDF_USING_NTSTATUS
|
|
||||||
|
|
||||||
#include "c.h"
|
#include "c.h"
|
||||||
|
|
||||||
#include "port/win32ntdll.h"
|
#include "port/win32ntdll.h"
|
||||||
|
|
|
@ -15,8 +15,6 @@
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|
||||||
#define UMDF_USING_NTSTATUS
|
|
||||||
|
|
||||||
#include "c.h"
|
#include "c.h"
|
||||||
#include "port/win32ntdll.h"
|
#include "port/win32ntdll.h"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue