[PATCH v2 0/4] MR11127: More -Wunused-but-set-global fixes.
-- v2: shcore/tests: Remove unused variables. wpcap/tests: Remove unused variables. scrobj/tests: Remove unused variables. ieframe/tests: Add missing CHECK_CALLED statements. https://gitlab.winehq.org/wine/wine/-/merge_requests/11127
From: Jacek Caban <jacek@codeweavers.com> Fixes -Wunused-but-set-global warnings. --- dlls/ieframe/tests/webbrowser.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/dlls/ieframe/tests/webbrowser.c b/dlls/ieframe/tests/webbrowser.c index e887039434f..8c514a6ffc2 100644 --- a/dlls/ieframe/tests/webbrowser.c +++ b/dlls/ieframe/tests/webbrowser.c @@ -2930,18 +2930,20 @@ static void test_QueryStatusWB(IWebBrowser2 *webbrowser, BOOL has_document) * is enabled and IDM_STOP is not. */ status = 0xdeadbeef; - if (use_container_olecmd) SET_EXPECT(QueryStatus_STOP); + if (use_container_olecmd && has_document) SET_EXPECT(QueryStatus_STOP); hres = IWebBrowser2_QueryStatusWB(webbrowser, OLECMDID_STOP, &status); ok(hres == success_state, "QueryStatusWB failed: %08lx %08lx\n", hres, success_state); todo_wine_if (!use_container_olecmd && has_document) ok((has_document && status == success_flags) || (!has_document && status == 0xdeadbeef), "OLECMDID_STOP not enabled/supported: %08x %08x\n", status, success_flags); + if (use_container_olecmd && has_document) CHECK_CALLED(QueryStatus_STOP); status = 0xdeadbeef; - if (use_container_olecmd) SET_EXPECT(QueryStatus_IDM_STOP); + if (use_container_olecmd && has_document) SET_EXPECT(QueryStatus_IDM_STOP); hres = IWebBrowser2_QueryStatusWB(webbrowser, IDM_STOP, &status); ok(hres == success_state, "QueryStatusWB failed: %08lx %08lx\n", hres, success_state); ok((has_document && status == 0) || (!has_document && status == 0xdeadbeef), "IDM_STOP is enabled/supported: %08x %d\n", status, has_document); + if (use_container_olecmd && has_document) CHECK_CALLED(QueryStatus_IDM_STOP); } static void test_ExecWB(IWebBrowser2 *webbrowser, BOOL has_document) @@ -2965,24 +2967,29 @@ static void test_ExecWB(IWebBrowser2 *webbrowser, BOOL has_document) * These tests show that QueryStatusWB uses a NULL pguidCmdGroup, since OLECMDID_STOP * succeeds (S_OK) and IDM_STOP does not (OLECMDERR_E_NOTSUPPORTED). */ - if(use_container_olecmd) { - SET_EXPECT(Exec_STOP); - }else if(has_document) { + if(has_document) { + if(use_container_olecmd) + SET_EXPECT(Exec_STOP); SET_EXPECT(Invoke_STATUSTEXTCHANGE); SET_EXPECT(SetStatusText); } hres = IWebBrowser2_ExecWB(webbrowser, OLECMDID_STOP, OLECMDEXECOPT_DONTPROMPTUSER, 0, 0); - if(!use_container_olecmd && has_document) { - todo_wine ok(hres == olecmdid_state, "ExecWB failed: %08lx %08lx\n", hres, olecmdid_state); + if(has_document) { + if(use_container_olecmd) + CHECK_CALLED(Exec_STOP); + else + todo_wine ok(hres == olecmdid_state, "ExecWB failed: %08lx %08lx\n", hres, olecmdid_state); CLEAR_CALLED(Invoke_STATUSTEXTCHANGE); /* Called by IE9 */ CLEAR_CALLED(SetStatusText); /* Called by IE9 */ }else { ok(hres == olecmdid_state, "ExecWB failed: %08lx %08lx\n", hres, olecmdid_state); } - if (use_container_olecmd) + if (use_container_olecmd && has_document) SET_EXPECT(Exec_IDM_STOP); hres = IWebBrowser2_ExecWB(webbrowser, IDM_STOP, OLECMDEXECOPT_DONTPROMPTUSER, 0, 0); ok(hres == idm_state, "ExecWB failed: %08lx %08lx\n", hres, idm_state); + if (use_container_olecmd && has_document) + CHECK_CALLED(Exec_IDM_STOP); } static void test_download(DWORD flags) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11127
From: Jacek Caban <jacek@codeweavers.com> Fixes -Wunused-but-set-global warnings. --- dlls/scrobj/tests/scrobj.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dlls/scrobj/tests/scrobj.c b/dlls/scrobj/tests/scrobj.c index 64b07832227..21d8f0b704c 100644 --- a/dlls/scrobj/tests/scrobj.c +++ b/dlls/scrobj/tests/scrobj.c @@ -95,7 +95,6 @@ DEFINE_EXPECT(InitNew); DEFINE_EXPECT(Close); DEFINE_EXPECT(SetScriptSite); DEFINE_EXPECT(QI_IActiveScriptParse); -DEFINE_EXPECT(SetScriptState_INITIALIZED); DEFINE_EXPECT(SetScriptState_UNINITIALIZED); DEFINE_EXPECT(SetScriptState_STARTED); DEFINE_EXPECT(AddNamedItem_scriptlet); @@ -445,9 +444,6 @@ static HRESULT WINAPI ActiveScript_SetScriptState(IActiveScript *iface, SCRIPTST { switch(ss) { - case SCRIPTSTATE_INITIALIZED: - CHECK_EXPECT(SetScriptState_INITIALIZED); - break; case SCRIPTSTATE_UNINITIALIZED: CHECK_EXPECT(SetScriptState_UNINITIALIZED); break; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11127
From: Jacek Caban <jacek@codeweavers.com> Fixes -Wunused-but-set-global warnings. --- dlls/wpcap/tests/wpcap.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/dlls/wpcap/tests/wpcap.c b/dlls/wpcap/tests/wpcap.c index a7abf8042f6..d0ce22a4842 100644 --- a/dlls/wpcap/tests/wpcap.c +++ b/dlls/wpcap/tests/wpcap.c @@ -75,7 +75,6 @@ struct pcap_pkthdr }; static int (CDECL *ppcap_activate)( pcap_t * ); -static void (CDECL *ppcap_breakloop)( pcap_t * ); static int (CDECL *ppcap_bufsize)( pcap_t * ); static int (CDECL *ppcap_can_set_rfmon)( pcap_t * ); static void (CDECL *ppcap_close)( pcap_t * ); @@ -106,9 +105,6 @@ static int (CDECL *ppcap_list_datalinks)( pcap_t *, int ** ); static int (CDECL *ppcap_list_tstamp_types)( pcap_t *, int ** ); static char * (CDECL *ppcap_lookupdev)( char * ); static int (CDECL *ppcap_lookupnet)( const char *, unsigned int *, unsigned int *, char * ); -static int (CDECL *ppcap_loop)( pcap_t *, int, - void (CDECL *)(unsigned char *, const struct pcap_pkthdr *, const unsigned char *), - unsigned char * ); static int (CDECL *ppcap_set_buffer_size)( pcap_t *, int ); static int (CDECL *ppcap_set_datalink)( pcap_t *, int ); static int (CDECL *ppcap_set_immediate_mode)( pcap_t *, int ); @@ -118,9 +114,6 @@ static int (CDECL *ppcap_set_tstamp_precision)( pcap_t *, int ); static int (CDECL *ppcap_setfilter)( pcap_t *, struct bpf_program * ); static int (CDECL *ppcap_snapshot)( pcap_t * ); static int (CDECL *ppcap_stats)( pcap_t *, struct pcap_stat * ); -static int CDECL (*ppcap_tstamp_type_name_to_val)( const char * ); -static const char * (CDECL *ppcap_tstamp_type_val_to_description)( int ); -static const char * (CDECL *ppcap_tstamp_type_val_to_name)( int ); static void CDECL capture_callback( unsigned char *user, const struct pcap_pkthdr *hdr, const unsigned char *bytes ) { @@ -333,7 +326,6 @@ START_TEST( wpcap ) return; } ppcap_activate = (void *)GetProcAddress( module, "pcap_activate" ); - ppcap_breakloop = (void *)GetProcAddress( module, "pcap_breakloop" ); ppcap_bufsize = (void *)GetProcAddress( module, "pcap_bufsize" ); ppcap_can_set_rfmon = (void *)GetProcAddress( module, "pcap_can_set_rfmon" ); ppcap_close = (void *)GetProcAddress( module, "pcap_close" ); @@ -362,7 +354,6 @@ START_TEST( wpcap ) ppcap_list_tstamp_types = (void *)GetProcAddress( module, "pcap_list_tstamp_types" ); ppcap_lookupdev = (void *)GetProcAddress( module, "pcap_lookupdev" ); ppcap_lookupnet = (void *)GetProcAddress( module, "pcap_lookupnet" ); - ppcap_loop = (void *)GetProcAddress( module, "pcap_loop" ); ppcap_set_buffer_size = (void *)GetProcAddress( module, "pcap_set_buffer_size" ); ppcap_set_datalink = (void *)GetProcAddress( module, "pcap_set_datalink" ); ppcap_set_immediate_mode = (void *)GetProcAddress( module, "pcap_set_immediate_mode" ); @@ -372,9 +363,6 @@ START_TEST( wpcap ) ppcap_setfilter = (void *)GetProcAddress( module, "pcap_setfilter" ); ppcap_snapshot = (void *)GetProcAddress( module, "pcap_snapshot" ); ppcap_stats = (void *)GetProcAddress( module, "pcap_stats" ); - ppcap_tstamp_type_name_to_val = (void *)GetProcAddress( module, "pcap_tstamp_type_name_to_val" ); - ppcap_tstamp_type_val_to_description = (void *)GetProcAddress( module, "pcap_tstamp_type_val_to_description" ); - ppcap_tstamp_type_val_to_name = (void *)GetProcAddress( module, "pcap_tstamp_type_val_to_name" ); trace( "lib version %s\n", ppcap_lib_version() ); trace( "supports PCAP_MMAP_32BIT: %s\n", (ppcap_init(PCAP_MMAP_32BIT, errbuf) < 0) ? "no" : "yes" ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11127
From: Jacek Caban <jacek@codeweavers.com> Fixes -Wunused-but-set-global warnings. --- dlls/shcore/tests/shcore.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/dlls/shcore/tests/shcore.c b/dlls/shcore/tests/shcore.c index bae7c332076..acdeedd2737 100644 --- a/dlls/shcore/tests/shcore.c +++ b/dlls/shcore/tests/shcore.c @@ -60,7 +60,6 @@ static const char * test_envvar1 = "bar"; static const char * test_envvar2 = "ImARatherLongButIndeedNeededString"; static char test_exp_path1[MAX_PATH]; static char test_exp_path2[MAX_PATH]; -static DWORD exp_len1; static DWORD exp_len2; static const char * initial_buffer ="0123456789"; @@ -378,7 +377,6 @@ static HKEY create_test_entries(void) { HKEY hKey; DWORD ret; - DWORD nExpectedLen1, nExpectedLen2; SetEnvironmentVariableA("LONGSYSTEMVAR", test_envvar1); SetEnvironmentVariableA("FOO", test_envvar2); @@ -393,15 +391,10 @@ static HKEY create_test_entries(void) ok(!RegSetValueExA(hKey, "Test3", 0, REG_EXPAND_SZ, (BYTE *)test_path2, strlen(test_path2)+1), "RegSetValueExA failed\n"); } - exp_len1 = ExpandEnvironmentStringsA(test_path1, test_exp_path1, sizeof(test_exp_path1)); - exp_len2 = ExpandEnvironmentStringsA(test_path2, test_exp_path2, sizeof(test_exp_path2)); + ExpandEnvironmentStringsA(test_path1, test_exp_path1, sizeof(test_exp_path1)); + ExpandEnvironmentStringsA(test_path2, test_exp_path2, sizeof(test_exp_path2)); - nExpectedLen1 = strlen(test_path1) - strlen("%LONGSYSTEMVAR%") + strlen(test_envvar1) + 1; - nExpectedLen2 = strlen(test_path2) - strlen("%FOO%") + strlen(test_envvar2) + 1; - - /* Make sure we carry on with correct values */ - exp_len1 = nExpectedLen1; - exp_len2 = nExpectedLen2; + exp_len2 = strlen(test_path2) - strlen("%FOO%") + strlen(test_envvar2) + 1; return hKey; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11127
participants (2)
-
Jacek Caban -
Jacek Caban (@jacek)