[PATCH] [libcxx] Distinguish between MSVC, MSVCRT, and Windows-specific code
Nico Rieck
nico.rieck at gmail.com
Thu Aug 8 19:13:58 PDT 2013
On 09.08.2013 03:46, G M wrote:
> The files appear to have code for _MSC_VER, where some of that means "not
> for clang, but for ms's compiler cl.exe only.". Other code might be for
> clang++ when it's compiling against Mingw etc.
_MSC_VER is now only used in __config to set _LIBCPP_MSVC.
_MSC_VER is defined by an MSVC-built clang by default, and it can be
controlled using -fmsc-version=V (with V being the version, and 0 to
undefine). MSVC always defines _MSC_VER. Mingw does not define it.
> clang's new clang-cl.exe driver apears to NOT define _MSC_VER by default
> either. If any clang variant or g++ does define _MSC_VER (I don't mean MS's
> cl.exe which I know does)
Sounds like a bug.
The categorization done by that patch should be fine. What's broken is
always using the MSVCRT on Windows. Mingw most likely uses its own C
runtime. Please try the following:
In __config, replace
#define _LIBCPP_MSVCRT
with
#ifndef __GNUC__
#define _LIBCPP_MSVCRT
#endif
With Mingw, this will exclude all compatibility code for Microsoft's C
Runtime and restore the previous behavior. Also, is your clang
mingw-built, and does it define __GNUC__ by default? You can check that
with 'echo "" | clang -dM -E -'. If not, the check might have to be
extended.
-Nico
More information about the cfe-commits
mailing list