Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb8d8a45

Browse files
committed
windows: Set UMDF_USING_NTSTATUS globally, include ntstatus.h
We'd like to use precompiled headers on windows to reduce compile times. Rightnow we rely on defining UMDF_USING_NTSTATUS before including postgres.h in a fewselect places - which doesn't work with precompiled headers. Instead defineit 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 wouldbe 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 increasecompile times measurably.Reviewed-by: Thomas Munro <thomas.munro@gmail.com>Discussion:https://postgr.es/m/20220927011951.j3h4o7n6bhf7dwau@awork3.anarazel.de
1 parenta1b3bca commitb8d8a45

File tree

6 files changed

+9
-14
lines changed

6 files changed

+9
-14
lines changed

‎src/include/port/win32_port.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,21 @@
4848
* significantly. WIN32_LEAN_AND_MEAN reduces that a bit. It'd be better to
4949
* remove the include of windows.h (as well as indirect inclusions of it) from
5050
* such a central place, but until then...
51+
*
52+
* To be able to include ntstatus.h tell windows.h to not declare NTSTATUS by
53+
* temporarily defining UMDF_USING_NTSTATUS, otherwise we'll get warning about
54+
* macro redefinitions, as windows.h also defines NTSTATUS (yuck). That in
55+
* turn requires including ntstatus.h, winternl.h to get common symbols.
5156
*/
5257
#defineWIN32_LEAN_AND_MEAN
58+
#defineUMDF_USING_NTSTATUS
5359

5460
#include<winsock2.h>
5561
#include<ws2tcpip.h>
5662
#include<windows.h>
63+
#include<ntstatus.h>
64+
#include<winternl.h>
65+
5766
#undef small
5867
#include<process.h>
5968
#include<signal.h>

‎src/include/port/win32ntdll.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@
1414
#ifndefWIN32NTDLL_H
1515
#defineWIN32NTDLL_H
1616

17-
/*
18-
* Because this includes NT headers that normally conflict with Win32 headers,
19-
* any translation unit that includes it should #define UMDF_USING_NTSTATUS
20-
* before including <windows.h>.
21-
*/
22-
2317
#include<ntstatus.h>
2418
#include<winternl.h>
2519

‎src/port/open.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
#ifdefWIN32
1515

16-
#defineUMDF_USING_NTSTATUS
17-
1816
#ifndefFRONTEND
1917
#include"postgres.h"
2018
#else

‎src/port/win32fdatasync.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
*-------------------------------------------------------------------------
1212
*/
1313

14-
#defineUMDF_USING_NTSTATUS
15-
1614
#ifdefFRONTEND
1715
#include"postgres_fe.h"
1816
#else

‎src/port/win32ntdll.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
*-------------------------------------------------------------------------
1414
*/
1515

16-
#defineUMDF_USING_NTSTATUS
17-
1816
#include"c.h"
1917

2018
#include"port/win32ntdll.h"

‎src/port/win32stat.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515

1616
#ifdefWIN32
1717

18-
#defineUMDF_USING_NTSTATUS
19-
2018
#include"c.h"
2119
#include"port/win32ntdll.h"
2220

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp