[PATCH] [Sema] Don't warn if taking the absolute value of a difference of unsigned values.

Charles Davis cdavis5x at gmail.com
Thu Jun 4 17:23:40 PDT 2015


Hi rtrieu,

While any given unsigned value usually cannot be negative, a difference
of two unsigned values can be negative iff the subtrahend (i.e. the
second value) is greater than the minuend. For this reason, it is common
to wrap a difference like this in an abs(3) call. Don't warn on these
cases.

http://reviews.llvm.org/D10263

Files:
  lib/Sema/SemaChecking.cpp
  test/Sema/warn-absolute-value.c
  test/SemaCXX/warn-absolute-value.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10263.27165.patch
Type: text/x-patch
Size: 17066 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150605/368d9ca0/attachment.bin>


More information about the llvm-commits mailing list