pgman wrote:
> Andrew Dunstan wrote:
> > >>I think Bruce was mostly trying to make all the similar tests look
> > >>alike.  Also I agree that "if a && !b" is clearer than "if !b && a";
> > >>the latter requires a bit more thought to parse the extent of the !
> > >>operator...
> > >>    
> > >>
> > >
> > >Right, just consistency.
> > >  
> > >
> > 
> > 
> > Ok. I understand now.
> > 
> > I'm not sure exactly what Bruce checked, so I just spent a few cycles 
> > making sure that we did not inadvertantly pick up a define of WIN32 from 
> > windows.h anywhere else. I *think* we are OK on that. However, ISTM this 
> > is a foot just waiting to be shot - in retrospect using WIN32 as our 
> > marker for native Windows, which we do in a great many places (around 
> > 300 by my count) was a less than stellar choice, given that it is 
> > defined by windows.h, and especially since we use that header for Cygwin 
> > as well as for Windows native in a few places.
> 
> The use of WIN32 was because it usually does mean MinGW and Cygwin.  We
> had lots of Cygwin-specific defines in there already so Win32 just means
> both Mingw and Cygwin.  You will see only a few cases where we want
> Mingw and not Cygwin, but in those case we often also want MSVC and
> Borland, so it really is WIN32 && ! __CYGWIN__.  We do have one or two
> tests for __MINGW32__ where we really do want just that.

OK, I am wrong above.  Coding assumes WIN32 is only for port named
WIN32, which is mingw, and for BCC and VCC.  I was not aware Cygwin
defined it at all.  Are we sure it does in a header file?

I wonder if we should just call the port mingw and change the proper
defines to __MINGW__.  We would then create a define called WIN32_NATIVE
that is defined for __MINGW__, BVC and VCC.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Fri, 10 Sep 2004 11:17:33 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: APR 1.0 released
Bruce Momjian wrote:

> OK, I am wrong above.  Coding assumes WIN32 is only for port named
> WIN32, which is mingw, and for BCC and VCC.  I was not aware Cygwin
> defined it at all.  Are we sure it does in a header file?

The problem is that some pieces of Cygwin code include windows.h, which 
it shouldn't do.  If you fix those places, then there is no problem.  

> I wonder if we should just call the port mingw and change the proper
> defines to __MINGW__.  We would then create a define called
> WIN32_NATIVE that is defined for __MINGW__, BVC and VCC.

WIN32 is the correct symbol; see above.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/


Fri, 10 Sep 2004 17:43:11 +0200
Peter Eisentraut <peter_e@gmx.net>
Re: APR 1.0 released
Peter Eisentraut wrote:
> Bruce Momjian wrote:
> 
> > OK, I am wrong above.  Coding assumes WIN32 is only for port named
> > WIN32, which is mingw, and for BCC and VCC.  I was not aware Cygwin
> > defined it at all.  Are we sure it does in a header file?
> 
> The problem is that some pieces of Cygwin code include windows.h, which 
> it shouldn't do.  If you fix those places, then there is no problem.  

There are alot of windows.h includes:

	/include/port/win32.h:7:#include <windows.h>
	/port/crypt.c:56:#include <windows.h>
	/port/dirmod.c:45:#include <windows.h>
	/port/dirmod.c:405:#include <windows.h>
	/port/open.c:16:#include <windows.h>
	/port/sprompt.c:35:#include <windows.h>
	/timezone/zic.c:22:#include <windows.h>
	/utils/dllinit.c:44:#include <windows.h>
	/bin/pgevent/pgevent.c:15:#include "windows.h"
	/bin/psql/input.c:14:#include <windows.h>
	/bin/psql/mbprint.c:18:#include <windows.h>
	/bin/psql/startup.c:16:#include <windows.h>
	/interfaces/libpq/libpqdll.c:3:#include <windows.h>
	/interfaces/libpq/pthread-win32.c:14:#include "windows.h"
	/interfaces/libpq/win32.c:30:#include <windows.h>
	/backend/port/dynloader/win32.c:3:#include <windows.h>


and I bet some of the system includes that we use call windows.h
themselves.


> > I wonder if we should just call the port mingw and change the proper
> > defines to __MINGW__.  We would then create a define called
> > WIN32_NATIVE that is defined for __MINGW__, BVC and VCC.
> 
> WIN32 is the correct symbol; see above.

I hope you are right.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Fri, 10 Sep 2004 11:55:46 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: APR 1.0 released
Bruce Momjian wrote:
> There are alot of windows.h includes:

