[LLVMdev] Visual Studio 2010 build warning & errors

Nathan Jeffords blunted2night at gmail.com
Thu Sep 23 09:18:57 PDT 2010


On Thu, Sep 23, 2010 at 4:04 AM, Michael Spencer <bigcheesegs at gmail.com>wrote:

> On Thu, Sep 23, 2010 at 2:40 AM, Nathan Jeffords
> <blunted2night at gmail.com> wrote:
> > here are a couple of patches to address some warnings
> > in Microsoft compilers, and a build error in vs2010 in particular
> > vs2010-errors.patch:
> > In SelectionDAGISel,  std::pairs or pointers are being constructed using
> a 0
> > as an initializer causes an error inside the std::pair constructor. I
> think
> > changes to language in support of the nullptr keyword caused this break.
>
> Yep, people keep doing this. I've been behind on the trunk for a bit,
> but I was surprised to see this come up again. This is the correct
> fix, but please make sure you stick within 80 cols.
>
> > vs2010-warnings.patch:
> > This patch fixes a couple of annoying warnings that show up all over the
> > place because they are in headers. At least for Microsoft compilers,
> > conversion of a int to bool requires the compiler to convert non-zero to
> one
> > and so the compiler warns of the performance issue. My fix is to
> explicitly
> > perform the conversion so the compiler knows I'm aware and doesn't warn
> me.
> > I don't know the behavior of other compilers in this respect, so I don't
> > know if it should be committed. The other solution would be to change the
> > return type of the accessors function to return ints, though this could
> move
> > the warning elsewhere.
> > -Nathan
>
> This fix looks like a case of 3am programming. I think using
> static_cast<bool> is clearer.
>
> - Michael Spencer
>

here are updated versions

- Nathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100923/6d665e3f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vs2010-errors.patch
Type: application/octet-stream
Size: 1754 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100923/6d665e3f/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vs2010-warnings.patch
Type: application/octet-stream
Size: 1067 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100923/6d665e3f/attachment-0001.obj>


More information about the llvm-dev mailing list