This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH GOLD] [6/N mingw host] Add support for not keeping the files open on execute
- From: gcgb-binutils at lo dot gmane dot org
- To: Andrew Pinski <Andrew_Pinski at playstation dot sony dot com>
- Cc: binutils <binutils at sourceware dot org>
- Date: Wed, 07 Oct 2009 16:00:30 -0400
- Subject: Re: [PATCH GOLD] [6/N mingw host] Add support for not keeping the files open on execute
- References: <de8d50360910071221n3a4a172ag61d4fd4940ce7fcd@mail.gmail.com>
Andrew Pinski wrote:
> This is the first patch which I could not figure out how to do without
> a #ifdef _WIN32.
This may break cygwin (that is, it may unintentionally cause a gold
built on a cygwin $host to use win32 constructs directly, instead of
going thru the cygwin posix emulation).
You see, ordinarily on cygwin _WIN32 is not defined. However, *if* you
happen to #include <windows.h> on cygwin, *then* _WIN32 is defined for
that translation unit (and sometimes you DO want to #include
<windows.h>, even on cygwin). If you really truly want a block of code
to be active ONLY if mingw, then it's best to use:
#if defined(_WIN32) && !defined(__CYGWIN__)
And, if you want a block of code to be active on the windows platform,
regardless of whether its mingw or cygwin, then
#if defined(_WIN32) || defined(__CYGWIN__)
'Course, that's very ugly -- but then, so is using #ifdef _WIN32 anyway.
--
Chuck