OK, moved and comment documents its location.
---------------------------------------------------------------------------
Reini Urban wrote:
> Bruce Momjian schrieb:
> > Andrew Dunstan wrote:
> >>Reini Urban wrote:
> >>>FYI: WIN32 is also defined because <windows.h> is included.
> >>>(/usr/incluse/w32api/windef.h)
> >>>If you want this or that, do proper nesting, and use #else.
> >>>
> >>>
> >>
> >>Ugh, yes. A little experimentation shows that __WIN32__ is defined for
> >>MinGW only, but WIN32 is for both. I wonder how we missed that in
> >>various places. Maybe we need a little audit of the use of WIN32.
> >
> > OK, fixed. We should not be using __WIN32__, just Win32. The proper
> > test is #ifndef __CYGWIN__.
>
> very good. just think of future MSVC versions.
>
> Just one more glitch:
>
> #undef rename
> #undef unlink
>
> has to be defined before #include <unistd.h> on CYGWIN, because
> unistd.h has the declarations for rename and unlink, which are required
> inside the pg versions.
> without the #undef, the macros which rename rename to pgrename, ... are
> still effective, which will lead to undeclared/falsely autodeclared
> rename/unlink parts.
>
> I don't know for mingw, if they need the pgrename/pgunlink declaration.
> For my CYGWIN patch I moved those two lines before #include <unistd.h>.
>
> > ------------------------------------------------------------------------
> >
> > Index: src/port/dirmod.c
> > ===================================================================
> > RCS file: /cvsroot/pgsql-server/src/port/dirmod.c,v
> > retrieving revision 1.23
> > diff -c -c -r1.23 dirmod.c
> > *** src/port/dirmod.c 9 Sep 2004 00:59:49 -0000 1.23
> > --- src/port/dirmod.c 10 Sep 2004 02:44:19 -0000
> > ***************
> > *** 36,45 ****
> > #undef rename
> > #undef unlink
> >
> > ! #ifdef __WIN32__
> > #include <winioctl.h>
> > #else
> > - /* __CYGWIN__ */
> > #include <windows.h>
> > #include <w32api/winioctl.h>
> > #endif
> > --- 36,44 ----
> > #undef rename
> > #undef unlink
> >
> > ! #ifndef __CYGWIN__
> > #include <winioctl.h>
> > #else
> > #include <windows.h>
> > #include <w32api/winioctl.h>
> > #endif
> --
> Reini Urban
> http://xarch.tu-graz.ac.at/home/rurban/
>
--
Bruce Momjian | http://candle.pha.pa.us
[EMAIL PROTECTED] | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Index: src/port/dirmod.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/port/dirmod.c,v
retrieving revision 1.24
diff -c -c -r1.24 dirmod.c
*** src/port/dirmod.c 10 Sep 2004 02:49:37 -0000 1.24
--- src/port/dirmod.c 10 Sep 2004 09:51:12 -0000
***************
*** 21,26 ****
--- 21,32 ----
#include "postgres_fe.h"
#endif
+ /* Don't modify declarations in system headers */
+ #if defined(WIN32) || defined(__CYGWIN__)
+ #undef rename
+ #undef unlink
+ #endif
+
#include <unistd.h>
#include <dirent.h>
#include <sys/stat.h>
***************
*** 33,41 ****
#include "miscadmin.h"
- #undef rename
- #undef unlink
-
#ifndef __CYGWIN__
#include <winioctl.h>
#else
--- 39,44 ----
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly