[cfe-dev] Extra #defines for Windows SDK 6.0a/VS2008
Douglas Gregor
dgregor at apple.com
Fri Aug 6 06:24:27 PDT 2010
On Aug 6, 2010, at 12:02 PM, per at lumai.se wrote:
> Great, I'm all for setting _INTEGRAL_MAX_BITS. It is defined by the MSVC
> compiler.
I've committed that change in Clang r110442.
> All the mentioned defines are described at
> http://msdn.microsoft.com/en-us/library/b0084kay%28VS.80%29.aspx
> The code (<oaidl.h>) that is fixed by __STDC__ resembles
>
> #if !__STDC__ && (_MSC_VER <= 1000)
> /* Create a struct with a member named "bool" = non-C++ */
> #else
> /* Don't create the offending struct */
> #endif
>
> , so to remedy this either __STDC__ must be defined or _MSC_VER must be
> set to some value such as "1100" which might be weird since it implies
> the presence of the MSVC compiler.
>
> As the page above states, __STDC__ = "Indicates full conformance with
> the ANSI C standard" which is the Microsoft definition of C. My guess is
> that it is _much_ less standardized than clang -strict would imply?
Unfortunately, they only define __STDC__ for C, and we're likely to break something entirely different if we define it for C++.
> The problem is that this is plainly broken code in the SDK. I would not
> suggest allowing "bool" as an identifier even under ms-extensions ;-)
>
> Fiddling with these things is boring but allowing clang to work as a
> drop-in replacement on a wider existing Windows code base would be a
> good thing, at least in my mind.
I wonder how much will break if we start defining _MSC_VER? Does anyone know how mingw deals with this?
- Doug
More information about the cfe-dev
mailing list