0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.5073: clang on MS-Windows produces warnings

Problem:    Clang on MS-Windows produces warnings.
Solution:   Avoid the warnings. (Yegappan Lakshmanan, closes #10546)
This commit is contained in:
Bram Moolenaar
2022-06-09 20:53:54 +01:00
parent 63f3260378
commit 35d7a2fb13
12 changed files with 137 additions and 105 deletions

View File

@@ -439,7 +439,7 @@ static int num_windows;
*/
//ARGSUSED
static BOOL CALLBACK
window_cb(HWND hwnd, LPARAM lparam)
window_cb(HWND hwnd, LPARAM lparam UNUSED)
{
char title[256];
@@ -1170,7 +1170,7 @@ init_bat_choices(void)
* Install the vimrc file.
*/
static void
install_vimrc(int idx)
install_vimrc(int idx UNUSED)
{
FILE *fd, *tfd;
char *fname;
@@ -1891,7 +1891,7 @@ build_shortcut(
* Create shortcut(s) in the Start Menu\Programs\Vim folder.
*/
static void
install_start_menu(int idx)
install_start_menu(int idx UNUSED)
{
need_uninstall_entry = 1;
printf("Creating start menu\n");

View File

@@ -73,6 +73,12 @@ char *searchpath(char *name);
# define KEY_WOW64_32KEY 0x0200
# endif
#ifdef __MINGW32__
# define UNUSED __attribute__((unused))
#else
# define UNUSED
#endif
#define VIM_STARTMENU "Programs\\Vim " VIM_VERSION_SHORT
int interactive; // non-zero when running interactively
@@ -450,7 +456,7 @@ mch_chdir(char *path)
* Expand the executable name into a full path name.
*/
static char *
my_fullpath(char *buf, char *fname, int len)
my_fullpath(char *buf, char *fname UNUSED, int len)
{
// Only GetModuleFileName() will get the long file name path.
// GetFullPathName() may still use the short (FAT) name.

View File

@@ -52,6 +52,12 @@
# define __out SAL__out
#endif
#ifdef __MINGW32__
# define UNUSED __attribute__((unused))
#else
# define UNUSED
#endif
#if (defined(_MSC_VER) && (_MSC_VER >= 1700)) || (__cplusplus >= 201103L)
# define FINAL final
#else
@@ -419,7 +425,7 @@ public:
}
IFACEMETHOD(IsPixelSnappingDisabled)(
__maybenull void* clientDrawingContext,
__maybenull void* clientDrawingContext UNUSED,
__out BOOL* isDisabled)
{
*isDisabled = FALSE;
@@ -427,7 +433,7 @@ public:
}
IFACEMETHOD(GetCurrentTransform)(
__maybenull void* clientDrawingContext,
__maybenull void* clientDrawingContext UNUSED,
__out DWRITE_MATRIX* transform)
{
// forward the render target's transform
@@ -437,7 +443,7 @@ public:
}
IFACEMETHOD(GetPixelsPerDip)(
__maybenull void* clientDrawingContext,
__maybenull void* clientDrawingContext UNUSED,
__out FLOAT* pixelsPerDip)
{
float dpiX, unused;
@@ -447,33 +453,33 @@ public:
}
IFACEMETHOD(DrawUnderline)(
__maybenull void* clientDrawingContext,
FLOAT baselineOriginX,
FLOAT baselineOriginY,
__in DWRITE_UNDERLINE const* underline,
IUnknown* clientDrawingEffect)
__maybenull void* clientDrawingContext UNUSED,
FLOAT baselineOriginX UNUSED,
FLOAT baselineOriginY UNUSED,
__in DWRITE_UNDERLINE const* underline UNUSED,
IUnknown* clientDrawingEffect UNUSED)
{
return E_NOTIMPL;
}
IFACEMETHOD(DrawStrikethrough)(
__maybenull void* clientDrawingContext,
FLOAT baselineOriginX,
FLOAT baselineOriginY,
__in DWRITE_STRIKETHROUGH const* strikethrough,
IUnknown* clientDrawingEffect)
__maybenull void* clientDrawingContext UNUSED,
FLOAT baselineOriginX UNUSED,
FLOAT baselineOriginY UNUSED,
__in DWRITE_STRIKETHROUGH const* strikethrough UNUSED,
IUnknown* clientDrawingEffect UNUSED)
{
return E_NOTIMPL;
}
IFACEMETHOD(DrawInlineObject)(
__maybenull void* clientDrawingContext,
FLOAT originX,
FLOAT originY,
IDWriteInlineObject* inlineObject,
BOOL isSideways,
BOOL isRightToLeft,
IUnknown* clientDrawingEffect)
__maybenull void* clientDrawingContext UNUSED,
FLOAT originX UNUSED,
FLOAT originY UNUSED,
IDWriteInlineObject* inlineObject UNUSED,
BOOL isSideways UNUSED,
BOOL isRightToLeft UNUSED,
IUnknown* clientDrawingEffect UNUSED)
{
return E_NOTIMPL;
}
@@ -482,10 +488,10 @@ public:
__maybenull void* clientDrawingContext,
FLOAT baselineOriginX,
FLOAT baselineOriginY,
DWRITE_MEASURING_MODE measuringMode,
DWRITE_MEASURING_MODE measuringMode UNUSED,
__in DWRITE_GLYPH_RUN const* glyphRun,
__in DWRITE_GLYPH_RUN_DESCRIPTION const* glyphRunDescription,
IUnknown* clientDrawingEffect)
__in DWRITE_GLYPH_RUN_DESCRIPTION const* glyphRunDescription UNUSED,
IUnknown* clientDrawingEffect UNUSED)
{
TextRendererContext *context =
reinterpret_cast<TextRendererContext*>(clientDrawingContext);

View File

@@ -392,7 +392,7 @@ stubGetDpiForSystem(void)
}
static int WINAPI
stubGetSystemMetricsForDpi(int nIndex, UINT dpi)
stubGetSystemMetricsForDpi(int nIndex, UINT dpi UNUSED)
{
return GetSystemMetrics(nIndex);
}
@@ -4149,7 +4149,7 @@ init_mouse_wheel(void)
* Mouse scroll event handler.
*/
static void
_OnMouseWheel(HWND hwnd, WPARAM wParam, LPARAM lParam, int horizontal)
_OnMouseWheel(HWND hwnd UNUSED, WPARAM wParam, LPARAM lParam, int horizontal)
{
int button;
win_T *wp;
@@ -4336,9 +4336,10 @@ static HWND hwndTip = NULL;
static void
show_sizing_tip(int cols, int rows)
{
TOOLINFOA ti = {sizeof(ti)};
TOOLINFOA ti;
char buf[32];
ti.cbSize = sizeof(ti);
ti.hwnd = s_hwnd;
ti.uId = (UINT_PTR)s_hwnd;
ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND;
@@ -4636,7 +4637,7 @@ _OnMenuSelect(HWND hwnd, WPARAM wParam, LPARAM lParam)
#endif
static LRESULT
_OnDpiChanged(HWND hwnd, UINT xdpi, UINT ydpi, RECT *rc)
_OnDpiChanged(HWND hwnd, UINT xdpi UNUSED, UINT ydpi, RECT *rc UNUSED)
{
s_dpi = ydpi;
s_in_dpichanged = TRUE;
@@ -5106,12 +5107,12 @@ load_dpi_func(void)
if (hUser32 == NULL)
goto fail;
pGetDpiForSystem = (void*)GetProcAddress(hUser32, "GetDpiForSystem");
pGetDpiForWindow = (void*)GetProcAddress(hUser32, "GetDpiForWindow");
pGetSystemMetricsForDpi = (void*)GetProcAddress(hUser32, "GetSystemMetricsForDpi");
pGetDpiForSystem = (UINT (WINAPI *)(void))GetProcAddress(hUser32, "GetDpiForSystem");
pGetDpiForWindow = (UINT (WINAPI *)(HWND))GetProcAddress(hUser32, "GetDpiForWindow");
pGetSystemMetricsForDpi = (int (WINAPI *)(int, UINT))GetProcAddress(hUser32, "GetSystemMetricsForDpi");
//pGetWindowDpiAwarenessContext = (void*)GetProcAddress(hUser32, "GetWindowDpiAwarenessContext");
pSetThreadDpiAwarenessContext = (void*)GetProcAddress(hUser32, "SetThreadDpiAwarenessContext");
pGetAwarenessFromDpiAwarenessContext = (void*)GetProcAddress(hUser32, "GetAwarenessFromDpiAwarenessContext");
pSetThreadDpiAwarenessContext = (DPI_AWARENESS_CONTEXT (WINAPI *)(DPI_AWARENESS_CONTEXT))GetProcAddress(hUser32, "SetThreadDpiAwarenessContext");
pGetAwarenessFromDpiAwarenessContext = (DPI_AWARENESS (WINAPI *)(DPI_AWARENESS_CONTEXT))GetProcAddress(hUser32, "GetAwarenessFromDpiAwarenessContext");
if (pSetThreadDpiAwarenessContext != NULL)
{
@@ -7799,8 +7800,9 @@ initialise_toolbar(void)
update_toolbar_size(void)
{
int w, h;
TBMETRICS tbm = {sizeof(TBMETRICS)};
TBMETRICS tbm;
tbm.cbSize = sizeof(TBMETRICS);
tbm.dwMask = TBMF_PAD | TBMF_BUTTONSPACING;
SendMessage(s_toolbarhwnd, TB_GETMETRICS, 0, (LPARAM)&tbm);
//TRACE("Pad: %d, %d", tbm.cxPad, tbm.cyPad);
@@ -8043,27 +8045,27 @@ dyn_imm_load(void)
return;
pImmGetCompositionStringW
= (void *)GetProcAddress(hLibImm, "ImmGetCompositionStringW");
= (LONG (WINAPI *)(HIMC, DWORD, LPVOID, DWORD))GetProcAddress(hLibImm, "ImmGetCompositionStringW");
pImmGetContext
= (void *)GetProcAddress(hLibImm, "ImmGetContext");
= (HIMC (WINAPI *)(HWND))GetProcAddress(hLibImm, "ImmGetContext");
pImmAssociateContext
= (void *)GetProcAddress(hLibImm, "ImmAssociateContext");
= (HIMC (WINAPI *)(HWND, HIMC))GetProcAddress(hLibImm, "ImmAssociateContext");
pImmReleaseContext
= (void *)GetProcAddress(hLibImm, "ImmReleaseContext");
= (BOOL (WINAPI *)(HWND, HIMC))GetProcAddress(hLibImm, "ImmReleaseContext");
pImmGetOpenStatus
= (void *)GetProcAddress(hLibImm, "ImmGetOpenStatus");
= (BOOL (WINAPI *)(HIMC))GetProcAddress(hLibImm, "ImmGetOpenStatus");
pImmSetOpenStatus
= (void *)GetProcAddress(hLibImm, "ImmSetOpenStatus");
= (BOOL (WINAPI *)(HIMC, BOOL))GetProcAddress(hLibImm, "ImmSetOpenStatus");
pImmGetCompositionFontW
= (void *)GetProcAddress(hLibImm, "ImmGetCompositionFontW");
= (BOOL (WINAPI *)(HIMC, LPLOGFONTW))GetProcAddress(hLibImm, "ImmGetCompositionFontW");
pImmSetCompositionFontW
= (void *)GetProcAddress(hLibImm, "ImmSetCompositionFontW");
= (BOOL (WINAPI *)(HIMC, LPLOGFONTW))GetProcAddress(hLibImm, "ImmSetCompositionFontW");
pImmSetCompositionWindow
= (void *)GetProcAddress(hLibImm, "ImmSetCompositionWindow");
= (BOOL (WINAPI *)(HIMC, LPCOMPOSITIONFORM))GetProcAddress(hLibImm, "ImmSetCompositionWindow");
pImmGetConversionStatus
= (void *)GetProcAddress(hLibImm, "ImmGetConversionStatus");
= (BOOL (WINAPI *)(HIMC, LPDWORD, LPDWORD))GetProcAddress(hLibImm, "ImmGetConversionStatus");
pImmSetConversionStatus
= (void *)GetProcAddress(hLibImm, "ImmSetConversionStatus");
= (BOOL (WINAPI *)(HIMC, DWORD, DWORD))GetProcAddress(hLibImm, "ImmSetConversionStatus");
if ( pImmGetCompositionStringW == NULL
|| pImmGetContext == NULL

View File

@@ -56,6 +56,11 @@
# endif
#endif // USE_FILEEXTD
#ifdef __MINGW32__
# define UNUSED __attribute__((unused))
#else
# define UNUSED
#endif
#include "iscygpty.h"
@@ -70,10 +75,10 @@ static pfnGetFileInformationByHandleEx pGetFileInformationByHandleEx = NULL;
# ifndef USE_FILEEXTD
static BOOL WINAPI stub_GetFileInformationByHandleEx(
HANDLE hFile,
FILE_INFO_BY_HANDLE_CLASS FileInformationClass,
LPVOID lpFileInformation,
DWORD dwBufferSize)
HANDLE hFile UNUSED,
FILE_INFO_BY_HANDLE_CLASS FileInformationClass UNUSED,
LPVOID lpFileInformation UNUSED,
DWORD dwBufferSize UNUSED)
{
return FALSE;
}

View File

@@ -7,9 +7,13 @@
#if defined(__GNUC__) && !defined(__MINGW32__)
# define INTERNAL __attribute__((visibility("internal")))
# define UNUSED __attribute__((unused))
#else
# define INTERNAL
#endif
#if defined(__GNUC__) || defined(__MINGW32__)
# define UNUSED __attribute__((unused))
#else
# define UNUSED
#endif

View File

@@ -4922,13 +4922,18 @@ iconv_enabled(int verbose)
return FALSE;
}
iconv = (void *)GetProcAddress(hIconvDLL, "libiconv");
iconv_open = (void *)GetProcAddress(hIconvDLL, "libiconv_open");
iconv_close = (void *)GetProcAddress(hIconvDLL, "libiconv_close");
iconvctl = (void *)GetProcAddress(hIconvDLL, "libiconvctl");
iconv_errno = get_dll_import_func(hIconvDLL, "_errno");
iconv = (size_t (*)(iconv_t, const char **,
size_t *, char **, size_t *))
GetProcAddress(hIconvDLL, "libiconv");
iconv_open = (iconv_t (*)(const char *, const char *))
GetProcAddress(hIconvDLL, "libiconv_open");
iconv_close = (int (*)(iconv_t))
GetProcAddress(hIconvDLL, "libiconv_close");
iconvctl = (int (*)(iconv_t, int, void *))
GetProcAddress(hIconvDLL, "libiconvctl");
iconv_errno = (int *(*)(void))get_dll_import_func(hIconvDLL, "_errno");
if (iconv_errno == NULL)
iconv_errno = (void *)GetProcAddress(hMsvcrtDLL, "_errno");
iconv_errno = (int *(*)(void))GetProcAddress(hMsvcrtDLL, "_errno");
if (iconv == NULL || iconv_open == NULL || iconv_close == NULL
|| iconvctl == NULL || iconv_errno == NULL)
{

View File

@@ -273,11 +273,12 @@ typedef BOOL (WINAPI *PfnRtlGetVersion)(LPOSVERSIONINFOW);
static DWORD
get_build_number(void)
{
OSVERSIONINFOW osver = {sizeof(OSVERSIONINFOW)};
OSVERSIONINFOW osver;
HMODULE hNtdll;
PfnRtlGetVersion pRtlGetVersion;
DWORD ver = MAKE_VER(0, 0, 0);
osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
hNtdll = GetModuleHandle("ntdll.dll");
if (hNtdll != NULL)
{
@@ -325,7 +326,7 @@ make_ambiwidth_event(
read_console_input(
HANDLE hInput,
INPUT_RECORD *lpBuffer,
DWORD nLength,
int nLength,
LPDWORD lpEvents)
{
enum
@@ -423,7 +424,7 @@ peek_console_input(
DWORD nLength UNUSED,
LPDWORD lpEvents)
{
return read_console_input(hInput, lpBuffer, (DWORD)-1, lpEvents);
return read_console_input(hInput, lpBuffer, -1, lpEvents);
}
# ifdef FEAT_CLIENTSERVER
@@ -435,7 +436,7 @@ msg_wait_for_multiple_objects(
DWORD dwMilliseconds,
DWORD dwWakeMask)
{
if (read_console_input(NULL, NULL, (DWORD)-2, NULL))
if (read_console_input(NULL, NULL, -2, NULL))
return WAIT_OBJECT_0;
return MsgWaitForMultipleObjects(nCount, pHandles, fWaitAll,
dwMilliseconds, dwWakeMask);
@@ -448,7 +449,7 @@ wait_for_single_object(
HANDLE hHandle,
DWORD dwMilliseconds)
{
if (read_console_input(NULL, NULL, (DWORD)-2, NULL))
if (read_console_input(NULL, NULL, -2, NULL))
return WAIT_OBJECT_0;
return WaitForSingleObject(hHandle, dwMilliseconds);
}
@@ -760,8 +761,8 @@ dyn_libintl_init(void)
}
// The bind_textdomain_codeset() function is optional.
dyn_libintl_bind_textdomain_codeset = (void *)GetProcAddress(hLibintlDLL,
"bind_textdomain_codeset");
dyn_libintl_bind_textdomain_codeset = (char *(*)(const char *, const char *))
GetProcAddress(hLibintlDLL, "bind_textdomain_codeset");
if (dyn_libintl_bind_textdomain_codeset == NULL)
dyn_libintl_bind_textdomain_codeset =
null_libintl_bind_textdomain_codeset;
@@ -769,7 +770,8 @@ dyn_libintl_init(void)
// _wputenv() function for the libintl.dll is optional.
hmsvcrt = find_imported_module_by_funcname(hLibintlDLL, "getenv");
if (hmsvcrt != NULL)
dyn_libintl_wputenv = (void *)GetProcAddress(hmsvcrt, "_wputenv");
dyn_libintl_wputenv = (int (*)(const wchar_t *))
GetProcAddress(hmsvcrt, "_wputenv");
if (dyn_libintl_wputenv == NULL || dyn_libintl_wputenv == _wputenv)
dyn_libintl_wputenv = null_libintl_wputenv;
@@ -4224,7 +4226,7 @@ sub_process_writer(LPVOID param)
s == NULL ? l : (DWORD)(s - (lp + written)),
&len, NULL);
}
if (len == (int)l)
if (len == l)
{
// Finished a line, add a NL, unless this line should not have
// one.
@@ -8338,7 +8340,7 @@ static int *timeout_flag = &timeout_flags[0];
static void CALLBACK
set_flag(void *param, BOOLEAN unused2)
set_flag(void *param, BOOLEAN unused2 UNUSED)
{
int *timeout_flag = (int *)param;

View File

@@ -198,7 +198,7 @@ Trace(char *pszFormat, ...);
// These macros should all compile away to nothing
# define ASSERT(f) ((void)0)
# define TRACE 1 ? (void)0 : printf
# define TRACE 1 ? (void)0 : (void)printf
# define TRACE0(sz)
# define TRACE1(sz, p1)
# define TRACE2(sz, p1, p2)

View File

@@ -50,21 +50,6 @@
#undef tgetstr
/*
* Here are the builtin termcap entries. They are not stored as complete
* structures with all entries, as such a structure is too big.
*
* The entries are compact, therefore they normally are included even when
* HAVE_TGETENT is defined. When HAVE_TGETENT is defined, the builtin entries
* can be accessed with "builtin_amiga", "builtin_ansi", "builtin_debug", etc.
*
* Each termcap is a list of builtin_term structures. It always starts with
* KS_NAME, which separates the entries. See parse_builtin_tcap() for all
* details.
* bt_entry is either a KS_xxx code (>= 0), or a K_xxx code.
*
* Entries marked with "guessed" may be wrong.
*/
struct builtin_term
{
int bt_entry;
@@ -221,6 +206,21 @@ static int initial_cursor_shape_blink = FALSE;
static int initial_cursor_blink = FALSE;
#endif
/*
* Here are the builtin termcap entries. They are not stored as complete
* structures with all entries to save space.
*
* The entries are also included even when HAVE_TGETENT is defined, the systerm
* termcap may be incomplee. When HAVE_TGETENT is defined, the builtin entries
* can be accessed with "builtin_amiga", "builtin_ansi", "builtin_debug", etc.
*
* Each termcap is a list of builtin_term structures. It always starts with
* KS_NAME, which separates the entries. See parse_builtin_tcap() for all
* details.
* bt_entry is either a KS_xxx code (>= 0), or a K_xxx code.
*
* Entries marked with "guessed" may be wrong.
*/
static struct builtin_term builtin_termcaps[] =
{
@@ -6603,28 +6603,28 @@ struct ks_tbl_S
static struct ks_tbl_S ks_tbl[] =
{
{(int)KS_ME, "\033|0m", "\033|0m"}, // normal
{(int)KS_MR, "\033|7m", "\033|7m"}, // reverse
{(int)KS_MD, "\033|1m", "\033|1m"}, // bold
{(int)KS_SO, "\033|91m", "\033|91m"}, // standout: bright red text
{(int)KS_SE, "\033|39m", "\033|39m"}, // standout end: default color
{(int)KS_CZH, "\033|3m", "\033|3m"}, // italic
{(int)KS_CZR, "\033|0m", "\033|0m"}, // italic end
{(int)KS_US, "\033|4m", "\033|4m"}, // underscore
{(int)KS_UE, "\033|24m", "\033|24m"}, // underscore end
{(int)KS_ME, "\033|0m", "\033|0m", {""}}, // normal
{(int)KS_MR, "\033|7m", "\033|7m", {""}}, // reverse
{(int)KS_MD, "\033|1m", "\033|1m", {""}}, // bold
{(int)KS_SO, "\033|91m", "\033|91m", {""}}, // standout: bright red text
{(int)KS_SE, "\033|39m", "\033|39m", {""}}, // standout end: default color
{(int)KS_CZH, "\033|3m", "\033|3m", {""}}, // italic
{(int)KS_CZR, "\033|0m", "\033|0m", {""}}, // italic end
{(int)KS_US, "\033|4m", "\033|4m", {""}}, // underscore
{(int)KS_UE, "\033|24m", "\033|24m", {""}}, // underscore end
# ifdef TERMINFO
{(int)KS_CAB, "\033|%p1%db", "\033|%p14%dm"}, // set background color
{(int)KS_CAF, "\033|%p1%df", "\033|%p13%dm"}, // set foreground color
{(int)KS_CS, "\033|%p1%d;%p2%dR", "\033|%p1%d;%p2%dR"},
{(int)KS_CSV, "\033|%p1%d;%p2%dV", "\033|%p1%d;%p2%dV"},
{(int)KS_CAB, "\033|%p1%db", "\033|%p14%dm", {""}}, // set background color
{(int)KS_CAF, "\033|%p1%df", "\033|%p13%dm", {""}}, // set foreground color
{(int)KS_CS, "\033|%p1%d;%p2%dR", "\033|%p1%d;%p2%dR", {""}},
{(int)KS_CSV, "\033|%p1%d;%p2%dV", "\033|%p1%d;%p2%dV", {""}},
# else
{(int)KS_CAB, "\033|%db", "\033|4%dm"}, // set background color
{(int)KS_CAF, "\033|%df", "\033|3%dm"}, // set foreground color
{(int)KS_CS, "\033|%d;%dR", "\033|%d;%dR"},
{(int)KS_CSV, "\033|%d;%dV", "\033|%d;%dV"},
{(int)KS_CAB, "\033|%db", "\033|4%dm", {""}}, // set background color
{(int)KS_CAF, "\033|%df", "\033|3%dm", {""}}, // set foreground color
{(int)KS_CS, "\033|%d;%dR", "\033|%d;%dR", {""}},
{(int)KS_CSV, "\033|%d;%dV", "\033|%d;%dV", {""}},
# endif
{(int)KS_CCO, "256", "256"}, // colors
{(int)KS_NAME} // terminator
{(int)KS_CCO, "256", "256", {""}}, // colors
{(int)KS_NAME, NULL, NULL, {""}} // terminator
};
static struct builtin_term *

View File

@@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
5073,
/**/
5072,
/**/

View File

@@ -33,7 +33,7 @@
// Mark unused function arguments with UNUSED, so that gcc -Wunused-parameter
// can be used to check for mistakes.
#ifdef HAVE_ATTRIBUTE_UNUSED
#if defined(HAVE_ATTRIBUTE_UNUSED) || defined(__MINGW32__)
# define UNUSED __attribute__((unused))
#else
# define UNUSED