Re: APR 1.0 released - Mailing list pgsql-hackers

From Reini Urban
Subject Re: APR 1.0 released
Date
Msg-id 41417107.2080502@x-ray.at
Whole thread Raw
In response to APR 1.0 released  (Gaetano Mendola <mendola@bigfoot.com>)
Responses Re: APR 1.0 released  (Bruce Momjian <pgman@candle.pha.pa.us>)
more dirmod CYGWIN (was: APR 1.0 released)  (Reini Urban <rurban@x-ray.at>)
List pgsql-hackers
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/


pgsql-hackers by date:

Previous
From: Grant Finnemore
Date:
Subject: Failed assertion, CVS head
Next
From: Bruce Momjian
Date:
Subject: Re: psql questions: SQL, progname, copyright dates