[PATCH] D65192: [Sema] Disable some enabled-by-default -Wparentheses diagnostics

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 29 19:19:52 PDT 2019


MaskRay marked an inline comment as done.
MaskRay added inline comments.


================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:5654-5656
 def warn_addition_in_bitshift : Warning<
   "operator '%0' has lower precedence than '%1'; "
+  "'%1' will be evaluated first">, InGroup<ShiftOpParentheses>, DefaultIgnore;
----------------
rsmith wrote:
> Do you have evidence that this warning has a significant false-positive rate? In my experience it's very common for people to think of `<<` as being a multiplication-like operator and be surprised when it turns out to have lower precedence than addition.
warn_addition_in_bitshift has many false positives. Some results when searching for `[-Wshift-op-parentheses]` and the most common diagnostic `operator '<<' has lower precedence than '+'; '+' will be evaluated first`: 

https://gitship.com/srutscher/pdp-6-emulator/blob/f41b119eee2f409ea519b15f3a76cfecb70c03d8/emu/Makefile
https://www.openwall.com/lists/musl/2014/04/04/12
https://salmonella-freebsd-x86-64.call-cc.org/chicken-4/clang/freebsd/x86-64/2018/06/21/salmonella-report/install/bvsp-spline.html
https://software.intel.com/en-us/forums/intel-threading-building-blocks/topic/431422
https://github.com/rdkit/rdkit/issues/145
ffmpeg https://bugs.freebsd.org/bugzilla/show_bug.cgi?format=multiple&id=191743
https://clang.debian.net/logs/2015-03-25/fairymax_4.8v-1_unstable_clang.log



Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65192/new/

https://reviews.llvm.org/D65192





More information about the cfe-commits mailing list