git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marius Storm-Olsen <mstormo@gmail.com>
To: Alex Riesen <raa.lkml@gmail.com>
Cc: Ramsay Jones <ramsay@ramsay1.demon.co.uk>,
	GIT Mailing-list <git@vger.kernel.org>,
	"Shawn O. Pearce" <spearce@spearce.org>
Subject: Re: MSVC build broken (on cygwin)
Date: Fri, 02 Oct 2009 10:49:42 +0200	[thread overview]
Message-ID: <4AC5BEA6.5000102@gmail.com> (raw)
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

  reply	other threads:[~2009-10-02  8:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-01 17:11 MSVC build broken (on cygwin) Ramsay Jones
2009-10-02  8:07 ` Marius Storm-Olsen
2009-10-02  8:23   ` Alex Riesen
2009-10-02  8:49     ` Marius Storm-Olsen [this message]
2009-10-03 20:06       ` Ramsay Jones
2009-10-03 20:29         ` Marius Storm-Olsen
2009-10-03 19:36   ` Ramsay Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AC5BEA6.5000102@gmail.com \
    --to=mstormo@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=raa.lkml@gmail.com \
    --cc=ramsay@ramsay1.demon.co.uk \
    --cc=spearce@spearce.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).