[PATCH] D39462: [Sema] Implement -Wmaybe-tautological-constant-compare for when the tautologicalness is data model dependent

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 11 13:22:19 PST 2017

lebedev.ri added a comment.

In https://reviews.llvm.org/D39462#917421, @rjmccall wrote:

> So, that change makes this very interesting, because I think the right way of looking at it is as the first in a larger family of warnings that attempt to treat typedefs as if they were a much stronger type-system feature, i.e. that warn about all sorts of conversions between different typedef types.  That should be good enough to serve as a basic rule for a stronger portability warning, as well as generally pointing out all sorts of potential logical errors like passing a bit_offset_t off as a byte_offset_t.
> Such a warning really needs more exceptions than a simple exact-type-spelling rule would give you.  There are several language features that add type sugar which should really be ignored for the purposes of the warning, such as typeof and decltype; and conversely, there are several features that remove (or just never add) type sugar that also shouldn't cause problems, like literals or C++ templates.
> I think that feature could be really useful as a major new diagnostic

That is all very cool and shiny, but could we please go back to the real world, please? :)

In https://reviews.llvm.org/D39462#917421, @rjmccall wrote:

> but I do want to warn you that it's probably a pretty large project, somewhat on the scale of implementing -Wconversion in the first place.

Exactly. My expirience shows that unless i'm actually interested, i will either fail, or it will work poorly.
And i can tell you that i'm not quite interested in implementing what you seem to suggest to implement.

What i would like to do, is to finish *this* differential, that would make https://reviews.llvm.org/D38101 less noisy for some questionable edge-cases,

In https://reviews.llvm.org/D39462#917421, @rjmccall wrote:

> a pretty large project, somewhat on the scale of implementing -Wconversion in the first place.

Can that happen? :)

In https://reviews.llvm.org/D39462#917421, @rjmccall wrote:

> Also, yeah, my first thought is that it's probably outside of a reasonable rubric for even -Wextra, especially while it's being actively developed.

For that other diagnostic you suggest - sure.


I think the general direction is correct, but there are unhandled cases yet, e.g , so I'm somewhat lost here, and would love to hear some actual feedback for the suggested code.



More information about the cfe-commits mailing list