From: Marius Storm-Olsen Date: Fri, 02 Oct 2009 08:49:42 GMT Subject: Re: MSVC build broken (on cygwin) Message-ID: <4AC5BEA6.5000102@gmail.com> In-Reply-To: <81b0412b0910020123j13c74497w874e301c38cddec9@mail.gmail.com> Alex Riesen said the following on 02.10.2009 10:23: > MSVC (all versions) define a compiler specific _MSC_VER, if that's of any use. In this case it was define guards to let both MSVC and MinGW through :) Both use _WIN32 and WIN32, which Cygwin gcc normally doesn't, unless, as Ramsay said, you specify -mno-cygwin, or include windows.h apparently. Maybe we should allow Cygwin to also include the LEAN_AND_MEAN windows.h in git-compat-util.h, and rather fix up the guards to cleanly differ between Cygwin and non-Cygwin on Windows? Apparently, nothing is broken in neither Cygwin, MinGW or MSVC after Ramsays whitespace fix, but I'm sure it might get hairy later, if/when we get more Windows contributions. Keeping the guards right could get tricky. So, something like this maybe, in git-compat-util.h: #if defined(__MINGW32__) || defined(_MSC_VER) # defined API_WIN32 # defined OS_WINDOWS #elif defined(__CYGWIN__) # defined API_POSIX # defined OS_WINDOWS #else # defined API_POSIX #endif So, then we can use #ifdef API_WIN32 when using the Win32 API is the only option/preferred for MinGW or MSVC; and use #ifdef OS_WINDOWS when there are things that affect all the Windows builds. Opinions? -- .marius