Changeset 238541 in webkit


Ignore:
Timestamp:
Nov 26, 2018 6:01:07 PM (5 years ago)
Author:
Fujii Hironori
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.

Location:
trunk/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r238504 r238541  
     12018-11-26  Fujii Hironori  <Hironori.Fujii@sony.com>
     2
     3        [Win][Clang] SOFT_LINK reports warning: implicit conversion between pointer-to-function and pointer-to-object is a Microsoft extension [-Wmicrosoft-cast]
     4        https://bugs.webkit.org/show_bug.cgi?id=191960
     5
     6        Reviewed by Alex Christensen.
     7
     8        * wtf/win/SoftLinking.h: Do reinterpret_cast<void*> a function
     9        pointer argument of EncodePointer. Changed the type of stored
     10        function pointer returned by EncodePointer.
     11
    1122018-11-26  Sam Weinig  <sam@webkit.org>
    213
  • trunk/Source/WTF/wtf/win/SoftLinking.h

    r219191 r238541  
    4444
    4545#define SOFT_LINK(library, functionName, resultType, callingConvention, parameterDeclarations, parameterNames) \
    46     static resultType(callingConvention*softLink##functionName) parameterDeclarations = nullptr; \
     46    static void* softLink##functionName; \
    4747    \
    4848    inline resultType functionName parameterDeclarations \
    4949    { \
    5050        if (!softLink##functionName) \
    51             softLink##functionName = reinterpret_cast<resultType(callingConvention*)parameterDeclarations>(::EncodePointer(SOFT_LINK_GETPROCADDRESS(library##Library(), #functionName))); \
     51            softLink##functionName = ::EncodePointer(reinterpret_cast<void*>(SOFT_LINK_GETPROCADDRESS(library##Library(), #functionName))); \
    5252        return reinterpret_cast<resultType (callingConvention*) parameterDeclarations>(::DecodePointer(softLink##functionName)) parameterNames; \
    5353    }
     
    5757    static functionName##PtrType functionName##Ptr() \
    5858    { \
    59         static functionName##PtrType ptr; \
     59        static void* ptr; \
    6060        static bool initialized; \
    6161        \
    6262        if (!initialized) { \
    63             ptr = reinterpret_cast<functionName##PtrType>(::EncodePointer(SOFT_LINK_GETPROCADDRESS(library##Library(), #functionName))); \
     63            ptr = ::EncodePointer(reinterpret_cast<void*>(SOFT_LINK_GETPROCADDRESS(library##Library(), #functionName))); \
    6464            initialized = true; \
    6565        } \
     
    7171    static functionName##PtrType functionName##Ptr() \
    7272    { \
    73         static functionName##PtrType ptr; \
     73        static void* ptr; \
    7474        static bool initialized; \
    7575        \
    7676        if (!initialized) { \
    7777            static HINSTANCE libraryInstance = ::GetModuleHandle(L#library); \
    78             ptr = reinterpret_cast<functionName##PtrType>(::EncodePointer(SOFT_LINK_GETPROCADDRESS(libraryInstance, #functionName))); \
     78            ptr = ::EncodePointer(reinterpret_cast<void*>(SOFT_LINK_GETPROCADDRESS(libraryInstance, #functionName))); \
    7979            initialized = true; \
    8080        } \
     
    9191*/
    9292#define SOFT_LINK_DLL_IMPORT(library, functionName, resultType, callingConvention, parameterDeclarations, parameterNames) \
    93     static resultType(callingConvention*softLink##functionName) parameterDeclarations = nullptr; \
     93    static void* softLink##functionName; \
    9494    \
    9595    inline resultType softLink_##functionName parameterDeclarations \
    9696    { \
    9797        if (!softLink##functionName) \
    98             softLink##functionName = reinterpret_cast<resultType(callingConvention*)parameterDeclarations>(::EncodePointer(SOFT_LINK_GETPROCADDRESS(library##Library(), #functionName))); \
     98            softLink##functionName = ::EncodePointer(reinterpret_cast<void*>(SOFT_LINK_GETPROCADDRESS(library##Library(), #functionName))); \
    9999        return reinterpret_cast<resultType(callingConvention*)parameterDeclarations>(::DecodePointer(softLink##functionName)) parameterNames; \
    100100    }
     
    104104    static functionName##PtrType functionName##Ptr() \
    105105    { \
    106         static functionName##PtrType ptr; \
     106        static void* ptr; \
    107107        static bool initialized; \
    108108        \
    109109        if (!initialized) { \
    110             ptr = reinterpret_cast<resultType(callingConvention*)parameterDeclarations>(::EncodePointer(SOFT_LINK_GETPROCADDRESS(library##Library(), #functionName))); \
     110            ptr = ::EncodePointer(reinterpret_cast<void*>(SOFT_LINK_GETPROCADDRESS(library##Library(), #functionName))); \
    111111            initialized = true; \
    112112        } \
     
    118118    static functionName##PtrType functionName##Ptr() \
    119119    { \
    120         static functionName##PtrType ptr; \
     120        static void* ptr; \
    121121        static bool initialized; \
    122122        \
    123123        if (!initialized) { \
    124             ptr = reinterpret_cast<resultType(callingConvention*)parameterDeclarations>(::EncodePointer(SOFT_LINK_GETPROCADDRESS(library##Library(), #functionName))); \
     124            ptr = ::EncodePointer(reinterpret_cast<void*>(SOFT_LINK_GETPROCADDRESS(library##Library(), #functionName))); \
    125125            initialized = true; \
    126126        } \
Note: See TracChangeset for help on using the changeset viewer.