Title: [225436] trunk/Source/ThirdParty/ANGLE
Revision
225436
Author
[email protected]
Date
2017-12-01 17:04:52 -0800 (Fri, 01 Dec 2017)

Log Message

Unreviewed, fix byte order macros and address new -Wunknown-pragmas warnings
https://bugs.webkit.org/show_bug.cgi?id=180177
<rdar://problem/35774734>

I'm not sure how this code was developed, as it seems to have been designed for GCC, but it
does not use any of GCC's documented byte order macros, and accordingly does not work. Let's
fix it to guarantee there are no problems when building with GCC. I presume it should help
Clang as well.

This time, hopefully without breaking 32-bit macOS, where __BYTE_ORDER actually is defined.

* src/common/third_party/smhasher/src/PMurHash.cpp:
(angle::PMurHash32_Process):

Modified Paths

Diff

Modified: trunk/Source/ThirdParty/ANGLE/ChangeLog (225435 => 225436)


--- trunk/Source/ThirdParty/ANGLE/ChangeLog	2017-12-02 00:41:53 UTC (rev 225435)
+++ trunk/Source/ThirdParty/ANGLE/ChangeLog	2017-12-02 01:04:52 UTC (rev 225436)
@@ -1,3 +1,19 @@
+2017-12-01  Michael Catanzaro  <[email protected]>
+
+        Unreviewed, fix byte order macros and address new -Wunknown-pragmas warnings
+        https://bugs.webkit.org/show_bug.cgi?id=180177
+        <rdar://problem/35774734>
+
+        I'm not sure how this code was developed, as it seems to have been designed for GCC, but it
+        does not use any of GCC's documented byte order macros, and accordingly does not work. Let's
+        fix it to guarantee there are no problems when building with GCC. I presume it should help
+        Clang as well.
+
+        This time, hopefully without breaking 32-bit macOS, where __BYTE_ORDER actually is defined.
+
+        * src/common/third_party/smhasher/src/PMurHash.cpp:
+        (angle::PMurHash32_Process):
+
 2017-12-01  Ryan Haddad  <[email protected]>
 
         Unreviewed, rolling out r225412.

Modified: trunk/Source/ThirdParty/ANGLE/src/common/third_party/smhasher/src/PMurHash.cpp (225435 => 225436)


--- trunk/Source/ThirdParty/ANGLE/src/common/third_party/smhasher/src/PMurHash.cpp	2017-12-02 00:41:53 UTC (rev 225435)
+++ trunk/Source/ThirdParty/ANGLE/src/common/third_party/smhasher/src/PMurHash.cpp	2017-12-02 01:04:52 UTC (rev 225436)
@@ -74,6 +74,12 @@
  * ROTL32(x,r)      Rotate x left by r bits
  */
 
+#if !defined(__BYTE_ORDER) && defined(__GNUC__)
+  #define __BIG_ENDIAN __ORDER_BIG_ENDIAN__
+  #define __LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
+  #define __BYTE_ORDER __BYTE_ORDER__
+#endif
+
 /* Convention is to define __BYTE_ORDER == to one of these values */
 #if !defined(__BIG_ENDIAN)
   #define __BIG_ENDIAN 4321
@@ -84,7 +90,9 @@
 
 /* I386 */
 #if defined(_M_IX86) || defined(__i386__) || defined(__i386) || defined(i386)
-  #define __BYTE_ORDER __LITTLE_ENDIAN
+  #if !defined(__BYTE_ORDER)
+    #define __BYTE_ORDER __LITTLE_ENDIAN
+  #endif
   #define UNALIGNED_SAFE
 #endif
 
@@ -111,10 +119,14 @@
 /* Now find best way we can to READ_UINT32 */
 #if __BYTE_ORDER==__LITTLE_ENDIAN
   /* CPU endian matches murmurhash algorithm, so read 32-bit word directly */
+#if defined(__clang__)
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wcast-align"
+#endif
   #define READ_UINT32(ptr)   (*((uint32_t*)(ptr)))
+#if defined(__clang__)
 #pragma clang diagnostic pop
+#endif
 #elif __BYTE_ORDER==__BIG_ENDIAN
   /* TODO: Add additional cases below where a compiler provided bswap32 is available */
   #if defined(__GNUC__) && (__GNUC__>4 || (__GNUC__==4 && __GNUC_MINOR__>=3))
@@ -221,10 +233,14 @@
   switch(n) { /* how many bytes in c */
   case 0: /* c=[----]  w=[3210]  b=[3210]=w            c'=[----] */
     for( ; ptr < end ; ptr+=4) {
+#if defined(__clang__)
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wcast-align"
+#endif
       uint32_t k1 = READ_UINT32(ptr);
+#if defined(__clang__)
 #pragma clang diagnostic pop
+#endif
       DOBLOCK(h1, k1);
     }
     break;
@@ -231,10 +247,14 @@
   case 1: /* c=[0---]  w=[4321]  b=[3210]=c>>24|w<<8   c'=[4---] */
     for( ; ptr < end ; ptr+=4) {
       uint32_t k1 = c>>24;
+#if defined(__clang__)
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wcast-align"
+#endif
       c = READ_UINT32(ptr);
+#if defined(__clang__)
 #pragma clang diagnostic pop
+#endif
       k1 |= c<<8;
       DOBLOCK(h1, k1);
     }
@@ -242,10 +262,14 @@
   case 2: /* c=[10--]  w=[5432]  b=[3210]=c>>16|w<<16  c'=[54--] */
     for( ; ptr < end ; ptr+=4) {
       uint32_t k1 = c>>16;
+#if defined(__clang__)
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wcast-align"
+#endif
       c = READ_UINT32(ptr);
+#if defined(__clang__)
 #pragma clang diagnostic pop
+#endif
       k1 |= c<<16;
       DOBLOCK(h1, k1);
     }
@@ -253,10 +277,14 @@
   case 3: /* c=[210-]  w=[6543]  b=[3210]=c>>8|w<<24   c'=[654-] */
     for( ; ptr < end ; ptr+=4) {
       uint32_t k1 = c>>8;
+#if defined(__clang__)
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wcast-align"
+#endif
       c = READ_UINT32(ptr);
+#if defined(__clang__)
 #pragma clang diagnostic pop
+#endif
       k1 |= c<<24;
       DOBLOCK(h1, k1);
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to