... and most of them are redundant because it is already included via 
c.h.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/


Fri, 10 Sep 2004 18:03:15 +0200
Peter Eisentraut <peter_e@gmx.net>
Re: APR 1.0 released
Peter Eisentraut wrote:
> Bruce Momjian wrote:
> > There are alot of windows.h includes:
> 
> ... and most of them are redundant because it is already included via 
> c.h.

Right, but we only include windows.h in Mingw.  Does Cygwin need it?

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Fri, 10 Sep 2004 12:13:58 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: APR 1.0 released
Bruce Momjian schrieb:
> Peter Eisentraut wrote:
>>Bruce Momjian wrote:
>>
>>>There are alot of windows.h includes:
>>
>>... and most of them are redundant because it is already included via 
>>c.h.
> 
> Right, but we only include windows.h in Mingw.  Does Cygwin need it?

Not really, but it will be lot of new work, which is imho not worth it.

In some places the cygwin section calls WinAPI functions.
It could be worked around by using the posix/cygwin counterparts.

pgsymlink for example.
-- 
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/

Fri, 10 Sep 2004 20:19:07 +0200
Reini Urban <rurban@x-ray.at>
Re: APR 1.0 released


Reini Urban wrote:

> Bruce Momjian schrieb:
>
>> Peter Eisentraut wrote:
>>
>>> Bruce Momjian wrote:
>>>
>>>> There are alot of windows.h includes:
>>>
>>>
>>> ... and most of them are redundant because it is already included 
>>> via c.h.
>>
>>
>> Right, but we only include windows.h in Mingw.  Does Cygwin need it?
>
>
> Not really, but it will be lot of new work, which is imho not worth it.
>
> In some places the cygwin section calls WinAPI functions.
> It could be worked around by using the posix/cygwin counterparts.
>
> pgsymlink for example.


I'm quite certain we can avoid the problem if we are careful. But 
wouldn't it be better to get rid of the problem instead by using some 
other marker?

cheers

andrew

Fri, 10 Sep 2004 14:50:13 -0400
Andrew Dunstan <andrew@dunslane.net>
Re: APR 1.0 released
Andrew Dunstan wrote:
> 
> 
> Reini Urban wrote:
> 
> > Bruce Momjian schrieb:
> >
> >> Peter Eisentraut wrote:
> >>
> >>> Bruce Momjian wrote:
> >>>
> >>>> There are alot of windows.h includes:
> >>>
> >>>
> >>> ... and most of them are redundant because it is already included 
> >>> via c.h.
> >>
> >>
> >> Right, but we only include windows.h in Mingw.  Does Cygwin need it?
> >
> >
> > Not really, but it will be lot of new work, which is imho not worth it.
> >
> > In some places the cygwin section calls WinAPI functions.
> > It could be worked around by using the posix/cygwin counterparts.
> >
> > pgsymlink for example.
> 
> 
> I'm quite certain we can avoid the problem if we are careful. But 
> wouldn't it be better to get rid of the problem instead by using some 
> other marker?

Agreed.  We would never be sure we got them all and new ones didn't get
added in over time.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Fri, 10 Sep 2004 16:26:27 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: APR 1.0 released
Bruce Momjian wrote:
> Peter Eisentraut wrote:
> > Bruce Momjian wrote:
> > > There are alot of windows.h includes:
> >
> > ... and most of them are redundant because it is already included
> > via c.h.
>
> Right, but we only include windows.h in Mingw.

That has nothing to do with my point.

>  Does Cygwin need it?

No, except in well-controlled circumstances.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/


Sat, 11 Sep 2004 00:14:19 +0200
Peter Eisentraut <peter_e@gmx.net>
Re: APR 1.0 released
Peter Eisentraut wrote:
> Bruce Momjian wrote:
> > Peter Eisentraut wrote:
> > > Bruce Momjian wrote:
> > > > There are alot of windows.h includes:
> > >
> > > ... and most of them are redundant because it is already included
> > > via c.h.
> >
> > Right, but we only include windows.h in Mingw.
> 
> That has nothing to do with my point.
> 
> >  Does Cygwin need it?
> 
> No, except in well-controlled circumstances.

OK, so should we remove the redundant windows.h calls and see what
happens?  They are testing on WIN32 anyway so I don't even see how
Cygwin would be hitting them.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Fri, 10 Sep 2004 18:33:17 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: APR 1.0 released