Diff
Modified: trunk/Source/WTF/ChangeLog (215423 => 215424)
--- trunk/Source/WTF/ChangeLog 2017-04-17 20:07:56 UTC (rev 215423)
+++ trunk/Source/WTF/ChangeLog 2017-04-17 20:22:24 UTC (rev 215424)
@@ -1,3 +1,18 @@
+2017-04-17 Dan Bernstein <m...@apple.com>
+
+ [Cocoa] Move isNullFunctionPointer down into WTF
+ https://bugs.webkit.org/show_bug.cgi?id=170892
+
+ Reviewed by Sam Weinig.
+
+ Test: TestWebKitAPI/Tests/WTF/darwin/WeakLinking.cpp
+
+ * WTF.xcodeproj/project.pbxproj: Added reference to new file.
+ * wtf/darwin: Added.
+ * wtf/darwin/WeakLinking.h: Added.
+ (WTF::isNullFunctionPointer): Copied from ResourceLoadStatisticsClassifierCocoa.cpp in
+ WebKit2 and changed into a function template that works with any function pointer.
+
2017-04-17 Ryan Haddad <ryanhad...@apple.com>
Unreviewed, rolling out r215366.
Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (215423 => 215424)
--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2017-04-17 20:07:56 UTC (rev 215423)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2017-04-17 20:22:24 UTC (rev 215424)
@@ -140,6 +140,7 @@
2CDED0EF18115C38004DBA70 /* RunLoopCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2CDED0EE18115C38004DBA70 /* RunLoopCF.cpp */; };
2CDED0F318115C85004DBA70 /* RunLoop.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2CDED0F118115C85004DBA70 /* RunLoop.cpp */; };
2CDED0F418115C85004DBA70 /* RunLoop.h in Headers */ = {isa = PBXBuildFile; fileRef = 2CDED0F218115C85004DBA70 /* RunLoop.h */; };
+ 37C7CC2A1EA40A73007BD956 /* WeakLinking.h in Headers */ = {isa = PBXBuildFile; fileRef = 37C7CC291EA40A73007BD956 /* WeakLinking.h */; };
430B47891AAAAC1A001223DA /* StringCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 430B47871AAAAC1A001223DA /* StringCommon.h */; };
4B2680DD9B974402899ED572 /* IndexedContainerIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C67C542589348E285B49699 /* IndexedContainerIterator.h */; };
513E170B1CD7D5BF00E3650B /* LoggingAccumulator.h in Headers */ = {isa = PBXBuildFile; fileRef = 513E170A1CD7D5BF00E3650B /* LoggingAccumulator.h */; };
@@ -539,6 +540,7 @@
2CDED0F118115C85004DBA70 /* RunLoop.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RunLoop.cpp; sourceTree = "<group>"; };
2CDED0F218115C85004DBA70 /* RunLoop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RunLoop.h; sourceTree = "<group>"; };
3137E1D7DBD84AC38FAE4D34 /* IndexSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndexSet.h; sourceTree = "<group>"; };
+ 37C7CC291EA40A73007BD956 /* WeakLinking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakLinking.h; sourceTree = "<group>"; };
430B47871AAAAC1A001223DA /* StringCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringCommon.h; sourceTree = "<group>"; };
513E170A1CD7D5BF00E3650B /* LoggingAccumulator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoggingAccumulator.h; sourceTree = "<group>"; };
515F794B1CFC9F4A00CCED93 /* CrossThreadCopier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CrossThreadCopier.cpp; sourceTree = "<group>"; };
@@ -862,6 +864,14 @@
path = cf;
sourceTree = "<group>";
};
+ 37C7CC281EA40A54007BD956 /* darwin */ = {
+ isa = PBXGroup;
+ children = (
+ 37C7CC291EA40A73007BD956 /* WeakLinking.h */,
+ );
+ path = darwin;
+ sourceTree = "<group>";
+ };
5D247B5714689B8600E78B76 = {
isa = PBXGroup;
children = (
@@ -932,6 +942,7 @@
children = (
2CDED0F018115C3F004DBA70 /* cf */,
E4A0AD3B1A96251900536DF6 /* cocoa */,
+ 37C7CC281EA40A54007BD956 /* darwin */,
A8A47281151A825A004123FF /* dtoa */,
1FA47C87152502DA00568D1B /* ios */,
A8A472C4151A825A004123FF /* mac */,
@@ -1466,6 +1477,7 @@
A8A473A5151A825B004123FF /* Deque.h in Headers */,
A8A473A6151A825B004123FF /* DisallowCType.h in Headers */,
A8A473AF151A825B004123FF /* diy-fp.h in Headers */,
+ 37C7CC2A1EA40A73007BD956 /* WeakLinking.h in Headers */,
0F4570431BE5B58F0062A629 /* Dominators.h in Headers */,
A8A473B1151A825B004123FF /* double-conversion.h in Headers */,
A8A473B2151A825B004123FF /* double.h in Headers */,
Added: trunk/Source/WTF/wtf/darwin/WeakLinking.h (0 => 215424)
--- trunk/Source/WTF/wtf/darwin/WeakLinking.h (rev 0)
+++ trunk/Source/WTF/wtf/darwin/WeakLinking.h 2017-04-17 20:22:24 UTC (rev 215424)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#pragma once
+
+#include <type_traits>
+
+namespace WTF {
+
+template<typename T, typename = std::enable_if_t<std::is_function<T>::value>>
+inline bool isNullFunctionPointer(T* functionPointer)
+{
+ void* result;
+ // The C compiler may take advantage of the fact that by definition, function pointers cannot be
+ // null. When weak-linking a library, function pointers can be null. We use non-C code to
+ // prevent the C compiler from using the definition to optimize out the null check.
+ asm(
+ "mov %1, %0"
+ : "=r" (result)
+ : "r" (functionPointer)
+ );
+ return !result;
+}
+
+}
+
+using WTF::isNullFunctionPointer;
Modified: trunk/Source/WebCore/ChangeLog (215423 => 215424)
--- trunk/Source/WebCore/ChangeLog 2017-04-17 20:07:56 UTC (rev 215423)
+++ trunk/Source/WebCore/ChangeLog 2017-04-17 20:22:24 UTC (rev 215424)
@@ -1,3 +1,16 @@
+2017-04-17 Dan Bernstein <m...@apple.com>
+
+ [Cocoa] Move isNullFunctionPointer down into WTF
+ https://bugs.webkit.org/show_bug.cgi?id=170892
+
+ Reviewed by Sam Weinig.
+
+ * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
+ (WebCore::LibWebRTCProvider::webRTCAvailable): Changed to use WTF::isNullFunctionPointer,
+ and removed the static variable, so instead of loading from the initialization guard,
+ branching, then loading from the variable itself, we just load from the function pointer.
+ (WebCore::isNullFunctionPointer): Deleted.
+
2017-04-14 Jiewen Tan <jiewen_...@apple.com>
[WebCrypto] Add support for ECDSA
Modified: trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp (215423 => 215424)
--- trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp 2017-04-17 20:07:56 UTC (rev 215423)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp 2017-04-17 20:22:24 UTC (rev 215424)
@@ -38,6 +38,7 @@
#include <webrtc/sdk/objc/Framework/Classes/videotoolboxvideocodecfactory.h>
#include <wtf/Function.h>
#include <wtf/NeverDestroyed.h>
+#include <wtf/darwin/WeakLinking.h>
#endif
namespace WebCore {
@@ -204,26 +205,12 @@
return createActualPeerConnection(observer, WTFMove(portAllocator));
}
-static inline bool isNullFunctionPointer(void* functionPointer)
-{
- void* result;
- asm(
- "mov %1, %0"
- : "=r" (result)
- : "r" (functionPointer)
- );
- return !result;
-}
-
#endif // USE(LIBWEBRTC)
bool LibWebRTCProvider::webRTCAvailable()
{
#if USE(LIBWEBRTC)
- static bool available = [] {
- return !isNullFunctionPointer(reinterpret_cast<void*>(rtc::LogMessage::LogToDebug));
- }();
- return available;
+ return !isNullFunctionPointer(rtc::LogMessage::LogToDebug);
#else
return true;
#endif
Modified: trunk/Source/WebKit2/ChangeLog (215423 => 215424)
--- trunk/Source/WebKit2/ChangeLog 2017-04-17 20:07:56 UTC (rev 215423)
+++ trunk/Source/WebKit2/ChangeLog 2017-04-17 20:22:24 UTC (rev 215424)
@@ -1,3 +1,15 @@
+2017-04-17 Dan Bernstein <m...@apple.com>
+
+ [Cocoa] Move isNullFunctionPointer down into WTF
+ https://bugs.webkit.org/show_bug.cgi?id=170892
+
+ Reviewed by Sam Weinig.
+
+ * Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp:
+ (WebKit::ResourceLoadStatisticsClassifierCocoa::canUseCorePrediction): Changed to use
+ WTF::isNullFunctionPointer.
+ (WebKit::isNullFunctionPointer): Deleted.
+
2017-04-17 Wenson Hsieh <wenson_hs...@apple.com>
[WK2] Respect a new internal setting for defaulting to character selection granularity
Modified: trunk/Source/WebKit2/Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp (215423 => 215424)
--- trunk/Source/WebKit2/Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp 2017-04-17 20:07:56 UTC (rev 215423)
+++ trunk/Source/WebKit2/Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp 2017-04-17 20:22:24 UTC (rev 215424)
@@ -31,6 +31,7 @@
#include "CorePredictionSPI.h"
#include "Logging.h"
#include <wtf/NeverDestroyed.h>
+#include <wtf/darwin/WeakLinking.h>
namespace WebKit {
@@ -72,20 +73,6 @@
return String(resourceUrlString.get());
}
-static inline bool isNullFunctionPointer(void* functionPointer)
-{
- void* result;
- // The C compiler may take advantage of the fact that by definition, function pointers cannot be
- // null. When weak-linking a library, function pointers can be null. We use non-C code to
- // prevent the C compiler from using the definition to optimize out the null check.
- asm(
- "mov %1, %0"
- : "=r" (result)
- : "r" (functionPointer)
- );
- return !result;
-}
-
bool ResourceLoadStatisticsClassifierCocoa::canUseCorePrediction()
{
if (m_haveLoadedModel)
@@ -94,7 +81,7 @@
if (!m_useCorePrediction)
return false;
- if (isNullFunctionPointer(reinterpret_cast<void*>(svm_load_model))) {
+ if (isNullFunctionPointer(svm_load_model)) {
m_useCorePrediction = false;
return false;
}
Modified: trunk/Tools/ChangeLog (215423 => 215424)
--- trunk/Tools/ChangeLog 2017-04-17 20:07:56 UTC (rev 215423)
+++ trunk/Tools/ChangeLog 2017-04-17 20:22:24 UTC (rev 215424)
@@ -1,3 +1,19 @@
+2017-04-17 Dan Bernstein <m...@apple.com>
+
+ [Cocoa] Move isNullFunctionPointer down into WTF
+ https://bugs.webkit.org/show_bug.cgi?id=170892
+
+ Reviewed by Sam Weinig.
+
+ * TestWebKitAPI/Configurations/TestWTF.xcconfig:
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WTF/darwin/WeakLinking.cpp: Added.
+ (TestWebKitAPI::TEST):
+ * TestWebKitAPI/Tests/WTF/darwin/libTestWTFAlwaysMissing-iOS-v2.tbd: Added.
+ * TestWebKitAPI/Tests/WTF/darwin/libTestWTFAlwaysMissing-iOS.tbd: Added.
+ * TestWebKitAPI/Tests/WTF/darwin/libTestWTFAlwaysMissing-macOS-v2.tbd: Added.
+ * TestWebKitAPI/Tests/WTF/darwin/libTestWTFAlwaysMissing-macOS.tbd: Added.
+
2017-04-17 Jonathan Bedard <jbed...@apple.com>
webkitpy: Correct poll when killing ServerProcess
Modified: trunk/Tools/TestWebKitAPI/Configurations/TestWTF.xcconfig (215423 => 215424)
--- trunk/Tools/TestWebKitAPI/Configurations/TestWTF.xcconfig 2017-04-17 20:07:56 UTC (rev 215423)
+++ trunk/Tools/TestWebKitAPI/Configurations/TestWTF.xcconfig 2017-04-17 20:22:24 UTC (rev 215424)
@@ -24,6 +24,9 @@
#include "FeatureDefines.xcconfig"
PRODUCT_NAME = TestWTF;
+
+LIBRARY_SEARCH_PATHS = $(PROJECT_DIR)/Tests/WTF/darwin $(inhertied);
+
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
UNEXPORTED_SYMBOL_LDFLAGS = -Wl,-unexported_symbol -Wl,__ZN7testing4Test16TearDownTestCaseEv -Wl,-unexported_symbol -Wl,__ZN7testing4Test13SetUpTestCaseEv
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (215423 => 215424)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2017-04-17 20:07:56 UTC (rev 215423)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2017-04-17 20:22:24 UTC (rev 215424)
@@ -115,6 +115,7 @@
37A709AF1E3EA97E00CA5969 /* BundleRangeHandlePlugIn.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37A709AA1E3EA79000CA5969 /* BundleRangeHandlePlugIn.mm */; };
37B47E301D64E7CA005F4EFF /* WKObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37B47E2E1D64E7CA005F4EFF /* WKObject.mm */; };
37BCA61C1B596BA9002012CA /* ShouldOpenExternalURLsInNewWindowActions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37BCA61B1B596BA9002012CA /* ShouldOpenExternalURLsInNewWindowActions.mm */; };
+ 37C7CC2D1EA4146B007BD956 /* WeakLinking.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37C7CC2B1EA4146B007BD956 /* WeakLinking.cpp */; };
37D36ED71AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37D36ED61AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm */; };
37DC6791140D7D7600ABCCDB /* DOMRangeOfString.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 37DC678F140D7D3A00ABCCDB /* DOMRangeOfString.html */; };
37E1064C1697681800B78BD0 /* DOMHTMLTableCellElementCellAbove.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 37E1064B169767F700B78BD0 /* DOMHTMLTableCellElementCellAbove.html */; };
@@ -1017,6 +1018,11 @@
37B47E2E1D64E7CA005F4EFF /* WKObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKObject.mm; sourceTree = "<group>"; };
37BCA61B1B596BA9002012CA /* ShouldOpenExternalURLsInNewWindowActions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ShouldOpenExternalURLsInNewWindowActions.mm; sourceTree = "<group>"; };
37C784DE197C8F2E0010A496 /* RenderedImageFromDOMNode.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RenderedImageFromDOMNode.mm; sourceTree = "<group>"; };
+ 37C7CC2B1EA4146B007BD956 /* WeakLinking.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WeakLinking.cpp; sourceTree = "<group>"; };
+ 37C7CC2E1EA41702007BD956 /* libTestWTFAlwaysMissing-macOS-v2.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; path = "libTestWTFAlwaysMissing-macOS-v2.tbd"; sourceTree = "<group>"; };
+ 37C7CC331EA41EC8007BD956 /* libTestWTFAlwaysMissing-iOS-v2.tbd */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.text-based-dylib-definition"; path = "libTestWTFAlwaysMissing-iOS-v2.tbd"; sourceTree = "<group>"; };
+ 37C7CC341EA41EC8007BD956 /* libTestWTFAlwaysMissing-iOS.tbd */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.text-based-dylib-definition"; path = "libTestWTFAlwaysMissing-iOS.tbd"; sourceTree = "<group>"; };
+ 37C7CC351EA41EC8007BD956 /* libTestWTFAlwaysMissing-macOS.tbd */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.text-based-dylib-definition"; path = "libTestWTFAlwaysMissing-macOS.tbd"; sourceTree = "<group>"; };
37D36ED61AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LoadAlternateHTMLString.mm; sourceTree = "<group>"; };
37DC678B140D7C5000ABCCDB /* DOMRangeOfString.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMRangeOfString.mm; sourceTree = "<group>"; };
37DC678F140D7D3A00ABCCDB /* DOMRangeOfString.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = DOMRangeOfString.html; sourceTree = "<group>"; };
@@ -1821,7 +1827,12 @@
7CBBA07519BB8A0900BBF025 /* darwin */ = {
isa = PBXGroup;
children = (
+ 37C7CC331EA41EC8007BD956 /* libTestWTFAlwaysMissing-iOS-v2.tbd */,
+ 37C7CC341EA41EC8007BD956 /* libTestWTFAlwaysMissing-iOS.tbd */,
+ 37C7CC2E1EA41702007BD956 /* libTestWTFAlwaysMissing-macOS-v2.tbd */,
+ 37C7CC351EA41EC8007BD956 /* libTestWTFAlwaysMissing-macOS.tbd */,
7CBBA07619BB8A9100BBF025 /* OSObjectPtr.cpp */,
+ 37C7CC2B1EA4146B007BD956 /* WeakLinking.cpp */,
);
path = darwin;
sourceTree = "<group>";
@@ -2696,6 +2707,7 @@
1A3524AE1D63A4FB0031729B /* Scope.cpp in Sources */,
7C83DF121D0A590C00FEBCF3 /* ScopedLambda.cpp in Sources */,
7C83DF3D1D0A590C00FEBCF3 /* SetForScope.cpp in Sources */,
+ 37C7CC2D1EA4146B007BD956 /* WeakLinking.cpp in Sources */,
7C83DF2A1D0A590C00FEBCF3 /* SHA1.cpp in Sources */,
7C83DF321D0A590C00FEBCF3 /* StringBuilder.cpp in Sources */,
7CD4C26E1E2C0E6E00929470 /* StringConcatenate.cpp in Sources */,
Added: trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/WeakLinking.cpp (0 => 215424)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/WeakLinking.cpp (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/WeakLinking.cpp 2017-04-17 20:22:24 UTC (rev 215424)
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include "config.h"
+
+#if OS(DARWIN)
+
+#include <sys/unistd.h>
+#include <wtf/darwin/WeakLinking.h>
+
+#if PLATFORM(IOS)
+
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 101000
+asm(".linker_option \"-lTestWTFAlwaysMissing-iOS-v2\"");
+#else
+asm(".linker_option \"-lTestWTFAlwaysMissing-iOS\"");
+#endif
+
+#else
+
+#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101200
+asm(".linker_option \"-lTestWTFAlwaysMissing-macOS-v2\"");
+#else
+asm(".linker_option \"-lTestWTFAlwaysMissing-macOS\"");
+#endif
+
+#endif
+
+extern "C" {
+ extern void TestWTFAlwaysMissing(void) __attribute__((weak_import));
+}
+
+namespace TestWebKitAPI {
+
+TEST(WeakLinking, IsNullFunctionPointer)
+{
+ EXPECT_TRUE(isNullFunctionPointer(TestWTFAlwaysMissing));
+ EXPECT_FALSE(isNullFunctionPointer(close));
+}
+
+}
+
+#endif
Added: trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/libTestWTFAlwaysMissing-iOS-v2.tbd (0 => 215424)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/libTestWTFAlwaysMissing-iOS-v2.tbd (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/libTestWTFAlwaysMissing-iOS-v2.tbd 2017-04-17 20:22:24 UTC (rev 215424)
@@ -0,0 +1,10 @@
+--- !tapi-tbd-v2
+archs: [ i386, x86_64, armv7, armv7s, arm64 ]
+uuids: [ 'i386: 6EA81A0A-D83F-4081-B3EA-90419C1573BA87', 'x86_64: 28E81E11-2794-4192-A46A-06C73C9BAFB9', 'armv7: 00C67397-F7A2-431A-9F27-D4F61106FC1F', 'armv7s: F9C172FC-A112-488C-889B-B70FA20AE827', 'arm64: 3FDB12FB-0BF2-405C-B21A-2D3D2D18EB5F' ]
+platform: ios
+install-name: /usr/local/lib/libTestWTFAlwaysMissing.dylib
+objc-constraint: none
+exports:
+ - archs: [ i386, x86_64, armv7, armv7s, arm64 ]
+ symbols: [ _TestWTFAlwaysMissing ]
+...
Added: trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/libTestWTFAlwaysMissing-iOS.tbd (0 => 215424)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/libTestWTFAlwaysMissing-iOS.tbd (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/libTestWTFAlwaysMissing-iOS.tbd 2017-04-17 20:22:24 UTC (rev 215424)
@@ -0,0 +1,9 @@
+---
+archs: [ i386, x86_64, armv7, armv7s, arm64 ]
+platform: ios
+install-name: /usr/local/lib/libTestWTFAlwaysMissing.dylib
+objc-constraint: none
+exports:
+ - archs: [ i386, x86_64, armv7, armv7s, arm64 ]
+ symbols: [ _TestWTFAlwaysMissing ]
+...
Added: trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/libTestWTFAlwaysMissing-macOS-v2.tbd (0 => 215424)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/libTestWTFAlwaysMissing-macOS-v2.tbd (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/libTestWTFAlwaysMissing-macOS-v2.tbd 2017-04-17 20:22:24 UTC (rev 215424)
@@ -0,0 +1,10 @@
+--- !tapi-tbd-v2
+archs: [ i386, x86_64 ]
+uuids: [ 'i386: 6EA81A0A-D83F-4081-B3EA-90419C1573BA87', 'x86_64: 28E81E11-2794-4192-A46A-06C73C9BAFB9' ]
+platform: macosx
+install-name: /usr/local/lib/libTestWTFAlwaysMissing.dylib
+objc-constraint: none
+exports:
+ - archs: [ i386, x86_64 ]
+ symbols: [ _TestWTFAlwaysMissing ]
+...
Added: trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/libTestWTFAlwaysMissing-macOS.tbd (0 => 215424)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/libTestWTFAlwaysMissing-macOS.tbd (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/darwin/libTestWTFAlwaysMissing-macOS.tbd 2017-04-17 20:22:24 UTC (rev 215424)
@@ -0,0 +1,9 @@
+---
+archs: [ i386, x86_64 ]
+platform: macosx
+install-name: /usr/local/lib/libTestWTFAlwaysMissing.dylib
+objc-constraint: none
+exports:
+ - archs: [ i386, x86_64 ]
+ symbols: [ _TestWTFAlwaysMissing ]
+...