git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: MSVC build broken (on cygwin)

From
Marius Storm-Olsen <mstormo@gmail.com>
Date
Oct 2, 2009, 08:49 UTC
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

Previous: Alex RiesenNext: Ramsay Jones
Message 4 of 7 in “MSVC build broken (on cygwin)”
  1. Ramsay JonesOct 1, 2009
  2. Marius Storm-OlsenOct 2, 2009
  3. Alex RiesenOct 2, 2009
  4. Marius Storm-OlsenOct 2, 2009
  5. Ramsay JonesOct 3, 2009
  6. Marius Storm-OlsenOct 3, 2009
  7. Ramsay JonesOct 3, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.