diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2017-10-15 20:13:17 +0000 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2017-10-15 20:13:17 +0000 |
commit | 6de129e710cfb2857064b236e90d53c0c41ea92c (patch) | |
tree | f39f8a781241ff458ddf3ac592e95dcbfd0e36bc /clang/docs | |
parent | ac9309a112197f34319c5063ba3675614de1e04f (diff) | |
download | bcm5719-llvm-6de129e710cfb2857064b236e90d53c0c41ea92c.tar.gz bcm5719-llvm-6de129e710cfb2857064b236e90d53c0c41ea92c.zip |
[Sema] Re-land: Diagnose tautological comparison with type's min/max values
The first attempt, rL315614 was reverted because one libcxx
test broke, and i did not know at the time how to deal with it.
Summary:
Currently, clang only diagnoses completely out-of-range comparisons (e.g. `char` and constant `300`),
and comparisons of unsigned and `0`. But gcc also does diagnose the comparisons with the
`std::numeric_limits<>::max()` / `std::numeric_limits<>::min()` so to speak
Finally Fixes https://bugs.llvm.org/show_bug.cgi?id=34147
Continuation of https://reviews.llvm.org/D37565
Reviewers: rjmccall, rsmith, aaron.ballman
Reviewed By: rsmith
Subscribers: rtrieu, jroelofs, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D38101
llvm-svn: 315875
Diffstat (limited to 'clang/docs')
-rw-r--r-- | clang/docs/ReleaseNotes.rst | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 49c26b449d0..293144a8327 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -78,6 +78,10 @@ Improvements to Clang's diagnostics when the signed integer is coerced to an unsigned type for the comparison. ``-Wsign-compare`` was adjusted not to warn in this case. +- ``-Wtautological-constant-compare`` is a new warning that warns on + tautological comparisons between integer variable of the type ``T`` and the + largest/smallest possible integer constant of that same type. + - ``-Wnull-pointer-arithmetic`` now warns about performing pointer arithmetic on a null pointer. Such pointer arithmetic has an undefined behavior if the offset is nonzero. It also now warns about arithmetic on a null pointer |