[GTK] REGRESSION(r231170) Build broken with Clang 5.0
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 May 2018 12:52:25 +0000 (12:52 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 May 2018 12:52:25 +0000 (12:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=185198

Reviewed by Michael Catanzaro.

.:

* Source/cmake/WebKitCompilerFlags.cmake: Fall back to the -std=c++1z
compiler flag if -std=c++17 is not supported. If that flag is not
supported either, bail with an error message.

Source/WebCore:

Avoid gperf files using the register keyword which has been made
reserved and as such unusable in C++17.

* css/makeSelectorPseudoClassAndCompatibilityElementMap.py:
* css/makeSelectorPseudoElementsMap.py:
* css/makeprop.pl:
* css/makevalues.pl:
* platform/ColorData.gperf:
* platform/ReferrerPolicy.h: With std::optional forward declaration
gone, explicitly include the WTF Optional.h header.
* platform/Theme.h: Ditto.
* platform/network/create-http-header-name-table:

Source/WebKit:

* Shared/RTCNetwork.h: With std::optional forward declaration gone,
explicitly include the WTF Optional.h header.

Source/WTF:

* wtf/Compiler.h:
* wtf/Forward.h: Delete the std::optional forward declaration that is
potentially incompatible with definition provided by the standard library.
* wtf/Hasher.h:
* wtf/StdLibExtras.h: In addition to the remaining C++14 configurations,
also use custom std::in_place_t implementation when compiling with
libstdc++ 6.x, which doesn't provide its own.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231753 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
ChangeLog
Source/WTF/ChangeLog
Source/WTF/wtf/Compiler.h
Source/WTF/wtf/Forward.h
Source/WTF/wtf/Hasher.h
Source/WTF/wtf/StdLibExtras.h
Source/WebCore/ChangeLog
Source/WebCore/css/makeSelectorPseudoClassAndCompatibilityElementMap.py
Source/WebCore/css/makeSelectorPseudoElementsMap.py
Source/WebCore/css/makeprop.pl
Source/WebCore/css/makevalues.pl
Source/WebCore/platform/ColorData.gperf
Source/WebCore/platform/ReferrerPolicy.h
Source/WebCore/platform/Theme.h
Source/WebCore/platform/network/create-http-header-name-table
Source/WebKit/ChangeLog
Source/WebKit/Shared/RTCNetwork.h
Source/cmake/WebKitCompilerFlags.cmake

index 7c71b33..3067fc2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2018-05-14  Zan Dobersek  <zdobersek@igalia.com>
+
+        [GTK] REGRESSION(r231170) Build broken with Clang 5.0
+        https://bugs.webkit.org/show_bug.cgi?id=185198
+
+        Reviewed by Michael Catanzaro.
+
+        * Source/cmake/WebKitCompilerFlags.cmake: Fall back to the -std=c++1z
+        compiler flag if -std=c++17 is not supported. If that flag is not
+        supported either, bail with an error message.
+
 2018-05-09  Jan Alexander Steffens  <jan.steffens@gmail.com>
 
         [GTK] gtk-doc installation subdir duplicated
index 1f0fbb4..49f5e3f 100644 (file)
@@ -1,3 +1,18 @@
+2018-05-14  Zan Dobersek  <zdobersek@igalia.com>
+
+        [GTK] REGRESSION(r231170) Build broken with Clang 5.0
+        https://bugs.webkit.org/show_bug.cgi?id=185198
+
+        Reviewed by Michael Catanzaro.
+
+        * wtf/Compiler.h:
+        * wtf/Forward.h: Delete the std::optional forward declaration that is
+        potentially incompatible with definition provided by the standard library.
+        * wtf/Hasher.h:
+        * wtf/StdLibExtras.h: In addition to the remaining C++14 configurations,
+        also use custom std::in_place_t implementation when compiling with
+        libstdc++ 6.x, which doesn't provide its own.
+
 2018-05-13  Filip Pizlo  <fpizlo@apple.com>
 
         Disable pointer poisoning
index 1391ead..31c2936 100644 (file)
@@ -74,6 +74,8 @@
 #define WTF_CPP_STD_VER 11
 #elif __cplusplus <= 201402L
 #define WTF_CPP_STD_VER 14
+#elif __cplusplus <= 201703L
+#define WTF_CPP_STD_VER 17
 #endif
 #endif
 
index 81938fc..dde7ec0 100644 (file)
 
 #include <stddef.h>
 
-namespace std {
-template<typename T> class optional;
-}
-
 namespace WTF {
 
 class AtomicString;
index 1439391..e3496e6 100644 (file)
@@ -21,6 +21,7 @@
 #pragma once
 
 #include <wtf/Forward.h>
+#include <wtf/Optional.h>
 #include <wtf/StdLibExtras.h>
 #include <wtf/text/StringHasher.h>
 
index 765f432..6383892 100644 (file)
@@ -543,7 +543,9 @@ template<class B0, class B1, class B2, class... Bn> struct wtf_conjunction_impl<
 template<class... _Args> struct conjunction : wtf_conjunction_impl<_Args...> { };
 #endif
 
-#if __cplusplus < 201703L
+// Provide in_place_t when not building with -std=c++17, or when building with libstdc++ 6
+// (which doesn't define the _GLIBCXX_RELEASE macro that's been introduced in libstdc++ 7).
+#if __cplusplus < 201703L || (defined(__GLIBCXX__) && !defined(_GLIBCXX_RELEASE))
 
 // These are inline variable for C++17 and later.
 #define __IN_PLACE_INLINE_VARIABLE static const
index 193faa7..3011ba9 100644 (file)
@@ -1,3 +1,23 @@
+2018-05-14  Zan Dobersek  <zdobersek@igalia.com>
+
+        [GTK] REGRESSION(r231170) Build broken with Clang 5.0
+        https://bugs.webkit.org/show_bug.cgi?id=185198
+
+        Reviewed by Michael Catanzaro.
+
+        Avoid gperf files using the register keyword which has been made
+        reserved and as such unusable in C++17.
+
+        * css/makeSelectorPseudoClassAndCompatibilityElementMap.py:
+        * css/makeSelectorPseudoElementsMap.py:
+        * css/makeprop.pl:
+        * css/makevalues.pl:
+        * platform/ColorData.gperf:
+        * platform/ReferrerPolicy.h: With std::optional forward declaration
+        gone, explicitly include the WTF Optional.h header.
+        * platform/Theme.h: Ditto.
+        * platform/network/create-http-header-name-table:
+
 2018-05-14  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r219515.
index 0c30087..b34e617 100644 (file)
@@ -97,10 +97,12 @@ output_file.write("""
 #if defined(__clang__)
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wunknown-pragmas"
-#pragma clang diagnostic ignored "-Wdeprecated-register"
 #pragma clang diagnostic ignored "-Wimplicit-fallthrough"
 #endif
 
+// Older versions of gperf like to use the `register` keyword.
+#define register
+
 namespace WebCore {
 
 struct SelectorPseudoClassOrCompatibilityPseudoElementEntry {
index 2c9276c..201826e 100644 (file)
@@ -95,10 +95,12 @@ output_file.write("""
 #if defined(__clang__)
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wunknown-pragmas"
-#pragma clang diagnostic ignored "-Wdeprecated-register"
 #pragma clang diagnostic ignored "-Wimplicit-fallthrough"
 #endif
 
+// Older versions of gperf like to use the `register` keyword.
+#define register
+
 namespace WebCore {
 
 struct SelectorPseudoTypeEntry {
index 3af6952..8b3d1df 100755 (executable)
@@ -252,10 +252,12 @@ print GPERF << "EOF";
 #if defined(__clang__)
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored \"-Wunknown-pragmas\"
-#pragma clang diagnostic ignored \"-Wdeprecated-register\"
 #pragma clang diagnostic ignored \"-Wimplicit-fallthrough\"
 #endif
 
+// Older versions of gperf like to use the `register` keyword.
+#define register
+
 namespace WebCore {
 
 // Using std::numeric_limits<uint16_t>::max() here would be cleaner,
index 55c4e75..9b090ea 100755 (executable)
@@ -76,10 +76,12 @@ print GPERF << "EOF";
 #if defined(__clang__)
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored \"-Wunknown-pragmas\"
-#pragma clang diagnostic ignored \"-Wdeprecated-register\"
 #pragma clang diagnostic ignored \"-Wimplicit-fallthrough\"
 #endif
 
+// Older versions of gperf like to use the `register` keyword.
+#define register
+
 namespace WebCore {
 %}
 %struct-type
index 3912341..0ac28d3 100644 (file)
@@ -5,10 +5,12 @@
 #if defined(__clang__)
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wunknown-pragmas"
-#pragma clang diagnostic ignored "-Wdeprecated-register"
 #pragma clang diagnostic ignored "-Wimplicit-fallthrough"
 #endif
 
+// Older versions of gperf like to use the `register` keyword.
+#define register
+
 namespace WebCore {
 %}
 %struct-type
index bbec77f..4b4c03b 100644 (file)
@@ -34,6 +34,7 @@
 
 #include <wtf/EnumTraits.h>
 #include <wtf/Forward.h>
+#include <wtf/Optional.h>
 
 namespace WebCore {
 
index 1513dd0..03fb8e5 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "ThemeTypes.h"
 #include <wtf/Forward.h>
+#include <wtf/Optional.h>
 
 namespace WebCore {
 
index 1d4ebca..ea2b743 100755 (executable)
@@ -93,10 +93,12 @@ gperf_file.write('''
 #if defined(__clang__)
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wunknown-pragmas"
-#pragma clang diagnostic ignored "-Wdeprecated-register"
 #pragma clang diagnostic ignored "-Wimplicit-fallthrough"
 #endif
 
+// Older versions of gperf like to use the `register` keyword.
+#define register
+
 namespace WebCore {
 
 static const struct HeaderNameString {
index 06d62a4..03d5338 100644 (file)
@@ -1,3 +1,13 @@
+2018-05-14  Zan Dobersek  <zdobersek@igalia.com>
+
+        [GTK] REGRESSION(r231170) Build broken with Clang 5.0
+        https://bugs.webkit.org/show_bug.cgi?id=185198
+
+        Reviewed by Michael Catanzaro.
+
+        * Shared/RTCNetwork.h: With std::optional forward declaration gone,
+        explicitly include the WTF Optional.h header.
+
 2018-05-13  Dean Jackson  <dino@apple.com>
 
         WebKit2_Sim-7606.1.17.4 introduced dep cycle
index b9f2f5a..eca1dfd 100644 (file)
@@ -29,7 +29,7 @@
 
 #include <WebCore/LibWebRTCMacros.h>
 #include <webrtc/rtc_base/network.h>
-#include <wtf/Forward.h>
+#include <wtf/Optional.h>
 
 namespace IPC {
 class Decoder;
index 79cae5f..12b7bc8 100644 (file)
@@ -102,8 +102,19 @@ if (COMPILER_IS_GCC_OR_CLANG)
                                              -Wno-unknown-argument)
     else ()
         WEBKIT_APPEND_GLOBAL_COMPILER_FLAGS(-fno-exceptions)
-        WEBKIT_APPEND_GLOBAL_CXX_FLAGS(-std=c++17
-                                       -fno-rtti)
+        WEBKIT_APPEND_GLOBAL_CXX_FLAGS(-fno-rtti)
+
+        check_cxx_compiler_flag("-std=c++17" CXX_COMPILER_SUPPORTS_CXX17)
+        if (CXX_COMPILER_SUPPORTS_CXX17)
+            WEBKIT_APPEND_GLOBAL_CXX_FLAGS(-std=c++17)
+        else ()
+            check_cxx_compiler_flag("-std=c++1z" CXX_COMPILER_SUPPORTS_CXX1Z)
+            if (CXX_COMPILER_SUPPORTS_CXX1Z)
+                WEBKIT_APPEND_GLOBAL_CXX_FLAGS(-std=c++1z)
+            else ()
+                message(FATAL_ERROR "Compiler with C++17 support is required")
+            endif ()
+        endif ()
 
         if (WIN32)
             WEBKIT_APPEND_GLOBAL_COMPILER_FLAGS(-mno-ms-bitfields)