Changeset 259588 in webkit


Ignore:
Timestamp:
Apr 6, 2020 1:07:45 PM (4 years ago)
Author:
Fujii Hironori
Message:

[Clang 10] Fix -Wimplicit-int-float-conversion compilation warnings in JavaScriptCore
https://bugs.webkit.org/show_bug.cgi?id=210038

Reviewed by Darin Adler.

Clang 10 reports a compilation warning in JavaScriptCore:

..\..\Source\JavaScriptCore\bytecode/CodeBlock.cpp(3002,24): warning: implicit conversion from 'unsigned long long' to 'double' changes value from 18446744073709551615 to 18446744073709551616 [-Wimplicit-int-float-conversion]

if (doubleResult > std::numeric_limits<size_t>::max())

~ ~

Use a template variable maxPlusOne<T> which was added by r259537
for the purpose.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::predictedMachineCodeSize): Replaced '>' with '>=',
and std::numeric_limits<size_t>::max() with maxPlusOne<size_t>.

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r259587 r259588  
     12020-04-06  Fujii Hironori  <Hironori.Fujii@sony.com>
     2
     3        [Clang 10] Fix -Wimplicit-int-float-conversion compilation warnings in JavaScriptCore
     4        https://bugs.webkit.org/show_bug.cgi?id=210038
     5
     6        Reviewed by Darin Adler.
     7
     8        Clang 10 reports a compilation warning in JavaScriptCore:
     9        > ..\..\Source\JavaScriptCore\bytecode/CodeBlock.cpp(3002,24): warning: implicit conversion from 'unsigned long long' to 'double' changes value from 18446744073709551615 to 18446744073709551616 [-Wimplicit-int-float-conversion]
     10        >     if (doubleResult > std::numeric_limits<size_t>::max())
     11        >                      ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     12
     13        Use a template variable maxPlusOne<T> which was added by r259537
     14        for the purpose.
     15
     16        * bytecode/CodeBlock.cpp:
     17        (JSC::CodeBlock::predictedMachineCodeSize): Replaced '>' with '>=',
     18        and std::numeric_limits<size_t>::max() with maxPlusOne<size_t>.
     19
    1202020-04-06  Rick Waldron  <waldron.rick@gmail.com> and Alexey Shvayka  <shvaikalesh@gmail.com>
    221
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r259583 r259588  
    30023002    // should probably have some other guards in place to prevent us from even getting
    30033003    // to this point.
    3004     if (doubleResult > std::numeric_limits<size_t>::max())
     3004    if (doubleResult >= maxPlusOne<size_t>)
    30053005        return 0;
    30063006   
Note: See TracChangeset for help on using the changeset viewer.