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
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073