[PATCH 0/6] MR10880: More -Wunused-but-set-global fixes.
From: Jacek Caban <jacek@codeweavers.com> Fixes -Wunused-but-set-global warnings. --- dlls/kernel32/tests/loader.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c index 3fa8bcef3ef..5bb32a5fd5b 100644 --- a/dlls/kernel32/tests/loader.c +++ b/dlls/kernel32/tests/loader.c @@ -54,15 +54,11 @@ static NTSTATUS (WINAPI *pNtSetInformationProcess)(HANDLE, PROCESSINFOCLASS, PVO static NTSTATUS (WINAPI *pNtTerminateProcess)(HANDLE, DWORD); static void (WINAPI *pLdrShutdownProcess)(void); static BOOLEAN (WINAPI *pRtlDllShutdownInProgress)(void); -static NTSTATUS (WINAPI *pNtAllocateVirtualMemory)(HANDLE, PVOID *, ULONG_PTR, SIZE_T *, ULONG, ULONG); -static NTSTATUS (WINAPI *pNtFreeVirtualMemory)(HANDLE, PVOID *, SIZE_T *, ULONG); static NTSTATUS (WINAPI *pLdrLockLoaderLock)(ULONG, ULONG *, ULONG_PTR *); -static NTSTATUS (WINAPI *pLdrUnlockLoaderLock)(ULONG, ULONG_PTR); static NTSTATUS (WINAPI *pLdrLoadDll)(LPCWSTR,DWORD *,const UNICODE_STRING *,HMODULE*); static NTSTATUS (WINAPI *pLdrUnloadDll)(HMODULE); static void (WINAPI *pRtlInitUnicodeString)(PUNICODE_STRING,LPCWSTR); static void (WINAPI *pRtlAcquirePebLock)(void); -static void (WINAPI *pRtlReleasePebLock)(void); static PVOID (WINAPI *pResolveDelayLoadedAPI)(PVOID, PCIMAGE_DELAYLOAD_DESCRIPTOR, PDELAYLOAD_FAILURE_DLL_CALLBACK, PDELAYLOAD_FAILURE_SYSTEM_ROUTINE, @@ -80,6 +76,13 @@ static HMODULE (WINAPI *pLoadPackagedLibrary)(LPCWSTR lpwLibFileName, DWORD Rese static NTSTATUS (WINAPI *pLdrRegisterDllNotification)(ULONG, PLDR_DLL_NOTIFICATION_FUNCTION, void *, void **); static NTSTATUS (WINAPI *pLdrUnregisterDllNotification)(void *); +#ifndef __arm__ +static NTSTATUS (WINAPI *pNtAllocateVirtualMemory)(HANDLE, PVOID *, ULONG_PTR, SIZE_T *, ULONG, ULONG); +static NTSTATUS (WINAPI *pNtFreeVirtualMemory)(HANDLE, PVOID *, SIZE_T *, ULONG); +static NTSTATUS (WINAPI *pLdrUnlockLoaderLock)(ULONG, ULONG_PTR); +static void (WINAPI *pRtlReleasePebLock)(void); +#endif + static PVOID RVAToAddr(DWORD_PTR rva, HMODULE module) { if (rva == 0) @@ -4847,19 +4850,21 @@ START_TEST(loader) pNtSetInformationProcess = (void *)GetProcAddress(ntdll, "NtSetInformationProcess"); pLdrShutdownProcess = (void *)GetProcAddress(ntdll, "LdrShutdownProcess"); pRtlDllShutdownInProgress = (void *)GetProcAddress(ntdll, "RtlDllShutdownInProgress"); - pNtAllocateVirtualMemory = (void *)GetProcAddress(ntdll, "NtAllocateVirtualMemory"); - pNtFreeVirtualMemory = (void *)GetProcAddress(ntdll, "NtFreeVirtualMemory"); pLdrLockLoaderLock = (void *)GetProcAddress(ntdll, "LdrLockLoaderLock"); - pLdrUnlockLoaderLock = (void *)GetProcAddress(ntdll, "LdrUnlockLoaderLock"); pLdrLoadDll = (void *)GetProcAddress(ntdll, "LdrLoadDll"); pLdrUnloadDll = (void *)GetProcAddress(ntdll, "LdrUnloadDll"); pRtlInitUnicodeString = (void *)GetProcAddress(ntdll, "RtlInitUnicodeString"); pRtlAcquirePebLock = (void *)GetProcAddress(ntdll, "RtlAcquirePebLock"); - pRtlReleasePebLock = (void *)GetProcAddress(ntdll, "RtlReleasePebLock"); pRtlImageDirectoryEntryToData = (void *)GetProcAddress(ntdll, "RtlImageDirectoryEntryToData"); pRtlImageNtHeader = (void *)GetProcAddress(ntdll, "RtlImageNtHeader"); pLdrRegisterDllNotification = (void *)GetProcAddress(ntdll, "LdrRegisterDllNotification"); pLdrUnregisterDllNotification = (void *)GetProcAddress(ntdll, "LdrUnregisterDllNotification"); +#ifndef __arm__ + pNtAllocateVirtualMemory = (void *)GetProcAddress(ntdll, "NtAllocateVirtualMemory"); + pNtFreeVirtualMemory = (void *)GetProcAddress(ntdll, "NtFreeVirtualMemory"); + pLdrUnlockLoaderLock = (void *)GetProcAddress(ntdll, "LdrUnlockLoaderLock"); + pRtlReleasePebLock = (void *)GetProcAddress(ntdll, "RtlReleasePebLock"); +#endif pFlsAlloc = (void *)GetProcAddress(kernel32, "FlsAlloc"); pFlsSetValue = (void *)GetProcAddress(kernel32, "FlsSetValue"); pFlsGetValue = (void *)GetProcAddress(kernel32, "FlsGetValue"); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10880
From: Jacek Caban <jacek@codeweavers.com> Fixes -Wunused-but-set-global warnings. --- dlls/mountmgr.sys/device.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/mountmgr.sys/device.c b/dlls/mountmgr.sys/device.c index 5ae4220931d..00708c5fed8 100644 --- a/dlls/mountmgr.sys/device.c +++ b/dlls/mountmgr.sys/device.c @@ -1994,6 +1994,7 @@ static BOOL create_port_device( DRIVER_OBJECT *driver, int n, const char *unix_p } else { + assert( driver == parallel_driver ); dos_name_format = L"LPT%u"; nt_name_format = L"\\Device\\Parallel%u"; reg_value_format = L"\\DosDevices\\LPT%u"; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10880
From: Jacek Caban <jacek@codeweavers.com> Fixes -Wunused-but-set-global warnings. --- dlls/ntdll/relay.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/dlls/ntdll/relay.c b/dlls/ntdll/relay.c index cb91562d615..493881962e9 100644 --- a/dlls/ntdll/relay.c +++ b/dlls/ntdll/relay.c @@ -72,12 +72,15 @@ struct relay_private_data static const WCHAR **debug_relay_excludelist; static const WCHAR **debug_relay_includelist; -static const WCHAR **debug_snoop_excludelist; -static const WCHAR **debug_snoop_includelist; static const WCHAR **debug_from_relay_excludelist; static const WCHAR **debug_from_relay_includelist; + +#ifdef __i386__ +static const WCHAR **debug_snoop_excludelist; +static const WCHAR **debug_snoop_includelist; static const WCHAR **debug_from_snoop_excludelist; static const WCHAR **debug_from_snoop_includelist; +#endif static RTL_RUN_ONCE init_once = RTL_RUN_ONCE_INIT; @@ -177,12 +180,14 @@ static DWORD WINAPI init_debug_lists( RTL_RUN_ONCE *once, void *param, void **co debug_relay_includelist = load_list( hkey, L"RelayInclude" ); debug_relay_excludelist = load_list( hkey, L"RelayExclude" ); - debug_snoop_includelist = load_list( hkey, L"SnoopInclude" ); - debug_snoop_excludelist = load_list( hkey, L"SnoopExclude" ); debug_from_relay_includelist = load_list( hkey, L"RelayFromInclude" ); debug_from_relay_excludelist = load_list( hkey, L"RelayFromExclude" ); +#ifdef __i386__ + debug_snoop_includelist = load_list( hkey, L"SnoopInclude" ); + debug_snoop_excludelist = load_list( hkey, L"SnoopExclude" ); debug_from_snoop_includelist = load_list( hkey, L"SnoopFromInclude" ); debug_from_snoop_excludelist = load_list( hkey, L"SnoopFromExclude" ); +#endif NtClose( hkey ); return TRUE; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10880
From: Jacek Caban <jacek@codeweavers.com> Fixes -Wunused-but-set-global warnings. --- dlls/ntdll/tests/wow64.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/dlls/ntdll/tests/wow64.c b/dlls/ntdll/tests/wow64.c index 84ff4945629..4ad6965b469 100644 --- a/dlls/ntdll/tests/wow64.c +++ b/dlls/ntdll/tests/wow64.c @@ -40,9 +40,13 @@ static NTSTATUS (WINAPI *pRtlWow64GetProcessMachines)(HANDLE,WORD*,WORD*); static NTSTATUS (WINAPI *pRtlWow64GetSharedInfoProcess)(HANDLE,BOOLEAN*,WOW64INFO*); static NTSTATUS (WINAPI *pRtlWow64IsWowGuestMachineSupported)(USHORT,BOOLEAN*); static NTSTATUS (WINAPI *pNtMapViewOfSectionEx)(HANDLE,HANDLE,PVOID*,const LARGE_INTEGER*,SIZE_T*,ULONG,ULONG,MEM_EXTENDED_PARAMETER*,ULONG); +#ifndef __arm__ static NTSTATUS (WINAPI *pNtSetLdtEntries)(ULONG,ULONG,ULONG,ULONG,ULONG,ULONG); -#ifdef _WIN64 +#endif +#ifdef __x86_64__ static NTSTATUS (WINAPI *pKiUserExceptionDispatcher)(EXCEPTION_RECORD*,CONTEXT*); +#endif +#ifdef _WIN64 static NTSTATUS (WINAPI *pRtlWow64GetCpuAreaInfo)(WOW64_CPURESERVED*,ULONG,WOW64_CPU_AREA_INFO*); static NTSTATUS (WINAPI *pRtlWow64GetThreadContext)(HANDLE,WOW64_CONTEXT*); static NTSTATUS (WINAPI *pRtlWow64GetThreadSelectorEntry)(HANDLE,THREAD_DESCRIPTOR_INFORMATION*,ULONG,ULONG*); @@ -120,7 +124,6 @@ static void init(void) #define GET_PROC(func) p##func = (void *)GetProcAddress( ntdll, #func ) GET_PROC( NtMapViewOfSectionEx ); - GET_PROC( NtSetLdtEntries ); GET_PROC( NtQuerySystemInformationEx ); GET_PROC( RtlGetNativeSystemInformation ); GET_PROC( RtlOpenCrossProcessEmulatorWorkConnection ); @@ -129,8 +132,13 @@ static void init(void) GET_PROC( RtlWow64GetProcessMachines ); GET_PROC( RtlWow64GetSharedInfoProcess ); GET_PROC( RtlWow64IsWowGuestMachineSupported ); -#ifdef _WIN64 +#ifndef __arm__ + GET_PROC( NtSetLdtEntries ); +#endif +#ifdef __x86_64__ GET_PROC( KiUserExceptionDispatcher ); +#endif +#ifdef _WIN64 GET_PROC( RtlWow64GetCpuAreaInfo ); GET_PROC( RtlWow64GetThreadContext ); GET_PROC( RtlWow64GetThreadSelectorEntry ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10880
From: Jacek Caban <jacek@codeweavers.com> Fixes -Wunused-but-set-global warnings. --- dlls/ntoskrnl.exe/tests/driver_netio.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/dlls/ntoskrnl.exe/tests/driver_netio.c b/dlls/ntoskrnl.exe/tests/driver_netio.c index 91d518192cc..3d3d0ca71d4 100644 --- a/dlls/ntoskrnl.exe/tests/driver_netio.c +++ b/dlls/ntoskrnl.exe/tests/driver_netio.c @@ -45,7 +45,6 @@ #define ntohl(x) RtlUlongByteSwap(x) #define ntohs(x) RtlUshortByteSwap(x) -static DRIVER_OBJECT *driver_obj; static DEVICE_OBJECT *device_obj; static const WCHAR driver_link[] = L"\\DosDevices\\winetest_netio"; @@ -552,8 +551,6 @@ NTSTATUS WINAPI DriverEntry(DRIVER_OBJECT *driver, PUNICODE_STRING registry) DbgPrint("Loading driver.\n"); - driver_obj = driver; - driver->DriverUnload = driver_unload; driver->MajorFunction[IRP_MJ_CREATE] = driver_create; driver->MajorFunction[IRP_MJ_DEVICE_CONTROL] = driver_iocontrol; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10880
From: Jacek Caban <jacek@codeweavers.com> Fixes -Wunused-but-set-global warnings. --- dlls/windows.media.speech/tests/speech.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/dlls/windows.media.speech/tests/speech.c b/dlls/windows.media.speech/tests/speech.c index 5fff0728832..540fa13311a 100644 --- a/dlls/windows.media.speech/tests/speech.c +++ b/dlls/windows.media.speech/tests/speech.c @@ -58,8 +58,6 @@ #define IAsyncHandler_IInspectable_iface IAsyncOperationCompletedHandler_IInspectable_iface HRESULT (WINAPI *pDllGetActivationFactory)(HSTRING, IActivationFactory **); -static BOOL is_win10_1507 = FALSE; -static BOOL is_win10_1709 = FALSE; static inline LONG get_ref(IUnknown *obj) { @@ -795,7 +793,6 @@ static void test_ActivationFactory(void) ref = ISpeechRecognizerStatics2_Release(recognizer_statics2); ok(ref == 2, "Got unexpected refcount: %lu.\n", ref); } - else is_win10_1507 = TRUE; check_interface(factory3, &IID_IInstalledVoicesStatic, FALSE); @@ -1262,8 +1259,6 @@ skip_voices: ref = ISpeechSynthesizerOptions3_Release(options3); ok(ref == 2, "Got unexpected ref %lu.\n", ref); } - else - is_win10_1709 = TRUE; ref = ISpeechSynthesizerOptions_Release(options); ok(ref == 1, "Got unexpected ref %lu.\n", ref); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10880
participants (2)
-
Jacek Caban -
Jacek Caban (@jacek)