Don't use #if inside function-like macro arguments.
No concrete problem reported, but in the past it's been known to cause problems on some compilers so let's avoid doing that. Reported-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/234364.1626704007%40sss.pgh.pa.us
This commit is contained in:
parent
0d2cb6b2bb
commit
0c08856856
|
@ -1065,13 +1065,7 @@ tryAgain:
|
||||||
*/
|
*/
|
||||||
StaticAssertStmt((PG_O_DIRECT &
|
StaticAssertStmt((PG_O_DIRECT &
|
||||||
(O_APPEND |
|
(O_APPEND |
|
||||||
#if defined(O_CLOEXEC)
|
|
||||||
O_CLOEXEC |
|
|
||||||
#endif
|
|
||||||
O_CREAT |
|
O_CREAT |
|
||||||
#if defined(O_DSYNC)
|
|
||||||
O_DSYNC |
|
|
||||||
#endif
|
|
||||||
O_EXCL |
|
O_EXCL |
|
||||||
O_RDWR |
|
O_RDWR |
|
||||||
O_RDONLY |
|
O_RDONLY |
|
||||||
|
@ -1079,6 +1073,15 @@ tryAgain:
|
||||||
O_TRUNC |
|
O_TRUNC |
|
||||||
O_WRONLY)) == 0,
|
O_WRONLY)) == 0,
|
||||||
"PG_O_DIRECT value collides with standard flag");
|
"PG_O_DIRECT value collides with standard flag");
|
||||||
|
#if defined(O_CLOEXEC)
|
||||||
|
StaticAssertStmt((PG_O_DIRECT & O_CLOEXEC) == 0,
|
||||||
|
"PG_O_DIRECT value collides with O_CLOEXEC");
|
||||||
|
#endif
|
||||||
|
#if defined(O_DSYNC)
|
||||||
|
StaticAssertStmt((PG_O_DIRECT & O_DSYNC) == 0,
|
||||||
|
"PG_O_DIRECT value collides with O_DSYNC");
|
||||||
|
#endif
|
||||||
|
|
||||||
fd = open(fileName, fileFlags & ~PG_O_DIRECT, fileMode);
|
fd = open(fileName, fileFlags & ~PG_O_DIRECT, fileMode);
|
||||||
#else
|
#else
|
||||||
fd = open(fileName, fileFlags, fileMode);
|
fd = open(fileName, fileFlags, fileMode);
|
||||||
|
|
Loading…
Reference in New Issue