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

Re: MSVC build broken (on cygwin)

From
Marius Storm-Olsen <marius@storm-olsen.com>
Date
Oct 3, 2009, 20:29 UTC
Message-ID
<4AC7B42B.8020506@gmail.com>
In-Reply-To
<4AC7AEB9.3030404@ramsay1.demon.co.uk>
Ramsay Jones said the following on 03.10.2009 22:06:
Show 14 quoted lines
> Marius Storm-Olsen wrote:
>> 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
> 
> This is a much better idea.
OK, I'll write up a patch, tomorrow or Monday.
...
Show 8 quoted lines
> So, I think something like this in git-compat-util.h:
> 
> #if defined(_WIN32) && !defined(__CYGWIN__)
> # define WIN32_API
> # define WIN32_LEAN_AND_MEAN
> # include <winsock2.h>
> # include <windows.h>
> #endif
I agree with this one. Send a patch, and I'll ack.
> and replace all #if(n)def WIN32|_WIN32 with #if(n)def WIN32_API.
Ok, I might look into that too then.
> The only use of the <windows.h> header by cygwin can be moved
> into compat/cygwin.c. (I don't much like cygwin using the
> Win32 API anyway!)
I don't have Cygwin installed, so I won't touch this one.
Show 7 quoted lines
>> 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?
> 
> see above. I don't think OS_WINDOWS is necessary.

Well, it was mostly intended where we'd have code/algorithms which are platform specific, and not really compiler specific; such as the *stat() optimizations. They could probably be joined into an OS_WINDOWS section, with a POSIX_API hunk for the Cygwin fallbacks.

Not really important though. Hopefully there won't be too much platform specific stuff anyways.

-- .marius

Previous: Ramsay JonesNext: Ramsay Jones
Message 6 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.