From a755e6e63f55697a6419e63bff1d607cf8d085d6 Mon Sep 17 00:00:00 2001 From: Germano Cavalcante Date: Tue, 14 Feb 2023 15:35:36 -0300 Subject: [PATCH] Revert "MSVC: lower C4100 warning level from 4 to 3" This reverts commit db4e7616f3590c04484fe8a015b6a02b7a1ede44. Caused many issues when compiling mantaflow. --- CMakeLists.txt | 1 - build_files/cmake/macros.cmake | 3 +-- intern/ghost/intern/GHOST_DropTargetWin32.cpp | 6 +++--- intern/ghost/intern/GHOST_ImeWin32.cpp | 6 +++--- intern/ghost/intern/GHOST_SystemWin32.cpp | 10 ++++------ intern/ghost/intern/GHOST_TrackpadWin32.cpp | 4 ++-- intern/ghost/intern/GHOST_WindowWin32.cpp | 13 ++++--------- intern/guardedalloc/intern/mallocn_intern.h | 3 --- source/blender/blenlib/BLI_utildefines.h | 3 --- source/blender/blenlib/intern/BLI_filelist.c | 2 -- source/blender/makesrna/intern/CMakeLists.txt | 3 --- source/blender/python/intern/stubs.c | 3 --- source/creator/blender_launcher_win32.c | 5 ----- 13 files changed, 17 insertions(+), 45 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 46c1b78c496..7b61275522a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1631,7 +1631,6 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC") # warning level: "/W3" "/w34062" # switch statement contains 'default' but no 'case' labels - "/w34100" # 'identifier' : unreferenced formal parameter "/w34115" # 'type' : named type definition in parentheses "/w34189" # local variable is initialized but not referenced # see https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/c5038?view=vs-2017 diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index 07e442ddbcd..fe3bb9d4737 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -702,7 +702,6 @@ macro(remove_strict_flags) endif() if(MSVC) - remove_cc_flag(/w34100) # Restore warn C4100 (unreferenced formal parameter) back to w4 remove_cc_flag(/w34189) # Restore warn C4189 (unused variable) back to w4 endif() @@ -722,7 +721,7 @@ macro(remove_extra_strict_flags) endif() if(MSVC) - remove_cc_flag(/w34100) # Restore warn C4100 (unreferenced formal parameter) back to w4 + # TODO endif() endmacro() diff --git a/intern/ghost/intern/GHOST_DropTargetWin32.cpp b/intern/ghost/intern/GHOST_DropTargetWin32.cpp index a26377ca6d1..86483118b3d 100644 --- a/intern/ghost/intern/GHOST_DropTargetWin32.cpp +++ b/intern/ghost/intern/GHOST_DropTargetWin32.cpp @@ -78,7 +78,7 @@ ULONG __stdcall GHOST_DropTargetWin32::Release(void) * Implementation of IDropTarget::DragEnter */ HRESULT __stdcall GHOST_DropTargetWin32::DragEnter(IDataObject *p_data_object, - DWORD /*grf_key_state*/, + DWORD grf_key_state, POINTL pt, DWORD *pdw_effect) { @@ -95,7 +95,7 @@ HRESULT __stdcall GHOST_DropTargetWin32::DragEnter(IDataObject *p_data_object, /* * Implementation of IDropTarget::DragOver */ -HRESULT __stdcall GHOST_DropTargetWin32::DragOver(DWORD /*grf_key_state*/, +HRESULT __stdcall GHOST_DropTargetWin32::DragOver(DWORD grf_key_state, POINTL pt, DWORD *pdw_effect) { @@ -128,7 +128,7 @@ HRESULT __stdcall GHOST_DropTargetWin32::DragLeave(void) * the implementation of IDropTarget::DragOver */ HRESULT __stdcall GHOST_DropTargetWin32::Drop(IDataObject *p_data_object, - DWORD /*grf_key_state*/, + DWORD grf_key_state, POINTL pt, DWORD *pdw_effect) { diff --git a/intern/ghost/intern/GHOST_ImeWin32.cpp b/intern/ghost/intern/GHOST_ImeWin32.cpp index 764a6a1e241..780d93ac995 100644 --- a/intern/ghost/intern/GHOST_ImeWin32.cpp +++ b/intern/ghost/intern/GHOST_ImeWin32.cpp @@ -140,7 +140,7 @@ void GHOST_ImeWin32::SetImeWindowStyle( ::DefWindowProc(window_handle, message, wparam, lparam); } -void GHOST_ImeWin32::DestroyImeWindow(HWND /*window_handle*/) +void GHOST_ImeWin32::DestroyImeWindow(HWND window_handle) { /* Destroy the system caret if we have created for this IME input context. */ if (system_caret_) { @@ -149,7 +149,7 @@ void GHOST_ImeWin32::DestroyImeWindow(HWND /*window_handle*/) } } -void GHOST_ImeWin32::MoveImeWindow(HWND /*window_handle*/, HIMC imm_context) +void GHOST_ImeWin32::MoveImeWindow(HWND window_handle, HIMC imm_context) { int x = caret_rect_.m_l; int y = caret_rect_.m_t; @@ -228,7 +228,7 @@ void GHOST_ImeWin32::CheckFirst(HWND window_handle) } } -void GHOST_ImeWin32::ResetComposition(HWND /*window_handle*/) +void GHOST_ImeWin32::ResetComposition(HWND window_handle) { /* Currently, just reset the composition status. */ is_composing_ = false; diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 9c527985ad3..9fc69dabe00 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -217,7 +217,7 @@ GHOST_IWindow *GHOST_SystemWin32::createWindow(const char *title, uint32_t height, GHOST_TWindowState state, GHOST_GLSettings glSettings, - const bool /*exclusive*/, + const bool exclusive, const bool is_dialog, const GHOST_IWindow *parentWindow) { @@ -568,7 +568,7 @@ GHOST_TKey GHOST_SystemWin32::hardKey(RAWINPUT const &raw, bool *r_key_down) * This function was added in response to bug #25715. * This is going to be a long list #42426. */ -GHOST_TKey GHOST_SystemWin32::processSpecialKey(short vKey, short /*scanCode*/) const +GHOST_TKey GHOST_SystemWin32::processSpecialKey(short vKey, short scanCode) const { GHOST_TKey key = GHOST_kKeyUnknown; if (vKey == 0xFF) { @@ -1148,9 +1148,7 @@ GHOST_EventCursor *GHOST_SystemWin32::processCursorEvent(GHOST_WindowWin32 *wind GHOST_TABLET_DATA_NONE); } -void GHOST_SystemWin32::processWheelEvent(GHOST_WindowWin32 *window, - WPARAM wParam, - LPARAM /*lParam*/) +void GHOST_SystemWin32::processWheelEvent(GHOST_WindowWin32 *window, WPARAM wParam, LPARAM lParam) { GHOST_SystemWin32 *system = (GHOST_SystemWin32 *)getSystem(); @@ -2183,7 +2181,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, uint msg, WPARAM wParam, return lResult; } -char *GHOST_SystemWin32::getClipboard(bool /*selection*/) const +char *GHOST_SystemWin32::getClipboard(bool selection) const { if (IsClipboardFormatAvailable(CF_UNICODETEXT) && OpenClipboard(NULL)) { wchar_t *buffer; diff --git a/intern/ghost/intern/GHOST_TrackpadWin32.cpp b/intern/ghost/intern/GHOST_TrackpadWin32.cpp index 4d5ce6fabe1..d5317f0f780 100644 --- a/intern/ghost/intern/GHOST_TrackpadWin32.cpp +++ b/intern/ghost/intern/GHOST_TrackpadWin32.cpp @@ -265,14 +265,14 @@ HRESULT GHOST_DirectManipulationViewportEventHandler::OnViewportStatusChanged( } HRESULT GHOST_DirectManipulationViewportEventHandler::OnViewportUpdated( - IDirectManipulationViewport * /*viewport*/) + IDirectManipulationViewport *viewport) { /* Nothing to do here. */ return S_OK; } HRESULT GHOST_DirectManipulationViewportEventHandler::OnContentUpdated( - IDirectManipulationViewport * /*viewport*/, IDirectManipulationContent *content) + IDirectManipulationViewport *viewport, IDirectManipulationContent *content) { float transform[6]; HRESULT hr = content->GetContentTransform(transform, ARRAYSIZE(transform)); diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index 06d9ea939e0..3e82f55c583 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -898,7 +898,7 @@ GHOST_TSuccess GHOST_WindowWin32::hasCursorShape(GHOST_TStandardCursor cursorSha } GHOST_TSuccess GHOST_WindowWin32::getPointerInfo( - std::vector &outPointerInfo, WPARAM wParam, LPARAM /*lParam*/) + std::vector &outPointerInfo, WPARAM wParam, LPARAM lParam) { int32_t pointerId = GET_POINTERID_WPARAM(wParam); int32_t isPrimary = IS_POINTER_PRIMARY_WPARAM(wParam); @@ -1109,13 +1109,8 @@ static uint16_t uns16ReverseBits(uint16_t shrt) } #endif -GHOST_TSuccess GHOST_WindowWin32::setWindowCustomCursorShape(uint8_t *bitmap, - uint8_t *mask, - int sizeX, - int sizeY, - int hotX, - int hotY, - bool /*canInvertColor*/) +GHOST_TSuccess GHOST_WindowWin32::setWindowCustomCursorShape( + uint8_t *bitmap, uint8_t *mask, int sizeX, int sizeY, int hotX, int hotY, bool canInvertColor) { uint32_t andData[32]; uint32_t xorData[32]; @@ -1180,7 +1175,7 @@ GHOST_TSuccess GHOST_WindowWin32::endProgressBar() } #ifdef WITH_INPUT_IME -void GHOST_WindowWin32::beginIME(int32_t x, int32_t y, int32_t /*w*/, int32_t h, bool completed) +void GHOST_WindowWin32::beginIME(int32_t x, int32_t y, int32_t w, int32_t h, bool completed) { m_imeInput.BeginIME(m_hWnd, GHOST_Rect(x, y - h, x, y), completed); } diff --git a/intern/guardedalloc/intern/mallocn_intern.h b/intern/guardedalloc/intern/mallocn_intern.h index 14e5c171e7e..c2e9f9117bc 100644 --- a/intern/guardedalloc/intern/mallocn_intern.h +++ b/intern/guardedalloc/intern/mallocn_intern.h @@ -10,9 +10,6 @@ #ifdef __GNUC__ # define UNUSED(x) UNUSED_##x __attribute__((__unused__)) -#elif defined(_MSC_VER) -/* NOTE: This suppresses the warning for the line, not the attribute. */ -# define UNUSED(x) UNUSED_##x __pragma(warning(suppress : 4100)) #else # define UNUSED(x) UNUSED_##x #endif diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index 35e3345f4c2..e03bc7ba78a 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -668,9 +668,6 @@ extern bool BLI_memory_is_zero(const void *arr, size_t arr_size); /* UNUSED macro, for function argument */ # if defined(__GNUC__) || defined(__clang__) # define UNUSED(x) UNUSED_##x __attribute__((__unused__)) -# elif defined(_MSC_VER) -/* NOTE: This suppresses the warning for the line, not the attribute. */ -# define UNUSED(x) UNUSED_##x __pragma(warning(suppress : 4100)) # else # define UNUSED(x) UNUSED_##x # endif diff --git a/source/blender/blenlib/intern/BLI_filelist.c b/source/blender/blenlib/intern/BLI_filelist.c index 6240c855c99..7dca60128d3 100644 --- a/source/blender/blenlib/intern/BLI_filelist.c +++ b/source/blender/blenlib/intern/BLI_filelist.c @@ -272,7 +272,6 @@ void BLI_filelist_entry_mode_to_string(const struct stat *st, const char *types[8] = {"---", "--x", "-w-", "-wx", "r--", "r-x", "rw-", "rwx"}; #ifdef WIN32 - UNUSED_VARS(st); BLI_strncpy(r_mode1, types[0], sizeof(*r_mode1) * FILELIST_DIRENTRY_MODE_LEN); BLI_strncpy(r_mode2, types[0], sizeof(*r_mode2) * FILELIST_DIRENTRY_MODE_LEN); BLI_strncpy(r_mode3, types[0], sizeof(*r_mode3) * FILELIST_DIRENTRY_MODE_LEN); @@ -316,7 +315,6 @@ void BLI_filelist_entry_owner_to_string(const struct stat *st, char r_owner[FILELIST_DIRENTRY_OWNER_LEN]) { #ifdef WIN32 - UNUSED_VARS(st); strcpy(r_owner, "unknown"); #else struct passwd *pwuser = getpwuid(st->st_uid); diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 7b0d7725f1d..adf139f3e6a 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -140,9 +140,6 @@ if(CMAKE_COMPILER_IS_GNUCC OR (CMAKE_C_COMPILER_ID MATCHES "Clang")) endif() if(CMAKE_C_COMPILER_ID MATCHES "Clang") string(APPEND GENSRC_CFLAGS " -Wno-missing-variable-declarations") -elseif(MSVC) - # Restore warn C4100 (unreferenced formal parameter) back to w4 - remove_cc_flag(/w34100) endif() if(GENSRC_CFLAGS) diff --git a/source/blender/python/intern/stubs.c b/source/blender/python/intern/stubs.c index 6ac9cd64f33..f860bdc36ee 100644 --- a/source/blender/python/intern/stubs.c +++ b/source/blender/python/intern/stubs.c @@ -12,9 +12,6 @@ #if defined(__GNUC__) || defined(__clang__) # pragma GCC diagnostic error "-Wmissing-prototypes" # pragma GCC diagnostic ignored "-Wunused-parameter" -#elif defined(_MSC_VER) -/* Suppress unreferenced formal parameter warning. */ -# pragma warning(disable : 4100) #endif /* python, will come back */ diff --git a/source/creator/blender_launcher_win32.c b/source/creator/blender_launcher_win32.c index 49acc591487..993efafb53d 100644 --- a/source/creator/blender_launcher_win32.c +++ b/source/creator/blender_launcher_win32.c @@ -55,11 +55,6 @@ BOOL LaunchedFromSteam() int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow) { - /* Silence unreferenced formal parameter warning. */ - (void)hInstance; - (void)hPrevInstance; - (void)nCmdShow; - STARTUPINFO siStartInfo = {0}; PROCESS_INFORMATION procInfo; wchar_t path[MAX_PATH];