Problem: Clang on MS-Windows produces warnings.
Solution: Avoid the warnings. (Yegappan Lakshmanan, closes #10546)
*/
//ARGSUSED
static BOOL CALLBACK
-window_cb(HWND hwnd, LPARAM lparam)
+window_cb(HWND hwnd, LPARAM lparam UNUSED)
{
char title[256];
* Install the vimrc file.
*/
static void
-install_vimrc(int idx)
+install_vimrc(int idx UNUSED)
{
FILE *fd, *tfd;
char *fname;
* 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");
# 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
* 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.
# 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
}
IFACEMETHOD(IsPixelSnappingDisabled)(
- __maybenull void* clientDrawingContext,
+ __maybenull void* clientDrawingContext UNUSED,
__out BOOL* isDisabled)
{
*isDisabled = FALSE;
}
IFACEMETHOD(GetCurrentTransform)(
- __maybenull void* clientDrawingContext,
+ __maybenull void* clientDrawingContext UNUSED,
__out DWRITE_MATRIX* transform)
{
// forward the render target's transform
}
IFACEMETHOD(GetPixelsPerDip)(
- __maybenull void* clientDrawingContext,
+ __maybenull void* clientDrawingContext UNUSED,
__out FLOAT* pixelsPerDip)
{
float dpiX, unused;
}
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;
}
__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);
}
static int WINAPI
-stubGetSystemMetricsForDpi(int nIndex, UINT dpi)
+stubGetSystemMetricsForDpi(int nIndex, UINT dpi UNUSED)
{
return GetSystemMetrics(nIndex);
}
* 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;
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;
#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;
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)
{
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);
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
# endif
#endif // USE_FILEEXTD
+#ifdef __MINGW32__
+# define UNUSED __attribute__((unused))
+#else
+# define UNUSED
+#endif
#include "iscygpty.h"
# 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;
}
#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
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)
{
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)
{
read_console_input(
HANDLE hInput,
INPUT_RECORD *lpBuffer,
- DWORD nLength,
+ int nLength,
LPDWORD lpEvents)
{
enum
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
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);
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);
}
}
// 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;
// _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;
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.
static void CALLBACK
-set_flag(void *param, BOOLEAN unused2)
+set_flag(void *param, BOOLEAN unused2 UNUSED)
{
int *timeout_flag = (int *)param;
// 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)
#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;
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[] =
{
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 *
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 5073,
/**/
5072,
/**/
// 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