Web lists-archives.com

Re: [Mingw-users] best value for guarding MinGW patches




> From: David Gressett <DGressett@xxxxxxxxxxxxxxx>
> Date: Sun, 30 Apr 2017 19:28:15 -0500
> 
> I have been doing test builds of the gcc 7 release candidates and 
> have found and fixed a problem in the c++ run-time library that
> crashes the build.
> 
> I want to submit a patch to the upstream gcc that will 
> 
> A: isolate the MinGW-specific patch from other build environments
> 
> and
> 
> B: not require any modifications/improvements  by the upstream
> gcc crew, as that would almost certainly mean that it would not
> get into the upcoming release.
> 
> What is the best #ifdef or #if defined  value that I can use for this?
> 
> In some of the patches used for the current MinGW gcc 5.3.0,
> I see
> 
> #if defined(_WIN32) 
> 
> Should I go with this or is there a better one?

It depends, but in general, _WIN32 would not by my first choice, for
the simple reason that it also includes Cygwin, which you probably
don't want.  It also includes MSVC builds, although in this case that
possibility is not relevant.

My first choice would be

  #ifdef __MINGW32__

However, there could be complications if the problem you've discovered
is specific to mingw.org's MinGW, and the solution should NOT affect
the MinGW64 build of GCC (because, sadly, their headers and runtime
diverged in subtle but significant ways from mingw.org).  If that is
the case, you will need something more elaborate.  I'm using this:

     #ifdef __MINGW32__
     # include <_mingw.h>
     # ifndef __MINGW64_VERSION_MAJOR
     #  ...mingw.org's MinGW stuff...
     # endif
     #endif

This ugliness is required because MinGW64 doesn't provide any
preprocessor facilities to distinguish it from mingw.org that could be
used without including some standard header file, and they also define
__MINGW32__, so that macro cannot be used for this purpose.

HTH

P.S. Thank you for working on GCC 7; I hope to see its official MinGW
build on a download site near me, soon.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

This list observes the Etiquette found at 
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe