On 01/25/2013 05:11 PM, Junio C Hamano wrote: > Mark Levedahl writes: > >> Cygwin and Windows should be treated as completely separate platforms: >> if __CYGWIN__ is defined, do one thing, if not, go ahead and check >> WIN32, but the WIN32 macro should never be tested once we know the >> platform is CYGWIN - these really are different platforms (if you are >> unsure of this, consider that Cygwin includes a cross-compiler to >> target native Win32 as the Cygwin maintainers recognized the platforms >> are different). > > Not disagreeing with your conclusion (they should be treated as > different), why does it define WIN32 in the first place? > > Perhaps we would want > > #ifdef __CYGWIN__ > #undef WIN32 > #endif Wouldn't work. Cygwin gcc does NOT define WIN32; rather, the inclusion of a Windows system header (generally discouraged, but sometimes a necessary evil) might cause WIN32 to be defined for all subsequent headers. Which is why other projects, like gnulib, have # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ all over the place. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org