Title: [247478] releases/WebKitGTK/webkit-2.24/Source/_javascript_Core
Revision
247478
Author
ape...@igalia.com
Date
2019-07-16 07:56:59 -0700 (Tue, 16 Jul 2019)

Log Message

Merged r243633 - Opcode.h(159,27): warning: adding 'unsigned int' to a string does not append to the string [-Wstring-plus-int]
https://bugs.webkit.org/show_bug.cgi?id=196343

Reviewed by Saam Barati.

Clang reports a compilation warning and recommend '&PADDING_STRING[PADDING_STRING_LENGTH]'
instead of 'PADDING_STRING + PADDING_STRING_LENGTH'.

* bytecode/Opcode.cpp:
(JSC::padOpcodeName): Moved padOpcodeName from Opcode.h because
this function is used only in Opcode.cpp. Changed macros
PADDING_STRING and PADDING_STRING_LENGTH to simple variables.
(JSC::compareOpcodePairIndices): Replaced pair with std::pair.
* bytecode/Opcode.h:
(JSC::padOpcodeName): Moved.

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/ChangeLog (247477 => 247478)


--- releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/ChangeLog	2019-07-16 08:09:52 UTC (rev 247477)
+++ releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/ChangeLog	2019-07-16 14:56:59 UTC (rev 247478)
@@ -1,3 +1,21 @@
+2019-03-28  Fujii Hironori  <hironori.fu...@sony.com>
+
+        Opcode.h(159,27): warning: adding 'unsigned int' to a string does not append to the string [-Wstring-plus-int]
+        https://bugs.webkit.org/show_bug.cgi?id=196343
+
+        Reviewed by Saam Barati.
+
+        Clang reports a compilation warning and recommend '&PADDING_STRING[PADDING_STRING_LENGTH]'
+        instead of 'PADDING_STRING + PADDING_STRING_LENGTH'.
+
+        * bytecode/Opcode.cpp:
+        (JSC::padOpcodeName): Moved padOpcodeName from Opcode.h because
+        this function is used only in Opcode.cpp. Changed macros
+        PADDING_STRING and PADDING_STRING_LENGTH to simple variables.
+        (JSC::compareOpcodePairIndices): Replaced pair with std::pair.
+        * bytecode/Opcode.h:
+        (JSC::padOpcodeName): Moved.
+
 2019-06-24  Mark Lam  <mark....@apple.com>
 
         ArraySlice needs to keep the source array alive.

Modified: releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/bytecode/Opcode.cpp (247477 => 247478)


--- releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/bytecode/Opcode.cpp	2019-07-16 08:09:52 UTC (rev 247477)
+++ releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/bytecode/Opcode.cpp	2019-07-16 14:56:59 UTC (rev 247478)
@@ -54,6 +54,18 @@
 
 #if ENABLE(OPCODE_STATS)
 
+inline const char* padOpcodeName(OpcodeID op, unsigned width)
+{
+    auto padding = "                                ";
+    auto paddingLength = strlen(padding);
+    auto opcodeNameLength = strlen(opcodeNames[op]);
+    if (opcodeNameLength >= width)
+        return "";
+    if (paddingLength + opcodeNameLength < width)
+        return padding;
+    return &padding[paddingLength + opcodeNameLength - width];
+}
+
 long long OpcodeStats::opcodeCounts[numOpcodeIDs];
 long long OpcodeStats::opcodePairCounts[numOpcodeIDs][numOpcodeIDs];
 int OpcodeStats::lastOpcode = -1;
@@ -85,9 +97,9 @@
 
 static int compareOpcodePairIndices(const void* left, const void* right)
 {
-    std::pair<int, int> leftPair = *(pair<int, int>*) left;
+    std::pair<int, int> leftPair = *(std::pair<int, int>*) left;
     long long leftValue = OpcodeStats::opcodePairCounts[leftPair.first][leftPair.second];
-    std::pair<int, int> rightPair = *(pair<int, int>*) right;
+    std::pair<int, int> rightPair = *(std::pair<int, int>*) right;
     long long rightValue = OpcodeStats::opcodePairCounts[rightPair.first][rightPair.second];
     
     if (leftValue < rightValue)

Modified: releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/bytecode/Opcode.h (247477 => 247478)


--- releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/bytecode/Opcode.h	2019-07-16 08:09:52 UTC (rev 247477)
+++ releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/bytecode/Opcode.h	2019-07-16 14:56:59 UTC (rev 247478)
@@ -147,21 +147,8 @@
 typedef OpcodeID Opcode;
 #endif
 
-#define PADDING_STRING "                                "
-#define PADDING_STRING_LENGTH static_cast<unsigned>(strlen(PADDING_STRING))
-
 extern const char* const opcodeNames[];
 
-inline const char* padOpcodeName(OpcodeID op, unsigned width)
-{
-    unsigned pad = width - strlen(opcodeNames[op]);
-    pad = std::min(pad, PADDING_STRING_LENGTH);
-    return PADDING_STRING + PADDING_STRING_LENGTH - pad;
-}
-
-#undef PADDING_STRING_LENGTH
-#undef PADDING_STRING
-
 #if ENABLE(OPCODE_STATS)
 
 struct OpcodeStats {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to