Title: [224937] trunk/Source/WebCore
Revision
224937
Author
[email protected]
Date
2017-11-16 15:27:59 -0800 (Thu, 16 Nov 2017)

Log Message

REGRESSION(r224887): GCC 5 build broken
https://bugs.webkit.org/show_bug.cgi?id=179750

Reviewed by Jer Noble.

Add a legacy FourCC constructor that will be used only when building with GCC 5. This is
bad, but it seems acceptable for use with a fallback codepath.

Unfortunately, this requires adjusting some initializations to avoid ambiguity with the
uint32_t constructor.

* platform/graphics/FourCC.h:
(WebCore::FourCC::FourCC):
* platform/graphics/iso/ISOBox.cpp:
(WebCore::ISOBox::peekBox):
* platform/graphics/iso/ISOBox.h:
* platform/graphics/iso/ISOOriginalFormatBox.h:
* platform/graphics/iso/ISOSchemeTypeBox.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (224936 => 224937)


--- trunk/Source/WebCore/ChangeLog	2017-11-16 22:27:46 UTC (rev 224936)
+++ trunk/Source/WebCore/ChangeLog	2017-11-16 23:27:59 UTC (rev 224937)
@@ -1,3 +1,24 @@
+2017-11-16  Michael Catanzaro  <[email protected]>
+
+        REGRESSION(r224887): GCC 5 build broken
+        https://bugs.webkit.org/show_bug.cgi?id=179750
+
+        Reviewed by Jer Noble.
+
+        Add a legacy FourCC constructor that will be used only when building with GCC 5. This is
+        bad, but it seems acceptable for use with a fallback codepath.
+
+        Unfortunately, this requires adjusting some initializations to avoid ambiguity with the
+        uint32_t constructor.
+
+        * platform/graphics/FourCC.h:
+        (WebCore::FourCC::FourCC):
+        * platform/graphics/iso/ISOBox.cpp:
+        (WebCore::ISOBox::peekBox):
+        * platform/graphics/iso/ISOBox.h:
+        * platform/graphics/iso/ISOOriginalFormatBox.h:
+        * platform/graphics/iso/ISOSchemeTypeBox.h:
+
 2017-11-16  Andy Estes  <[email protected]>
 
         [Payment Request] Update feature status to "Supported In Preview"

Modified: trunk/Source/WebCore/platform/graphics/FourCC.h (224936 => 224937)


--- trunk/Source/WebCore/platform/graphics/FourCC.h	2017-11-16 22:27:46 UTC (rev 224936)
+++ trunk/Source/WebCore/platform/graphics/FourCC.h	2017-11-16 23:27:59 UTC (rev 224937)
@@ -27,11 +27,39 @@
 
 #include <wtf/text/WTFString.h>
 
+// FIXME: Remove this messy fallback path and require GCC 6 in May 2018.
+#if COMPILER(GCC)
+#if !GCC_VERSION_AT_LEAST(6, 0, 0)
+#define NEED_FOURCC_LEGACY_CONSTRUCTOR
+#include <cstring>
+#endif
+#endif
+
 namespace WebCore {
 
 struct FourCC {
     WEBCORE_EXPORT FourCC(uint32_t value) : value(value) { }
 
+#ifdef NEED_FOURCC_LEGACY_CONSTRUCTOR
+    // This constructor is risky because it creates ambiguous function
+    // calls that will not exist except with old versions of GCC: the
+    // initialization FourCC { 0 } is valid only when this legacy
+    // constructor is not enabled, because the uint32_t constructor and
+    // this constructor are equally-appropriate options. So the more
+    // verbose initialization FourCC { uint32_t { 0 } } is required, but
+    // developers will not realize this unless they use an old version of
+    // GCC. Bad.
+    FourCC(const char* data)
+    {
+        if (!data) {
+            value = 0;
+            return;
+        }
+        RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(strlen(data) == 4);
+        value = data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3];
+    }
+#undef NEED_FOURCC_LEGACY_CONSTRUCTOR
+#else
     template<std::size_t N>
     constexpr FourCC(const char (&data)[N])
     {
@@ -38,6 +66,7 @@
         static_assert((N - 1) == 4, "FourCC literals must be exactly 4 characters long");
         value = data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3];
     }
+#endif
 
     String toString() const;
     WEBCORE_EXPORT static std::optional<FourCC> fromString(const String&);

Modified: trunk/Source/WebCore/platform/graphics/iso/ISOBox.cpp (224936 => 224937)


--- trunk/Source/WebCore/platform/graphics/iso/ISOBox.cpp	2017-11-16 22:27:46 UTC (rev 224936)
+++ trunk/Source/WebCore/platform/graphics/iso/ISOBox.cpp	2017-11-16 23:27:59 UTC (rev 224937)
@@ -38,7 +38,7 @@
     if (!checkedRead<uint32_t>(size, view, offset, BigEndian))
         return std::nullopt;
 
-    FourCC type = { 0 };
+    FourCC type = { uint32_t { 0 } };
     if (!checkedRead<uint32_t>(type, view, offset, BigEndian))
         return std::nullopt;
 

Modified: trunk/Source/WebCore/platform/graphics/iso/ISOBox.h (224936 => 224937)


--- trunk/Source/WebCore/platform/graphics/iso/ISOBox.h	2017-11-16 22:27:46 UTC (rev 224936)
+++ trunk/Source/WebCore/platform/graphics/iso/ISOBox.h	2017-11-16 23:27:59 UTC (rev 224937)
@@ -71,7 +71,7 @@
     }
 
     uint64_t m_size { 0 };
-    FourCC m_boxType { 0 };
+    FourCC m_boxType { uint32_t { 0 } };
     Vector<uint8_t> m_extendedType;
 };
 

Modified: trunk/Source/WebCore/platform/graphics/iso/ISOOriginalFormatBox.h (224936 => 224937)


--- trunk/Source/WebCore/platform/graphics/iso/ISOOriginalFormatBox.h	2017-11-16 22:27:46 UTC (rev 224936)
+++ trunk/Source/WebCore/platform/graphics/iso/ISOOriginalFormatBox.h	2017-11-16 23:27:59 UTC (rev 224937)
@@ -38,7 +38,7 @@
 protected:
     bool parse(JSC::DataView&, unsigned& offset) override;
 
-    FourCC m_dataFormat { 0 };
+    FourCC m_dataFormat { uint32_t { 0 } };
 };
 
 }

Modified: trunk/Source/WebCore/platform/graphics/iso/ISOSchemeTypeBox.h (224936 => 224937)


--- trunk/Source/WebCore/platform/graphics/iso/ISOSchemeTypeBox.h	2017-11-16 22:27:46 UTC (rev 224936)
+++ trunk/Source/WebCore/platform/graphics/iso/ISOSchemeTypeBox.h	2017-11-16 23:27:59 UTC (rev 224937)
@@ -39,7 +39,7 @@
 protected:
     bool parse(JSC::DataView&, unsigned& offset) override;
 
-    FourCC m_schemeType { 0 };
+    FourCC m_schemeType { uint32_t { 0 } };
     uint32_t m_schemeVersion { 0 };
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to