From: Sylvestre Ledru Date: Thu, 14 Aug 2014 16:10:10 +0000 (+0000) Subject: Document -Wabsolute-value with example X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7d0ecccb66f8ea0e4a2b98b911a6930c5d038e23;p=clang Document -Wabsolute-value with example git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_35@215652 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst index 995f906534..f12d71ceec 100644 --- a/docs/ReleaseNotes.rst +++ b/docs/ReleaseNotes.rst @@ -70,6 +70,30 @@ about them. The improvements since the 3.4 release include: - New warning `-Wabsolute-value`: Clang warns about incorrect or useless usage of the absolute functions (`abs`, `fabsf`, etc). + .. code-block:: c + + #include + void foo() { + unsigned int i=0; + abs(i); + } + + returns + `warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]` + + or + + .. code-block:: c + + #include + void plop() { + long long i=0; + abs(i); + } + + returns + `warning: absolute value function 'abs' given an argument of type 'long long' but has parameter of type 'int' which may cause truncation of value [-Wabsolute-value] use function 'llabs' instead` + - New warning `-Wtautological-pointer-compare`: .. code-block:: c++