[libcxx] r203126 - Fix a couple of -Wabsolute-value warnings in the libc++ tests

David Blaikie dblaikie at gmail.com
Thu Mar 6 13:03:23 PST 2014


On Thu, Mar 6, 2014 at 12:15 PM, Joerg Sonnenberger
<joerg at britannica.bec.de> wrote:
> On Thu, Mar 06, 2014 at 04:27:18PM -0000, Marshall Clow wrote:
>> Author: marshall
>> Date: Thu Mar  6 10:27:17 2014
>> New Revision: 203126
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=203126&view=rev
>> Log:
>> Fix a couple of -Wabsolute-value warnings in the libc++ tests
>>
>> Modified:
>>     libcxx/trunk/test/depr/depr.c.headers/math_h.pass.cpp
>>     libcxx/trunk/test/numerics/complex.number/complex.transcendentals/atanh.pass.cpp
>>
>> Modified: libcxx/trunk/test/depr/depr.c.headers/math_h.pass.cpp
>> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/depr/depr.c.headers/math_h.pass.cpp?rev=203126&r1=203125&r2=203126&view=diff
>> ==============================================================================
>> --- libcxx/trunk/test/depr/depr.c.headers/math_h.pass.cpp (original)
>> +++ libcxx/trunk/test/depr/depr.c.headers/math_h.pass.cpp Thu Mar  6 10:27:17 2014
>> @@ -82,9 +82,9 @@ void test_exp()
>>  void test_fabs()
>>  {
>>      static_assert((std::is_same<decltype(fabs((double)0)), double>::value), "");
>> -    static_assert((std::is_same<decltype(fabsf(0)), float>::value), "");
>> -    static_assert((std::is_same<decltype(fabsl(0)), long double>::value), "");
>> -    assert(fabs(-1) == 1);
>> +    static_assert((std::is_same<decltype(fabsf(0.f)), float>::value), "");
>> +    static_assert((std::is_same<decltype(fabsl(0.L)), long double>::value), "");
>> +    assert(fabs(-1.f) == 1);
>
> This looks bogus as in: it shouldn't warn here.

What basis did you have in mind? That the constant is in the
representable range for the function being called, even though it's
not of the right type?

Perhaps true, though I'm not sure if it's worth adding that
functionality to the warning - it only seems likely to have this FP on
compiler test cases mostly. Are people really passing literals to abs
on a regular basis in real code?



More information about the cfe-commits mailing list