[PATCH] D58841: [Diagnostics] Support -Wtype-limits for GCC compatibility

Dávid Bolvanský via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 1 12:40:01 PST 2019


xbolva00 marked an inline comment as done.
xbolva00 added a comment.

Ok, if concers



================
Comment at: clang/include/clang/Basic/DiagnosticGroups.td:485
+// For compatibility with GCC; -Wtype-limits = -Wtautological-constant-in-range-compare
+def TypeLimits : DiagGroup<"type-limits", [TautologicalInRangeCompare]>;
 def TautologicalOutOfRangeCompare : DiagGroup<"tautological-constant-out-of-range-compare">;
----------------
lebedev.ri wrote:
> Is gcc's `-Wtype-limits` *just* `-Wtautological-constant-in-range-compare`, or is something else should be there?
-Wtautological-constant-in-range-compare is enough to diagnose 99% cases from:

https://github.com/gcc-mirror/gcc/blob/41d6b10e96a1de98e90a7c0378437c3255814b16/gcc/testsuite/g%2B%2B.dg/warn/Wtype-limits.C

One missed case is:
int test (int x) 
{
  if ((long long)x <= 0x123456789ABCLL)
    return 1;
  else 
    return 0;
}

Tried -Weverything, no help. We miss this case. I will open PR for that.

But anyway, this missed case should not block this patch.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58841/new/

https://reviews.llvm.org/D58841





More information about the cfe-commits mailing list