[Bug 38337] clang compiling warnings

wine-bugs at winehq.org wine-bugs at winehq.org
Tue Nov 10 22:23:15 CST 2015


https://bugs.winehq.org/show_bug.cgi?id=38337

--- Comment #7 from Sergey Isakov <isakov-sl at bk.ru> ---
About abs(unsinged). This is Clang bad alarm.
Test snippet
------
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
  unsigned int x = 3, y = 5, z;
    z = x - y;
  printf(" results: %d, abs=%d\n", z, abs(z));
}
---------
Results:
--------
iMac:2 sergey$ llvm-clang test_unsigned.c -o test2
test_unsigned.c:9:39: warning: taking the absolute value of unsigned type
'unsigned int'
      has no effect [-Wabsolute-value]
  printf(" results: %d, abs=%d\n", z, abs(z));
                                      ^
test_unsigned.c:9:39: note: remove the call to 'abs' since unsigned values
cannot be
      negative
  printf(" results: %d, abs=%d\n", z, abs(z));
                                      ^~~
1 warning generated.
iMac:2 sergey $ ./test2
 results: -2, abs=2
iMac:2 sergey $ 
---------
So there will be no problem.
Should set a flag -Wno-absolute-value

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list