[PATCH] D23921: Remove va_start diagnostic false positive with enumerations

Attila Török via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 20 04:58:57 PST 2016


I did not see that it was reapplied later, sorry.

With clang version 3.9.0 (tags/RELEASE_390/final) I get the warning in both
c11 and c++11 mode.
With clang version 4.0.0 (trunk 290146) (llvm/trunk 290118) it's gone in
c11 mode, but still there in c++11.
The piece of code I tested it on:
https://gist.github.com/torokati44/37e6aca2d516cb7c3cb31b7ccf8a519e

In the part of the code affected by the patch, ED->getPromotionType() is
BuiltinType 'int', and Type is EnumType 'enum E'.
For these two types, Context.typesAreCompatible returns true in c11 mode,
but false in c++11 mode (regardless of which underlying type - or if any -
is specified).
I presume this is the intended behavior. And if so, how could the example
code be modified to make it warning-free in c++, while keeping the
parameter an enum, and not making it a simple int?

Thank you,
Attila

2016-12-19 18:36 GMT+01:00 Aaron Ballman <aaron.ballman at gmail.com>:

> On Fri, Dec 16, 2016 at 7:00 AM, Attila Török via Phabricator
> <reviews at reviews.llvm.org> wrote:
> > torokati44 added a comment.
> >
> > I see this has been reverted in r281612, but I can no longer access the
> build log serving as a reason linked in the message:
> https://www.mail-archive.com/cfe-commits@lists.llvm.org/msg35386.html
> > We have a few false-positive warnings that (I think) would be silenced
> by this change. I'm just wondering if something like this, if not this,
> could be included anyway? Not critical of course, it just would be nice.
>
> This patch was reapplied in r281632:
>
> http://lists.llvm.org/pipermail/cfe-commits/Week-of-
> Mon-20160912/170772.html
>
> Do you still have false positives even with that applied?
>
> Thanks!
>
> ~Aaron
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161220/865b0de8/attachment.html>


More information about the cfe-commits mailing list