[LLVMdev] Advice on a VStudio specific patch
Chris Lattner
sabre at nondot.org
Thu May 31 17:21:00 PDT 2007
On Thu, 31 May 2007, Chuck Rose III wrote:
> Here are the two problem areas:
> RegisterInfoEmitter.cpp
> // Emit the subregister + index mapping function based on the
> information
> // calculated above.
> OS << "unsigned " << ClassName
> << "::getSubReg(unsigned RegNo, unsigned Index) const {\n"
> << " switch (RegNo) {\n"
> << " default: abort(); break;\n";
> ...
> OS << " };\n";
> OS << " return 0; // Visual Studio 2005 does not respect the
> no-return semantics of abort\n";
> OS << "}\n\n";
>
> Need this because otherwise the emitted function will fail to compile in
> VStudio.
Ok. For this, I suggest just removing the break after the abort. visual
studio will just think it falls through into the next case, which is
harmless.
> operator also ends up doing B<A in order to check that the comparator
> isn't wonky. And since the B<A function wasn't written in
> PredicateSimplifier.cpp, I needed to add some stuff like this:
>
> // these two together get me the unsigned < Edge operation
> bool operator>(unsigned to) const {
> return To > to;
> }
> There is a similar set of additions for ScopedRange.
Okay, those sound easy and simple to add unconditionally.
> Adding the alternate comparitors and the return won't make things less
> portable, but it does crudify the code somewhat in order to get around
> the limitations of the compiler. Having a bunch of #ifdefs for VStudio
> probably is crudier still, however. :-)
Right, sounds good. Please add them unconditionally, so no #ifdef's
required :)
-Chris
> -----Original Message-----
> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu]
> On Behalf Of Chris Lattner
> Sent: Thursday, May 31, 2007 4:00 PM
> To: LLVM Developers Mailing List
> Subject: Re: [LLVMdev] Advice on a VStudio specific patch
>
> On Thu, 31 May 2007, Chuck Rose III wrote:
>> Our project is cross platform and on Windows we use VStudio 2005.
>> VStudio presents a couple of issues related around it's STL
>> implementation and also it's non-respect for the no-return semantic of
>> abort().
>
> Ok. We want the source to be portable, so it's goodness to get these
> fixes into the main tree.
>
>> I've fixed it locally, but I'd like to send a patch so I don't have to
>> do this every time I update from the source repository. So.... if I'm
>> fixing something for a specific compiler, do you think I should just
> do
>> so for all compilers or should I put the differences in a #ifdef check
>> for VStudio?
>
> Can you send one example of what you're thinking of? We prefer to keep
> the main code #ifdef free, moving compiler-specific code to
> include/llvm/Support/Compiler.h. Depending on what you mean, this may
> or
> may not make sense though :)
>
> -Chris
>
>
-Chris
--
http://nondot.org/sabre/
http://llvm.org/
More information about the llvm-dev
mailing list