[Sema] -Wtautological-compare: handle comparison of unsigned with 0S.
Summary: This is a first half(?) of a fix for the following bug: https://bugs.llvm.org/show_bug.cgi?id=34147 (gcc -Wtype-limits) GCC's -Wtype-limits does warn on comparison of unsigned value with signed zero (as in, with 0), but clang only warns if the zero is unsigned (i.e. 0U). Also, be careful not to double-warn, or falsely warn on comparison of signed/fp variable and signed 0. Yes, all these testcases are needed. Testing: $ ninja check-clang-sema check-clang-semacxx Also, no new warnings for clang stage-2 build. Reviewers: rjmccall, rsmith, aaron.ballman Reviewed By: rjmccall Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D37565 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312750 91177308-0d34-0410-b5e6-96231b3b80d8
Showing
- docs/ReleaseNotes.rst 7 additions, 0 deletionsdocs/ReleaseNotes.rst
- lib/Sema/SemaChecking.cpp 50 additions, 28 deletionslib/Sema/SemaChecking.cpp
- test/Sema/compare.c 3 additions, 3 deletionstest/Sema/compare.c
- test/Sema/outof-range-constant-compare.c 136 additions, 9 deletionstest/Sema/outof-range-constant-compare.c
- test/SemaCXX/compare.cpp 3 additions, 3 deletionstest/SemaCXX/compare.cpp
Loading
Please register or sign in to comment