Title: [93017] trunk/Source/_javascript_Core
Revision
93017
Author
[email protected]
Date
2011-08-13 10:48:53 -0700 (Sat, 13 Aug 2011)

Log Message

Fix a bunch of minor bugs caught by the clang static analyzer in _javascript_Core
https://bugs.webkit.org/show_bug.cgi?id=66182

Reviewed by Dan Bernstein.

Fixes 10 warnings in _javascript_Core and 2 in testapi.

* API/tests/testapi.c:
(main):
Remove dead variables.

* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::dump):
Initialize hasPrinted and silence an unused warning by casting to void (Ok here
since it is debug code and I want to keep it clear that if other cases are added,
the hasPrinted flag would be needed).

* wtf/dtoa.cpp:
(WTF::d2b):
The variable "de" in the else block is always zero, so there is no reason to
use it.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/API/tests/testapi.c (93016 => 93017)


--- trunk/Source/_javascript_Core/API/tests/testapi.c	2011-08-13 15:39:03 UTC (rev 93016)
+++ trunk/Source/_javascript_Core/API/tests/testapi.c	2011-08-13 17:48:53 UTC (rev 93017)
@@ -1366,7 +1366,7 @@
     function = JSObjectMakeFunction(context, foo, 1, argumentNames, functionBody, NULL, 1, &exception);
     ASSERT(function && !exception);
     JSValueRef arguments[] = { JSValueMakeNumber(context, 2) };
-    v = JSObjectCallAsFunction(context, function, NULL, 1, arguments, &exception);
+    JSObjectCallAsFunction(context, function, NULL, 1, arguments, &exception);
     JSStringRelease(foo);
     JSStringRelease(functionBody);
     
@@ -1493,7 +1493,7 @@
     // an assert inside putDirect or lead to a crash during GC. <https://bugs.webkit.org/show_bug.cgi?id=25785>
     nullDefinition = kJSClassDefinitionEmpty;
     nullClass = JSClassCreate(&nullDefinition);
-    myConstructor = JSObjectMakeConstructor(context, nullClass, 0);
+    JSObjectMakeConstructor(context, nullClass, 0);
     JSClassRelease(nullClass);
 
     char* scriptUTF8 = createStringWithContentsOfFile(scriptPath);

Modified: trunk/Source/_javascript_Core/ChangeLog (93016 => 93017)


--- trunk/Source/_javascript_Core/ChangeLog	2011-08-13 15:39:03 UTC (rev 93016)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-08-13 17:48:53 UTC (rev 93017)
@@ -1,3 +1,27 @@
+2011-08-13  Sam Weinig  <[email protected]>
+
+        Fix a bunch of minor bugs caught by the clang static analyzer in _javascript_Core
+        https://bugs.webkit.org/show_bug.cgi?id=66182
+
+        Reviewed by Dan Bernstein.
+
+        Fixes 10 warnings in _javascript_Core and 2 in testapi.
+
+        * API/tests/testapi.c:
+        (main):
+        Remove dead variables.
+
+        * dfg/DFGGraph.cpp:
+        (JSC::DFG::Graph::dump):
+        Initialize hasPrinted and silence an unused warning by casting to void (Ok here
+        since it is debug code and I want to keep it clear that if other cases are added,
+        the hasPrinted flag would be needed).
+
+        * wtf/dtoa.cpp:
+        (WTF::d2b):
+        The variable "de" in the else block is always zero, so there is no reason to
+        use it.
+
 2011-08-12  Sam Weinig  <[email protected]>
 
         Use __builtin_trap() for CRASH when building with clang

Modified: trunk/Source/_javascript_Core/dfg/DFGGraph.cpp (93016 => 93017)


--- trunk/Source/_javascript_Core/dfg/DFGGraph.cpp	2011-08-13 15:39:03 UTC (rev 93016)
+++ trunk/Source/_javascript_Core/dfg/DFGGraph.cpp	2011-08-13 17:48:53 UTC (rev 93017)
@@ -81,7 +81,7 @@
     else
         printf("-");
     printf(">\t%s(", opName(op));
-    bool hasPrinted;
+    bool hasPrinted = false;
     if (op & NodeHasVarArgs) {
         for (unsigned childIdx = node.firstChild(); childIdx < node.firstChild() + node.numChildren(); childIdx++) {
             if (hasPrinted)
@@ -131,7 +131,8 @@
         printf("%sF:#%u", hasPrinted ? ", " : "", blockIndexForBytecodeOffset(node.notTakenBytecodeOffset()));
         hasPrinted = true;
     }
-
+    (void)hasPrinted;
+    
     printf(")");
     
     if (node.hasLocal())

Modified: trunk/Source/_javascript_Core/wtf/dtoa.cpp (93016 => 93017)


--- trunk/Source/_javascript_Core/wtf/dtoa.cpp	2011-08-13 15:39:03 UTC (rev 93016)
+++ trunk/Source/_javascript_Core/wtf/dtoa.cpp	2011-08-13 17:48:53 UTC (rev 93017)
@@ -704,7 +704,7 @@
         *e = de - Bias - (P - 1) + k;
         *bits = P - k;
     } else {
-        *e = de - Bias - (P - 1) + 1 + k;
+        *e = 0 - Bias - (P - 1) + 1 + k;
         *bits = (32 * i) - hi0bits(x[i - 1]);
     }
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to