Re: MSVC build broken (on cygwin)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]