[llvm-commits] [ASan] Make for-Windows RTL compileable using Clang++ (issue 6214063)

Anton Korobeynikov anton at korobeynikov.info
Mon May 21 07:27:10 PDT 2012


Timur,

> On Mon, May 21, 2012 at 6:03 PM, Anton Korobeynikov
> <anton at korobeynikov.info> wrote:
>>> -#ifdef _WIN32
>>> +#if defined(_WIN32) && !defined(__clang__)
>>>  #include <intrin.h>
>>>  #endif
>> I think it should check for _MSC_VER here instead. And in many other
>> places as well.
> Clang defines _MSC_VER on Windows:
> $ clang++ -dM -E -xc empty | grep MSC
> #define _MSC_EXTENSIONS 1
> #define _MSC_VER 1300

Ok, it seems that the following scenarios are possible:

1. clang on non-windows (or gcc, this should not matter, in theory)
2. clang on windows with ms extensions enabled
3. clang on windows w/o ms extensions enabled
4. MS VC on windows

For me it seems you're trying to "unify" 4 and 2 in MS-way - with
confusing defines (_WIN32 defined in _WIN64 mode as well), etc. The 3
as it seems to me is not supported as well.
It's surely up to you, but maybe there is better way to untangle all
the mess? For example, LLVM itself has portability layer which seems
to contain bunch of stuff you're using in asan.
Maybe you can consider looking there and "steal" some design ideas
from there? Check e.g. Support/DataTypes.h, Support/MathExtras.h,
etc...

-- 
With best regards, Anton Korobeynikov
Faculty of Mathematics and Mechanics, Saint Petersburg State University




More information about the llvm-commits mailing list