aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2013-12-26 23:38:39 +0000
committerNico Weber <nicolasweber@gmx.de>2013-12-26 23:38:39 +0000
commit0e6daefe8f11c7a0e82c5b1455a0ff1d89a986bd (patch)
tree12c00afd7339e39cb79c438eb1cccb3ed4c7d772 /clang/lib/Frontend/CompilerInvocation.cpp
parent63701d2533005555c485569553079f6122430d24 (diff)
downloadllvm-0e6daefe8f11c7a0e82c5b1455a0ff1d89a986bd.zip
llvm-0e6daefe8f11c7a0e82c5b1455a0ff1d89a986bd.tar.gz
llvm-0e6daefe8f11c7a0e82c5b1455a0ff1d89a986bd.tar.bz2
Warn on mismatched parentheses in memcmp and friends.
Thisadds a new warning that warns on code like this: if (memcmp(a, b, sizeof(a) != 0)) The warning looks like: test4.cc:5:30: warning: size argument in 'memcmp' call is a comparison [-Wmemsize-comparison] if (memcmp(a, b, sizeof(a) != 0)) ~~~~~~~~~~^~~~ test4.cc:5:7: note: did you mean to compare the result of 'memcmp' instead? if (memcmp(a, b, sizeof(a) != 0)) ^ ~ ) test4.cc:5:20: note: explicitly cast the argument to size_t to silence this warning if (memcmp(a, b, sizeof(a) != 0)) ^ (size_t)( ) 1 warning generated. This found 2 bugs in chromium and has 0 false positives on both chromium and llvm. The idea of triggering this warning on a binop in the size argument is due to rnk. llvm-svn: 198063
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions