Title: [238541] trunk/Source/WTF
Revision
238541
Author
[email protected]
Date
2018-11-26 18:01:07 -0800 (Mon, 26 Nov 2018)

Log Message

[Win][Clang] SOFT_LINK reports warning: implicit conversion between pointer-to-function and pointer-to-object is a Microsoft extension [-Wmicrosoft-cast]
https://bugs.webkit.org/show_bug.cgi?id=191960

Reviewed by Alex Christensen.

* wtf/win/SoftLinking.h: Do reinterpret_cast<void*> a function
pointer argument of EncodePointer. Changed the type of stored
function pointer returned by EncodePointer.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (238540 => 238541)


--- trunk/Source/WTF/ChangeLog	2018-11-27 01:59:19 UTC (rev 238540)
+++ trunk/Source/WTF/ChangeLog	2018-11-27 02:01:07 UTC (rev 238541)
@@ -1,3 +1,14 @@
+2018-11-26  Fujii Hironori  <[email protected]>
+
+        [Win][Clang] SOFT_LINK reports warning: implicit conversion between pointer-to-function and pointer-to-object is a Microsoft extension [-Wmicrosoft-cast]
+        https://bugs.webkit.org/show_bug.cgi?id=191960
+
+        Reviewed by Alex Christensen.
+
+        * wtf/win/SoftLinking.h: Do reinterpret_cast<void*> a function
+        pointer argument of EncodePointer. Changed the type of stored
+        function pointer returned by EncodePointer.
+
 2018-11-26  Sam Weinig  <[email protected]>
 
         Streamline ListHashSet use in floating object code

Modified: trunk/Source/WTF/wtf/win/SoftLinking.h (238540 => 238541)


--- trunk/Source/WTF/wtf/win/SoftLinking.h	2018-11-27 01:59:19 UTC (rev 238540)
+++ trunk/Source/WTF/wtf/win/SoftLinking.h	2018-11-27 02:01:07 UTC (rev 238541)
@@ -43,12 +43,12 @@
 #pragma mark - Soft-link macros for use within a single source file
 
 #define SOFT_LINK(library, functionName, resultType, callingConvention, parameterDeclarations, parameterNames) \
-    static resultType(callingConvention*softLink##functionName) parameterDeclarations = nullptr; \
+    static void* softLink##functionName; \
     \
     inline resultType functionName parameterDeclarations \
     { \
         if (!softLink##functionName) \
-            softLink##functionName = reinterpret_cast<resultType(callingConvention*)parameterDeclarations>(::EncodePointer(SOFT_LINK_GETPROCADDRESS(library##Library(), #functionName))); \
+            softLink##functionName = ::EncodePointer(reinterpret_cast<void*>(SOFT_LINK_GETPROCADDRESS(library##Library(), #functionName))); \
         return reinterpret_cast<resultType (callingConvention*) parameterDeclarations>(::DecodePointer(softLink##functionName)) parameterNames; \
     }
 
@@ -56,11 +56,11 @@
     typedef resultType (callingConvention *functionName##PtrType) parameterDeclarations; \
     static functionName##PtrType functionName##Ptr() \
     { \
-        static functionName##PtrType ptr; \
+        static void* ptr; \
         static bool initialized; \
         \
         if (!initialized) { \
-            ptr = reinterpret_cast<functionName##PtrType>(::EncodePointer(SOFT_LINK_GETPROCADDRESS(library##Library(), #functionName))); \
+            ptr = ::EncodePointer(reinterpret_cast<void*>(SOFT_LINK_GETPROCADDRESS(library##Library(), #functionName))); \
             initialized = true; \
         } \
         return reinterpret_cast<functionName##PtrType>(::DecodePointer(ptr)); \
@@ -70,12 +70,12 @@
     typedef resultType (callingConvention *functionName##PtrType) parameterDeclarations; \
     static functionName##PtrType functionName##Ptr() \
     { \
-        static functionName##PtrType ptr; \
+        static void* ptr; \
         static bool initialized; \
         \
         if (!initialized) { \
             static HINSTANCE libraryInstance = ::GetModuleHandle(L#library); \
-            ptr = reinterpret_cast<functionName##PtrType>(::EncodePointer(SOFT_LINK_GETPROCADDRESS(libraryInstance, #functionName))); \
+            ptr = ::EncodePointer(reinterpret_cast<void*>(SOFT_LINK_GETPROCADDRESS(libraryInstance, #functionName))); \
             initialized = true; \
         } \
         \
@@ -90,12 +90,12 @@
     #define myFunction softLink_myFunction
 */
 #define SOFT_LINK_DLL_IMPORT(library, functionName, resultType, callingConvention, parameterDeclarations, parameterNames) \
-    static resultType(callingConvention*softLink##functionName) parameterDeclarations = nullptr; \
+    static void* softLink##functionName; \
     \
     inline resultType softLink_##functionName parameterDeclarations \
     { \
         if (!softLink##functionName) \
-            softLink##functionName = reinterpret_cast<resultType(callingConvention*)parameterDeclarations>(::EncodePointer(SOFT_LINK_GETPROCADDRESS(library##Library(), #functionName))); \
+            softLink##functionName = ::EncodePointer(reinterpret_cast<void*>(SOFT_LINK_GETPROCADDRESS(library##Library(), #functionName))); \
         return reinterpret_cast<resultType(callingConvention*)parameterDeclarations>(::DecodePointer(softLink##functionName)) parameterNames; \
     }
 
@@ -103,11 +103,11 @@
     typedef resultType (callingConvention *functionName##PtrType) parameterDeclarations; \
     static functionName##PtrType functionName##Ptr() \
     { \
-        static functionName##PtrType ptr; \
+        static void* ptr; \
         static bool initialized; \
         \
         if (!initialized) { \
-            ptr = reinterpret_cast<resultType(callingConvention*)parameterDeclarations>(::EncodePointer(SOFT_LINK_GETPROCADDRESS(library##Library(), #functionName))); \
+            ptr = ::EncodePointer(reinterpret_cast<void*>(SOFT_LINK_GETPROCADDRESS(library##Library(), #functionName))); \
             initialized = true; \
         } \
         return reinterpret_cast<functionName##PtrType>(::DecodePointer(ptr)); \
@@ -117,11 +117,11 @@
     typedef resultType (callingConvention *functionName##PtrType) parameterDeclarations; \
     static functionName##PtrType functionName##Ptr() \
     { \
-        static functionName##PtrType ptr; \
+        static void* ptr; \
         static bool initialized; \
         \
         if (!initialized) { \
-            ptr = reinterpret_cast<resultType(callingConvention*)parameterDeclarations>(::EncodePointer(SOFT_LINK_GETPROCADDRESS(library##Library(), #functionName))); \
+            ptr = ::EncodePointer(reinterpret_cast<void*>(SOFT_LINK_GETPROCADDRESS(library##Library(), #functionName))); \
             initialized = true; \
         } \
         return reinterpret_cast<functionName##PtrType>(::DecodePointer(ptr)); \
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to