The typeof keyword is a GCC extension that is not part of any standard and not available in MSVC. We should probably stop using typeof everywhere, but these patches just eliminate its use in places where it is both easy to replace and impossible to avoid via ./configure.
There are two open bug reports about the use of typeof in Wine: https://bugs.winehq.org/show_bug.cgi?id=20474 https://bugs.winehq.org/show_bug.cgi?id=20476
Alex Henrie (3): d3dcompiler_43/tests: Avoid using GCC's typeof extension gdi32: Avoid using GCC's typeof extension imm32: Avoid using GCC's typeof extension
dlls/d3dcompiler_43/tests/blob.c | 6 ++--- dlls/d3dcompiler_43/tests/reflection.c | 2 +- dlls/gdi32/driver.c | 6 ++--- dlls/imm32/imm.c | 34 ++++++++++++-------------- 4 files changed, 23 insertions(+), 25 deletions(-)
Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- dlls/d3dcompiler_43/tests/blob.c | 6 +++--- dlls/d3dcompiler_43/tests/reflection.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/d3dcompiler_43/tests/blob.c b/dlls/d3dcompiler_43/tests/blob.c index cc629fad84..1722a0de80 100644 --- a/dlls/d3dcompiler_43/tests/blob.c +++ b/dlls/d3dcompiler_43/tests/blob.c @@ -33,9 +33,9 @@ */ #define D3DERR_INVALIDCALL 0x8876086c
-static typeof(D3DCreateBlob) *pD3DCreateBlob; -static typeof(D3DGetBlobPart) *pD3DGetBlobPart; -static typeof(D3DStripShader) *pD3DStripShader; +static HRESULT WINAPI (*pD3DCreateBlob)(SIZE_T, ID3DBlob **); +static HRESULT WINAPI (*pD3DGetBlobPart)(const void *, SIZE_T, D3D_BLOB_PART, UINT, ID3DBlob **); +static HRESULT WINAPI (*pD3DStripShader)(const void *, SIZE_T, UINT, ID3DBlob **);
#define MAKE_TAG(ch0, ch1, ch2, ch3) \ ((DWORD)(ch0) | ((DWORD)(ch1) << 8) | \ diff --git a/dlls/d3dcompiler_43/tests/reflection.c b/dlls/d3dcompiler_43/tests/reflection.c index 5a85159d89..a0af85d91b 100644 --- a/dlls/d3dcompiler_43/tests/reflection.c +++ b/dlls/d3dcompiler_43/tests/reflection.c @@ -38,7 +38,7 @@ */ #define D3DERR_INVALIDCALL 0x8876086c
-static typeof(D3DReflect) *pD3DReflect; +static HRESULT WINAPI (*pD3DReflect)(const void *, SIZE_T, REFIID, void **);
/* Creator string for comparison - Version 9.29.952.3111 (43) */ static DWORD shader_creator[] = {
Alex Henrie alexhenrie24@gmail.com wrote:
+static HRESULT WINAPI (*pD3DCreateBlob)(SIZE_T, ID3DBlob **); +static HRESULT WINAPI (*pD3DGetBlobPart)(const void *, SIZE_T, D3D_BLOB_PART, UINT, ID3DBlob **); +static HRESULT WINAPI (*pD3DStripShader)(const void *, SIZE_T, UINT, ID3DBlob **);
WINAPI should be inside the brackets to become the part of the pointer type, and not a return type, otherwise MSVC won't compile it.
On Wed, Sep 19, 2018 at 10:38 PM Dmitry Timoshkov dmitry@baikal.ru wrote:
Alex Henrie alexhenrie24@gmail.com wrote:
+static HRESULT WINAPI (*pD3DCreateBlob)(SIZE_T, ID3DBlob **); +static HRESULT WINAPI (*pD3DGetBlobPart)(const void *, SIZE_T, D3D_BLOB_PART, UINT, ID3DBlob **); +static HRESULT WINAPI (*pD3DStripShader)(const void *, SIZE_T, UINT, ID3DBlob **);
WINAPI should be inside the brackets to become the part of the pointer type, and not a return type, otherwise MSVC won't compile it.
Thanks for catching that. I just sent corrected patches.
-Alex
Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- dlls/gdi32/driver.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c index ce60d110d9..e765d2b360 100644 --- a/dlls/gdi32/driver.c +++ b/dlls/gdi32/driver.c @@ -61,9 +61,9 @@ static CRITICAL_SECTION_DEBUG critsect_debug = }; static CRITICAL_SECTION driver_section = { &critsect_debug, -1, 0, 0, 0, 0 };
-static typeof(GetDesktopWindow) *pGetDesktopWindow; -static typeof(GetSystemMetrics) *pGetSystemMetrics; -static typeof(SetThreadDpiAwarenessContext) *pSetThreadDpiAwarenessContext; +static HWND WINAPI (*pGetDesktopWindow)(void); +static INT WINAPI (*pGetSystemMetrics)(INT); +static DPI_AWARENESS_CONTEXT WINAPI (*pSetThreadDpiAwarenessContext)(DPI_AWARENESS_CONTEXT);
/********************************************************************** * create_driver
Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- dlls/imm32/imm.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-)
diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c index f235e228ad..0076fbd35e 100644 --- a/dlls/imm32/imm.c +++ b/dlls/imm32/imm.c @@ -40,7 +40,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(imm); #define IMM_INIT_MAGIC 0x19650412 BOOL WINAPI User32InitializeImmEntryTable(DWORD);
-#define MAKE_FUNCPTR(f) typeof(f) * p##f typedef struct _tagImmHkl{ struct list entry; HKL hkl; @@ -51,24 +50,23 @@ typedef struct _tagImmHkl{ HWND UIWnd;
/* Function Pointers */ - MAKE_FUNCPTR(ImeInquire); - MAKE_FUNCPTR(ImeConfigure); - MAKE_FUNCPTR(ImeDestroy); - MAKE_FUNCPTR(ImeEscape); - MAKE_FUNCPTR(ImeSelect); - MAKE_FUNCPTR(ImeSetActiveContext); - MAKE_FUNCPTR(ImeToAsciiEx); - MAKE_FUNCPTR(NotifyIME); - MAKE_FUNCPTR(ImeRegisterWord); - MAKE_FUNCPTR(ImeUnregisterWord); - MAKE_FUNCPTR(ImeEnumRegisterWord); - MAKE_FUNCPTR(ImeSetCompositionString); - MAKE_FUNCPTR(ImeConversionList); - MAKE_FUNCPTR(ImeProcessKey); - MAKE_FUNCPTR(ImeGetRegisterWordStyle); - MAKE_FUNCPTR(ImeGetImeMenuItems); + BOOL WINAPI (*pImeInquire)(IMEINFO *, WCHAR *, const WCHAR *); + BOOL WINAPI (*pImeConfigure)(HKL, HWND, DWORD, void *); + BOOL WINAPI (*pImeDestroy)(UINT); + LRESULT WINAPI (*pImeEscape)(HIMC, UINT, void *); + BOOL WINAPI (*pImeSelect)(HIMC, BOOL); + BOOL WINAPI (*pImeSetActiveContext)(HIMC, BOOL); + UINT WINAPI (*pImeToAsciiEx)(UINT, UINT, const BYTE *, DWORD *, UINT, HIMC); + BOOL WINAPI (*pNotifyIME)(HIMC, DWORD, DWORD, DWORD); + BOOL WINAPI (*pImeRegisterWord)(const WCHAR *, DWORD, const WCHAR *); + BOOL WINAPI (*pImeUnregisterWord)(const WCHAR *, DWORD, const WCHAR *); + UINT WINAPI (*pImeEnumRegisterWord)(REGISTERWORDENUMPROCW, const WCHAR *, DWORD, const WCHAR *, void *); + BOOL WINAPI (*pImeSetCompositionString)(HIMC, DWORD, const void *, DWORD, const void *, DWORD); + DWORD WINAPI (*pImeConversionList)(HIMC, const WCHAR *, CANDIDATELIST *, DWORD, UINT); + BOOL WINAPI (*pImeProcessKey)(HIMC, UINT, LPARAM, const BYTE *); + UINT WINAPI (*pImeGetRegisterWordStyle)(UINT, STYLEBUFW *); + DWORD WINAPI (*pImeGetImeMenuItems)(HIMC, DWORD, DWORD, IMEMENUITEMINFOW *, IMEMENUITEMINFOW *, DWORD); } ImmHkl; -#undef MAKE_FUNCPTR
typedef struct tagInputContextData {