Re: r259271 - Improve -Wconstant-conversion

2016-02-05 Thread Nico Weber via cfe-commits
Thanks! Maybe it's interesting if I list the instances where this fired in Chromium. * libwebp calls _mm_set1_epi16(33050) (but then is careful to only use unsigned intrinsics with this). There's no version of this function that takes unsigned short, so the only thing to change here was to add a

Re: r259271 - Improve -Wconstant-conversion

2016-02-05 Thread Richard Trieu via cfe-commits
r259947 will stop this warning on char arrays. On Mon, Feb 1, 2016 at 1:40 PM, Richard Trieu wrote: > C++11 narrowing only happens during certain conversions while this warning > checks all conversions. > > We might be able to avoid char array initialization, but it would be a > little tricky.

Re: r259271 - Improve -Wconstant-conversion

2016-02-01 Thread Richard Trieu via cfe-commits
C++11 narrowing only happens during certain conversions while this warning checks all conversions. We might be able to avoid char array initialization, but it would be a little tricky. These warning usually have little information about where the conversion is coming from, so distinguishing array

Re: r259271 - Improve -Wconstant-conversion

2016-01-30 Thread Nico Weber via cfe-commits
Shouldn't the new case be in -Wc++11-narrowing instead? This is warning in similar places where that warning used to warn. In practice, char arrays seem to be often used for storing binary blobs in header files, and those are usually initialized with numbers 0...255 instead of -128...127 (why not

r259271 - Improve -Wconstant-conversion

2016-01-29 Thread Richard Trieu via cfe-commits
Author: rtrieu Date: Fri Jan 29 17:51:16 2016 New Revision: 259271 URL: http://llvm.org/viewvc/llvm-project?rev=259271&view=rev Log: Improve -Wconstant-conversion Switch the evaluation from isIntegerConstantExpr to EvaluateAsInt. EvaluateAsInt will evaluate more types of expressions than isIntege