[LLVMdev] Compiling LLVM 2.7 with Visual Studio 2010.

Török Edwin edwintorok at gmail.com
Sun May 2 00:13:28 PDT 2010


On 05/02/2010 06:57 AM, Tom van Dijck wrote:
> Last there is a gazillion errors around the fact that Microsoft for some
> crazy stupid reason has defined setjmp to _setjmp, and thus the
> generated intrinsics.gen goes completely insane everywhere. I'm sure
> this is a legacy thing in visual studios libraries, but wow...

In LowerInvoke.cpp change this:
#if defined(_MSC_VER) && defined(setjmp)
#define setjmp_undefined_for_visual_studio
#undef setjmp
#endif

to this:
#if defined(_MSC_VER) && defined(setjmp) && _MSC_VER < 600
#define setjmp_undefined_for_visual_studio
#undef setjmp
#endif

Apparently setjmp IS defined to _setjmp everywhere, so if we don't undef
it, everything "just works".

There was also an error about next() being ambigous in one file (don't
remember which one right now), changing that to llvm::next() worked.

As for the null pointer issue, I only encountered it in 2 places in
llvm, an explicit cast of 0, or a helper variable of the correct type
helped.


> 
> Anyway, my solution to this was to make a 'intrinsics.gen.proxy', which
> undefs that macro and then includes the intrinsics.gen, and then all
> includes to intrinsics.gen, I modified to include the proxy. This
> guarantees that at least the Instrinsic namespace is always setup
> correctly... and you're left with a couple other files where it still
> seems to be defined, so I just undef'ed it for the whole file in those
> files as well...
> 
> Is there any interest in these changes applied to trunk? and if so how
> do I proceed... I'm fine keeping these changes local and integrate, but
> I figure there is more users out there wanting to move to VS2010 at some
> point.

Yes please apply to trunk if it doesn't break anything, and if the
changes aren't too big (I don' think you need to replace all 0 with
null, just the ones that cause problems).

Best regards,
--Edwin



More information about the llvm-dev mailing list