Title: [133796] trunk/Source/WTF
Revision
133796
Author
h...@chromium.org
Date
2012-11-07 12:47:51 -0800 (Wed, 07 Nov 2012)

Log Message

Fix asm operand type for weakCompareAndSwap on ARM_THUMB2
https://bugs.webkit.org/show_bug.cgi?id=101238

Reviewed by Benjamin Poulain.

'result' was a bool, but the asm was expecting a 32-bit register. A
recent version of Clang warned about this:

  WebKit/Source/WTF/wtf/Atomics.h:163:34: error: the size being stored
  is truncated, use a modifier to specify the size [-Werror,-Wasm-operand-widths]

This patch fixes it by making 'result' an unsigned. It does not change
the functionality in practice ('result' would be in a 32-bit register
anyway), but it makes the code more correct and makes the warning go
away.

Also make 'result' for the X86 version an 'unsigned char' to make it
more clear that it is a byte.

* wtf/Atomics.h:
(WTF::weakCompareAndSwap):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (133795 => 133796)


--- trunk/Source/WTF/ChangeLog	2012-11-07 20:41:26 UTC (rev 133795)
+++ trunk/Source/WTF/ChangeLog	2012-11-07 20:47:51 UTC (rev 133796)
@@ -1,3 +1,27 @@
+2012-11-07  Hans Wennborg  <h...@chromium.org>
+
+        Fix asm operand type for weakCompareAndSwap on ARM_THUMB2
+        https://bugs.webkit.org/show_bug.cgi?id=101238
+
+        Reviewed by Benjamin Poulain.
+
+        'result' was a bool, but the asm was expecting a 32-bit register. A
+        recent version of Clang warned about this:
+
+          WebKit/Source/WTF/wtf/Atomics.h:163:34: error: the size being stored
+          is truncated, use a modifier to specify the size [-Werror,-Wasm-operand-widths]
+
+        This patch fixes it by making 'result' an unsigned. It does not change
+        the functionality in practice ('result' would be in a 32-bit register
+        anyway), but it makes the code more correct and makes the warning go
+        away.
+
+        Also make 'result' for the X86 version an 'unsigned char' to make it
+        more clear that it is a byte.
+
+        * wtf/Atomics.h:
+        (WTF::weakCompareAndSwap):
+
 2012-11-07  Remy Demarest  <rdemar...@apple.com>
 
         Function adoptNS and adoptCF should not generate memory leak diagnostic with Clang Static Analyzer.

Modified: trunk/Source/WTF/wtf/Atomics.h (133795 => 133796)


--- trunk/Source/WTF/wtf/Atomics.h	2012-11-07 20:41:26 UTC (rev 133795)
+++ trunk/Source/WTF/wtf/Atomics.h	2012-11-07 20:47:51 UTC (rev 133796)
@@ -142,8 +142,8 @@
 #endif
 {
 #if ENABLE(COMPARE_AND_SWAP)
-    bool result;
 #if CPU(X86) || CPU(X86_64)
+    unsigned char result;
     asm volatile(
         "lock; cmpxchgl %3, %2\n\t"
         "sete %1"
@@ -153,6 +153,7 @@
         );
 #elif CPU(ARM_THUMB2)
     unsigned tmp;
+    unsigned result;
     asm volatile(
         "movw %1, #1\n\t"
         "ldrex %2, %0\n\t"
@@ -173,7 +174,7 @@
     UNUSED_PARAM(expected);
     UNUSED_PARAM(newValue);
     CRASH();
-    return 0;
+    return false;
 #endif
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to