Title: [259588] trunk/Source/_javascript_Core
Revision
259588
Author
[email protected]
Date
2020-04-06 13:07:45 -0700 (Mon, 06 Apr 2020)

Log Message

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

Reviewed by Darin Adler.

Clang 10 reports a compilation warning in _javascript_Core:
> ..\..\Source\_javascript_Core\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>.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (259587 => 259588)


--- trunk/Source/_javascript_Core/ChangeLog	2020-04-06 19:01:57 UTC (rev 259587)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-04-06 20:07:45 UTC (rev 259588)
@@ -1,3 +1,22 @@
+2020-04-06  Fujii Hironori  <[email protected]>
+
+        [Clang 10] Fix -Wimplicit-int-float-conversion compilation warnings in _javascript_Core
+        https://bugs.webkit.org/show_bug.cgi?id=210038
+
+        Reviewed by Darin Adler.
+
+        Clang 10 reports a compilation warning in _javascript_Core:
+        > ..\..\Source\_javascript_Core\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>.
+
 2020-04-06  Rick Waldron  <[email protected]> and Alexey Shvayka  <[email protected]>
 
         Remove unnecessary Test262 harness file and implement $262.IsHTMLDDA

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (259587 => 259588)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2020-04-06 19:01:57 UTC (rev 259587)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2020-04-06 20:07:45 UTC (rev 259588)
@@ -3001,7 +3001,7 @@
     // the function is so huge that we can't even fit it into virtual memory then we
     // should probably have some other guards in place to prevent us from even getting
     // to this point.
-    if (doubleResult > std::numeric_limits<size_t>::max())
+    if (doubleResult >= maxPlusOne<size_t>)
         return 0;
     
     return static_cast<size_t>(doubleResult);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to