Remove DeprecatedOptional
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Apr 2019 17:36:58 +0000 (17:36 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Apr 2019 17:36:58 +0000 (17:36 +0000)
https://bugs.webkit.org/show_bug.cgi?id=197161

Reviewed by Darin Adler.

Source/JavaScriptCore:

We need to keep a symbol exported from JavaScriptCore for binary compatibility with iOS12.
We need this symbol to be in a file that doesn't include anything because libcxx's implementation of
std::optional is actually std::__1::optional, which has a different mangled name.  This change will
prevent protocol errors from being reported if you are running the iOS12 simulator with a custom build of WebKit
and using the web inspector with it, but it's necessary to allow us to start using C++17 in WebKit.

* JavaScriptCore.xcodeproj/project.pbxproj:
* inspector/InspectorBackendDispatcher.cpp:
* inspector/InspectorBackendDispatcher.h:
* inspector/InspectorBackendDispatcherCompatibility.cpp: Added.
(Inspector::BackendDispatcher::reportProtocolError):
* inspector/InspectorBackendDispatcherCompatibility.h: Added.

Source/WTF:

* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/DeprecatedOptional.h: Removed.

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

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp
Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h
Source/JavaScriptCore/inspector/InspectorBackendDispatcherCompatibility.cpp [new file with mode: 0644]
Source/WTF/ChangeLog
Source/WTF/WTF.xcodeproj/project.pbxproj
Source/WTF/wtf/CMakeLists.txt
Source/WTF/wtf/DeprecatedOptional.h [deleted file]

index faaa5b9..fe358b1 100644 (file)
@@ -1,3 +1,23 @@
+2019-04-25  Alex Christensen  <achristensen@webkit.org>
+
+        Remove DeprecatedOptional
+        https://bugs.webkit.org/show_bug.cgi?id=197161
+
+        Reviewed by Darin Adler.
+
+        We need to keep a symbol exported from JavaScriptCore for binary compatibility with iOS12.
+        We need this symbol to be in a file that doesn't include anything because libcxx's implementation of
+        std::optional is actually std::__1::optional, which has a different mangled name.  This change will
+        prevent protocol errors from being reported if you are running the iOS12 simulator with a custom build of WebKit
+        and using the web inspector with it, but it's necessary to allow us to start using C++17 in WebKit.
+
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * inspector/InspectorBackendDispatcher.cpp:
+        * inspector/InspectorBackendDispatcher.h:
+        * inspector/InspectorBackendDispatcherCompatibility.cpp: Added.
+        (Inspector::BackendDispatcher::reportProtocolError):
+        * inspector/InspectorBackendDispatcherCompatibility.h: Added.
+
 2019-04-24  Saam Barati  <sbarati@apple.com>
 
         Add SPI callbacks for before and after module execution
index adfbe5b..d8b2aab 100644 (file)
                5B70CFDE1DB69E6600EC23F9 /* JSAsyncFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = 5B70CFD81DB69E5C00EC23F9 /* JSAsyncFunction.h */; };
                5B70CFE01DB69E6600EC23F9 /* AsyncFunctionPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = 5B70CFDA1DB69E5C00EC23F9 /* AsyncFunctionPrototype.h */; };
                5B70CFE21DB69E6600EC23F9 /* AsyncFunctionConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 5B70CFDC1DB69E5C00EC23F9 /* AsyncFunctionConstructor.h */; };
+               5C4196622270E0000047B7CD /* InspectorBackendDispatcherCompatibility.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C4196612270DFF30047B7CD /* InspectorBackendDispatcherCompatibility.cpp */; };
                5C4E8E961DBEBE620036F1FC /* JSONParseTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C4E8E941DBEBDA20036F1FC /* JSONParseTest.cpp */; };
                5D5D8AD10E0D0EBE00F9C692 /* libedit.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D5D8AD00E0D0EBE00F9C692 /* libedit.dylib */; };
                5DBB151B131D0B310056AD36 /* testapi.js in Copy Support Script */ = {isa = PBXBuildFile; fileRef = 14D857740A4696C80032146C /* testapi.js */; };
                5B70CFDC1DB69E5C00EC23F9 /* AsyncFunctionConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsyncFunctionConstructor.h; sourceTree = "<group>"; };
                5B70CFDD1DB69E5C00EC23F9 /* AsyncFunctionConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AsyncFunctionConstructor.cpp; sourceTree = "<group>"; };
                5B8243041DB7AA4900EA6384 /* AsyncFunctionPrototype.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = AsyncFunctionPrototype.js; sourceTree = "<group>"; };
+               5C4196612270DFF30047B7CD /* InspectorBackendDispatcherCompatibility.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorBackendDispatcherCompatibility.cpp; sourceTree = "<group>"; };
                5C4E8E941DBEBDA20036F1FC /* JSONParseTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSONParseTest.cpp; path = API/tests/JSONParseTest.cpp; sourceTree = "<group>"; };
                5C4E8E951DBEBDA20036F1FC /* JSONParseTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSONParseTest.h; path = API/tests/JSONParseTest.h; sourceTree = "<group>"; };
                5D5D8AD00E0D0EBE00F9C692 /* libedit.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libedit.dylib; path = /usr/lib/libedit.dylib; sourceTree = "<absolute>"; };
                                A593CF85184038CA00BFCE27 /* InspectorAgentRegistry.h */,
                                A593CF7A1840360300BFCE27 /* InspectorBackendDispatcher.cpp */,
                                A593CF7B1840360300BFCE27 /* InspectorBackendDispatcher.h */,
