[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
Tue Oct 31 13:49:30 PDT 2017


lebedev.ri updated this revision to Diff 121044.
lebedev.ri added a comment.

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

> The actual choice of integer type is not stable across targets any more than the size is.  In practice, people often don't use int and long, they use standard typedefs like size_t and uint64_t, but the actual type chosen for size_t is arbitrary when there are multiple types at that bit-width.


The internal canonical types are compared, so all this `typedef` sugar will be silently ignored.

> So I'm concerned that you're suppressing more than you think here and still not going to satisfy people.

Possibly...
But it will at least make it easier to deal with the most common pattern "that obviously should not warn".
I'd love to hear better ideas

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

> Also, "data model" is not a term in use.  Use "target" or "target platform".


Changed to `for the current target platform, ...`


Repository:
  rL LLVM

https://reviews.llvm.org/D39462

Files:
  docs/ReleaseNotes.rst
  include/clang/Basic/DiagnosticGroups.td
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaChecking.cpp
  test/Sema/maybe-tautological-constant-compare.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39462.121044.patch
Type: text/x-patch
Size: 18236 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171031/2f46ca29/attachment-0001.bin>


More information about the cfe-commits mailing list