Cleanup: resolve some unreferenced parameter warnings in MSVC

When the warning level is set to 4, some unreferenced parameter
warnings can appear

This commit resolves some of those warnings.
This commit is contained in:
2023-02-14 15:52:11 -03:00
committed by Germano Cavalcante
parent da65b21e2e
commit 7fcb262dfd
11 changed files with 40 additions and 18 deletions

View File

@@ -103,6 +103,9 @@ bool win32_chk(bool result, const char *file, int line, const char *text)
_ftprintf(
stderr, "%s:%d: [%s] -> Win32 Error# (%lu): %s", file, line, text, ulong(error), msg);
# else
(void)file;
(void)line;
(void)text;
_ftprintf(stderr, "Win32 Error# (%lu): %s", ulong(error), msg);
# endif

View File

@@ -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)
{

View File

@@ -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;

View File

@@ -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,7 +1148,9 @@ 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();
@@ -2213,7 +2215,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;

View File

@@ -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));

View File

@@ -898,7 +898,7 @@ GHOST_TSuccess GHOST_WindowWin32::hasCursorShape(GHOST_TStandardCursor cursorSha
}
GHOST_TSuccess GHOST_WindowWin32::getPointerInfo(
std::vector<GHOST_PointerInfoWin32> &outPointerInfo, WPARAM wParam, LPARAM lParam)
std::vector<GHOST_PointerInfoWin32> &outPointerInfo, WPARAM wParam, LPARAM /*lParam*/)
{
int32_t pointerId = GET_POINTERID_WPARAM(wParam);
int32_t isPrimary = IS_POINTER_PRIMARY_WPARAM(wParam);
@@ -1109,8 +1109,13 @@ 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];
@@ -1175,7 +1180,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);
}

View File

@@ -272,6 +272,7 @@ 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);
@@ -315,6 +316,7 @@ 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);

View File

@@ -261,6 +261,8 @@ static bool bm_face_split_edgenet_find_loop_walk(BMVert *v_init,
const uint edge_order_len,
BMEdge *e_pair[2])
{
UNUSED_VARS_NDEBUG(edge_order_len);
/* fast-path for the common case (avoid push-pop).
* Also avoids tagging as visited since we know we
* can't reach these verts some other way */

View File

@@ -407,6 +407,9 @@ inline void execute_element_fn_as_multi_function(const ElementFn element_fn,
std::forward<decltype(args)>(args)...);
});
}
else {
UNUSED_VARS(exec_preset);
}
/* If devirtualized execution was disabled or not possible, use a fallback method which is
* slower but always works. */

View File

@@ -55,6 +55,11 @@ 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];

View File

@@ -239,12 +239,12 @@ void *gmp_alloc(size_t size)
{
return scalable_malloc(size);
}
void *gmp_realloc(void *ptr, size_t old_size, size_t new_size)
void *gmp_realloc(void *ptr, size_t UNUSED(old_size), size_t new_size)
{
return scalable_realloc(ptr, new_size);
}
void gmp_free(void *ptr, size_t size)
void gmp_free(void *ptr, size_t UNUSED(size))
{
scalable_free(ptr);
}