+                               5C4196612270DFF30047B7CD /* InspectorBackendDispatcherCompatibility.cpp */,
                                A5D0A1BA1862301B00C7B496 /* InspectorEnvironment.h */,
                                A5945594182479EB00CC3843 /* InspectorFrontendChannel.h */,
                                99F1A6FC1B8E6D9400463B26 /* InspectorFrontendRouter.cpp */,
                                5333BBDB2110F7D2007618EC /* DFGSpeculativeJIT32_64.cpp in Sources */,
                                5333BBDD2110F7E1007618EC /* DFGSpeculativeJIT64.cpp in Sources */,
                                33B2A548226543BF005A0F79 /* FTLLowerDFGToB3.cpp in Sources */,
+                               5C4196622270E0000047B7CD /* InspectorBackendDispatcherCompatibility.cpp in Sources */,
                                536B319E1F735F160037FC33 /* LowLevelInterpreter.cpp in Sources */,
                                0FF4274A158EBE91004CB9FF /* udis86.c in Sources */,
                                0FF42740158EBE8B004CB9FF /* udis86_decode.c in Sources */,
index fdefd42..038cb64 100644 (file)
@@ -270,14 +270,6 @@ void BackendDispatcher::reportProtocolError(Optional<long> relatedRequestId, Com
     m_protocolErrors.append(std::tuple<CommonErrorCode, String>(errorCode, errorMessage));
 }
 
