https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a08b83a90ba494dfe62b8bf618e548c4926666ea
commit a08b83a90ba494dfe62b8bf618e548c4926666ea Author: Joachim Henze <joachim.he...@reactos.org> AuthorDate: Mon Feb 26 13:42:13 2024 +0100 Commit: GitHub <nore...@github.com> CommitDate: Mon Feb 26 13:42:13 2024 +0100 [SHELL32] Fix 2 compiler warnings for the rls-cfg 'unused variable' (#6539) I noticed it on releases/0.4.10 with the RosBEWin2.1.6 GCC4.7.2 *rls* configuration: C:/0410rls/reactos/dll/win32/shell32/dialogs/filetypes.cpp: In function 'BOOL FileTypesDlg_InsertToLV(HWND, LPCWSTR, INT, LPCWSTR)': C:/0410rls/reactos/dll/win32/shell32/dialogs/filetypes.cpp:663:9: warning: variable 'iLargeImage' set but not used [-Wunused-but-set-variable] C:/0410rls/reactos/dll/win32/shell32/dialogs/filetypes.cpp: In function 'BOOL EditTypeDlg_UpdateEntryIcon(HWND, PEDITTYPE_DIALOG, LPCWSTR, INT)': C:/0410rls/reactos/dll/win32/shell32/dialogs/filetypes.cpp:1040:9: warning: unused variable 'iLargeImage' [-Wunused-variable] But I do assume, that MSVC compilers would also complain about that in *rls* cfg. Please notice that before 0.4.10-dev-202-g 698cbc6184722f29389ccd75ca96d88d6cd4b010 which did splitup and restructure the code this function was placed within the file folder_options.cpp and was named InsertFileType(HWND hDlgCtrl, WCHAR * szName, PINT iItem, WCHAR * szFile) and not yet within file_types.cpp with the new name FileTypesDlg_InsertToLV(HWND hListView, LPCWSTR szName, INT iItem, LPCWSTR szFile) Back then it did not have the iLargeImage variable yet, and it also didn't warn upon rls-cfg-compilation. Therefore 0.4.10-dev-202-g 698cbc6184722f29389ccd75ca96d88d6cd4b010 from (#582) is indeed the *guilty revision* (2018-06-06). It was done in the very first commit of that PR https://github.com/reactos/reactos/pull/582/commits/2fe0eab7216425f6b963e55f55986110d2151c6b It's bad practice to move and refactor/extend code in functionality within the very same commit, as it makes reviewing the changes much harder. That assert never fired for the last 6 years, therefore it would have been okay also to strip it together with the variable, but using DBG_UNREFERENCED_LOCAL_VARIABLE(iLargeImage); allows to keep the assert for master. --- dll/win32/shell32/dialogs/filetypes.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dll/win32/shell32/dialogs/filetypes.cpp b/dll/win32/shell32/dialogs/filetypes.cpp index ad394c8b1d3..2c245d717ba 100644 --- a/dll/win32/shell32/dialogs/filetypes.cpp +++ b/dll/win32/shell32/dialogs/filetypes.cpp @@ -666,6 +666,7 @@ FileTypesDlg_InsertToLV(HWND hListView, LPCWSTR szName, INT iItem, LPCWSTR szFil iLargeImage = ImageList_AddIcon(himlLarge, Entry->hIconLarge); iSmallImage = ImageList_AddIcon(himlSmall, Entry->hIconSmall); ASSERT(iLargeImage == iSmallImage); + DBG_UNREFERENCED_LOCAL_VARIABLE(iLargeImage); } // Do not add excluded entries @@ -1041,6 +1042,7 @@ EditTypeDlg_UpdateEntryIcon(HWND hwndDlg, PEDITTYPE_DIALOG pEditType, INT iLargeImage = ImageList_AddIcon(himlLarge, pEntry->hIconLarge); INT iSmallImage = ImageList_AddIcon(himlSmall, pEntry->hIconSmall); ASSERT(iLargeImage == iSmallImage); + DBG_UNREFERENCED_LOCAL_VARIABLE(iLargeImage); INT iItem = ListView_GetNextItem(hListView, -1, LVNI_SELECTED); if (iItem != -1)