[PATCH] D53488: [clang-tidy] Catching narrowing from double to float.

Guillaume Chatelet via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 25 07:42:17 PDT 2018


gchatelet marked 2 inline comments as done.
gchatelet added a comment.

In https://reviews.llvm.org/D53488#1274205, @JonasToth wrote:

> Did you run this code over a real-world code-base and did you find new stuff and/or false positives or the like?


Yes I did run it over our code base. I didn't find false positive but 98% of the warnings are from large generated lookup table initializers, e.g. `const static float kTable[] = {0.0, 2.0, ... };`
Since every number in the list triggers the warning, it accounts for most of them.

I scrutinized a few hundreds of the rest: none were actual bugs (although it's hard to tell sometimes), most are legit like `float value = 0.0;` but I also found some oddities <https://github.com/ARM-software/astc-encoder/blob/master/Source/vectypes.h#L13999> from generated headers.

To me the warnings are useful and if it were my code I'd be willing to fix them. That said, I'd totally understand that many people would find them useless or annoying.
What do you think? Shall we still commit this as is?


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D53488





More information about the cfe-commits mailing list