-void BackendDispatcher::reportProtocolError(WTF::DeprecatedOptional<long> relatedRequestId, CommonErrorCode errorCode, const String& errorMessage)
-{
-    if (relatedRequestId)
-        reportProtocolError(relatedRequestId.value(), errorCode, errorMessage);
-    else
-        reportProtocolError(WTF::nullopt, errorCode, errorMessage);
-}
-
 template<typename T>
 T BackendDispatcher::getPropertyValue(JSON::Object* object, const String& name, bool* out_optionalValueFound, T defaultValue, std::function<bool(JSON::Value&, T&)> asMethod, const char* typeName)
 {
index 3452e93..95d9d81 100644 (file)
@@ -29,7 +29,6 @@
 #include "InspectorFrontendRouter.h"
 #include "InspectorProtocolTypes.h"
 #include <functional>
-#include <wtf/DeprecatedOptional.h>
 #include <wtf/Optional.h>
 #include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
@@ -110,9 +109,6 @@ public:
 private:
     BackendDispatcher(Ref<FrontendRouter>&&);
 
-    // This is necessary for some versions of Safari. Remove it when those versions of Safari are no longer supported.
-    void reportProtocolError(WTF::DeprecatedOptional<long> relatedRequestId, CommonErrorCode, const String& errorMessage);
-
     Ref<FrontendRouter> m_frontendRouter;
     HashMap<String, SupplementalBackendDispatcher*> m_dispatchers;
 
diff --git a/Source/JavaScriptCore/inspector/InspectorBackendDispatcherCompatibility.cpp b/Source/JavaScriptCore/inspector/InspectorBackendDispatcherCompatibility.cpp
new file mode 100644 (file)
index 0000000..2a73777
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+namespace std {
+template<typename> class optional { };
+}
+
+namespace WTF {
+class String;
+}
+
+namespace Inspector {
+
+class __attribute__((visibility("default"))) BackendDispatcher {
+private:
+    enum CommonErrorCode { NotUsed };
+    void reportProtocolError(std::optional<long>, CommonErrorCode, const WTF::String&);
+};
+
+// This symbol must be exported from JavaScriptCore to maintain binary compatibility with iOS 12.
+// We can, and should, remove this entire file once we no longer need binary compatibility with iOS 12.
+void BackendDispatcher::reportProtocolError(std::optional<long>, CommonErrorCode, const WTF::String&)
+{
+}
+
+}
index 21f5ab9..3c4fa9f 100644 (file)
@@ -1,3 +1,14 @@
+2019-04-25  Alex Christensen  <achristensen@webkit.org>
+
+        Remove DeprecatedOptional
+        https://bugs.webkit.org/show_bug.cgi?id=197161
+
+        Reviewed by Darin Adler.
+
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/CMakeLists.txt:
+        * wtf/DeprecatedOptional.h: Removed.
+
 2019-04-24  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [GTK] Hardcoded text color in input fields
index 6c0d951..89c91b0 100644 (file)
                A3EE5C3F21FFACA200FABD61 /* SchedulePairMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SchedulePairMac.mm; sourceTree = "<group>"; };
                A5098AFF1C169E0700087797 /* SandboxSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SandboxSPI.h; sourceTree = "<group>"; };
                A5098B011C16A4F900087797 /* SecuritySPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecuritySPI.h; sourceTree = "<group>"; };
-               A561F30F1DF2642100FF675D /* DeprecatedOptional.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeprecatedOptional.h; sourceTree = "<group>"; };
                A5BA15F2182433A900A82E69 /* StringCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringCocoa.mm; sourceTree = "<group>"; };
                A5BA15F41824348000A82E69 /* StringImplCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringImplCocoa.mm; sourceTree = "<group>"; };
                A5BA15F7182435A600A82E69 /* AtomicStringImplCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AtomicStringImplCF.cpp; sourceTree = "<group>"; };
                                A8A4727A151A825A004123FF /* DateMath.h */,
                                996B17841EBA441C007E10EB /* DebugUtilities.h */,
                                0F2B66A417B6B4F700A7AE3F /* DeferrableRefCounted.h */,
-                               A561F30F1DF2642100FF675D /* DeprecatedOptional.h */,
                                A8A4727E151A825A004123FF /* Deque.h */,
                                A9A4727F151A825A004123FF /* DisallowCType.h */,
                                0F4570421BE5B58F0062A629 /* Dominators.h */,
                                A8A473C3151A825B004123FF /* FastMalloc.cpp in Sources */,
                                0F9D3360165DBA73005AD387 /* FilePrintStream.cpp in Sources */,
                                A331D95B21F24992009F02AA /* FileSystem.cpp in Sources */,
-                               FE1E2C42224187C600F6B729 /* PlatformRegisters.cpp in Sources */,
                                A331D95D21F249E4009F02AA /* FileSystemCF.cpp in Sources */,
                                A331D95F21F249F6009F02AA /* FileSystemCocoa.mm in Sources */,
                                A331D96121F24A0A009F02AA /* FileSystemMac.mm in Sources */,
                                51F1752B1F3D486000C74950 /* PersistentCoders.cpp in Sources */,
                                51F1752C1F3D486000C74950 /* PersistentDecoder.cpp in Sources */,
                                51F1752D1F3D486000C74950 /* PersistentEncoder.cpp in Sources */,
+                               FE1E2C42224187C600F6B729 /* PlatformRegisters.cpp in Sources */,
                                0F9D3362165DBA73005AD387 /* PrintStream.cpp in Sources */,
                                7AF023B52061E17000A8EFD6 /* ProcessPrivilege.cpp in Sources */,
+                               FE1E2C3B2240C06600F6B729 /* PtrTag.cpp in Sources */,
                                143F611F1565F0F900DB514A /* RAMSize.cpp in Sources */,
                                A3B725EC987446AD93F1A440 /* RandomDevice.cpp in Sources */,
                                A8A47414151A825B004123FF /* RandomNumber.cpp in Sources */,
                                1C181C8F1D307AB800F5FA16 /* UTextProvider.cpp in Sources */,
                                1C181C911D307AB800F5FA16 /* UTextProviderLatin1.cpp in Sources */,
                                1C181C931D307AB800F5FA16 /* UTextProviderUTF16.cpp in Sources */,
-                               FE1E2C3B2240C06600F6B729 /* PtrTag.cpp in Sources */,
                                A8A47469151A825B004123FF /* UTF8Conversion.cpp in Sources */,
                                7AFEC6B11EB22B5900DADE36 /* UUID.cpp in Sources */,
                                0F66B2921DC97BAB004A1D3F /* WallTime.cpp in Sources */,
index 3c3f251..6ccacc8 100644 (file)
@@ -47,7 +47,6 @@ set(WTF_PUBLIC_HEADERS
     DateMath.h
     DebugUtilities.h
     DeferrableRefCounted.h
-    DeprecatedOptional.h
     Deque.h
     DisallowCType.h
     Dominators.h
diff --git a/Source/WTF/wtf/DeprecatedOptional.h b/Source/WTF/wtf/DeprecatedOptional.h
deleted file mode 100644 (file)
index 9b1558d..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2014, 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-// This file contains a deprecated version of std::optional which a released
-// version of Safari uses. Once Safari stops using this, we can remove this.
-// New code should use WTF::Optional.
-
-#pragma once
-
-#include <type_traits>
-#include <wtf/Optional.h>
-
-namespace std {
-
-template <class T>
-class optional : private WTF::OptionalBase<T> {
-public:
-    explicit constexpr operator bool() const __NOEXCEPT { return WTF::OptionalBase<T>::init_; }
-    constexpr T const& value() const& { return WTF::OptionalBase<T>::storage_.value_; }
-};
-
-}
-
-namespace WTF {
-
-template<typename T> using DeprecatedOptional = std::optional<T>;
-
-} // namespace WTF