diff options
author | dundargoc <gocdundar@gmail.com> | 2022-11-12 13:34:14 +0100 |
---|---|---|
committer | dundargoc <gocdundar@gmail.com> | 2022-11-14 20:17:04 +0100 |
commit | 2755510f7800ff675a5fbe2cfaa59459ff3ab6b2 (patch) | |
tree | 13bc54ad9b6f2c724eb188a5e44753c92652c43f | |
parent | f8c671827710c6e9cca3bfd60c32098b2be8239a (diff) | |
download | rneovim-2755510f7800ff675a5fbe2cfaa59459ff3ab6b2.tar.gz rneovim-2755510f7800ff675a5fbe2cfaa59459ff3ab6b2.tar.bz2 rneovim-2755510f7800ff675a5fbe2cfaa59459ff3ab6b2.zip |
ci(windows): treat compiler warnings as errors
Reduce the warning level from 3 to 1 and fix all warnings.
-rw-r--r-- | CMakeLists.txt | 20 | ||||
-rw-r--r-- | src/nvim/ex_cmds.c | 2 | ||||
-rw-r--r-- | src/nvim/ex_docmd.c | 1 | ||||
-rw-r--r-- | src/nvim/lua/executor.c | 2 | ||||
-rw-r--r-- | src/nvim/main.c | 6 | ||||
-rw-r--r-- | src/nvim/os/pty_conpty_win.c | 4 | ||||
-rw-r--r-- | src/nvim/path.c | 2 |
7 files changed, 24 insertions, 13 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a78b8d5e47..a6e0ee017a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,12 @@ # Version should match the tested CMAKE_URL in .github/workflows/ci.yml. cmake_minimum_required(VERSION 3.10) + +# Can be removed once minimum version is at least 3.15 +if(POLICY CMP0092) + cmake_policy(SET CMP0092 NEW) +endif() + project(nvim C) if(POLICY CMP0075) @@ -270,7 +276,7 @@ int main(void) option(ENABLE_COMPILER_SUGGESTIONS "Enable -Wsuggest compiler warnings" OFF) if(MSVC) # XXX: /W4 gives too many warnings. #3241 - add_compile_options(/W3) + add_compile_options(-W1 -wd4311) add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE) add_definitions(-DMSWIN) else() @@ -364,10 +370,14 @@ option(CI_BUILD "CI, extra flags will be set" OFF) if(CI_BUILD) message(STATUS "CI build enabled") - add_compile_options(-Werror) - if(DEFINED ENV{BUILD_UCHAR}) - # Get some test coverage for unsigned char - add_compile_options(-funsigned-char) + if(MSVC) + add_compile_options(-WX) + else() + add_compile_options(-Werror) + if(DEFINED ENV{BUILD_UCHAR}) + # Get some test coverage for unsigned char + add_compile_options(-funsigned-char) + endif() endif() endif() diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index c22f22366a..eefe5cf68b 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -1512,7 +1512,7 @@ static char *find_pipe(const char *cmd) for (const char *p = cmd; *p != NUL; p++) { if (!inquote && *p == '|') { - return p; + return (char *)p; } if (*p == '"') { inquote = !inquote; diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index b875aafaad..f5e8eb1a06 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -1639,6 +1639,7 @@ int execute_cmd(exarg_T *eap, CmdParseInfo *cmdinfo, bool preview) char *errormsg = NULL; int retv = 0; +#undef ERROR #define ERROR(msg) \ do { \ errormsg = msg; \ diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c index 9cb42a81d3..c27df01342 100644 --- a/src/nvim/lua/executor.c +++ b/src/nvim/lua/executor.c @@ -585,7 +585,7 @@ static bool nlua_init_packages(lua_State *lstate) lua_getglobal(lstate, "require"); lua_pushstring(lstate, "vim._init_packages"); if (nlua_pcall(lstate, 1, 0)) { - mch_errmsg(lua_tostring(lstate, -1)); + mch_errmsg((char *)lua_tostring(lstate, -1)); mch_errmsg("\n"); return false; } diff --git a/src/nvim/main.c b/src/nvim/main.c index e395f8dc78..9ee9803c6d 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -1273,7 +1273,7 @@ scripterror: vim_snprintf((char *)IObuff, IOSIZE, _("Attempt to open script file again: \"%s %s\"\n"), argv[-1], argv[0]); - mch_errmsg((const char *)IObuff); + mch_errmsg(IObuff); os_exit(2); } int error; @@ -1292,7 +1292,7 @@ scripterror: vim_snprintf((char *)IObuff, IOSIZE, _("Cannot open for reading: \"%s\": %s\n"), argv[0], os_strerror(error)); - mch_errmsg((const char *)IObuff); + mch_errmsg(IObuff); os_exit(2); } save_typebuf(); @@ -2055,7 +2055,7 @@ static void mainerr(const char *errstr, const char *str) mch_errmsg(_(errstr)); if (str != NULL) { mch_errmsg(": \""); - mch_errmsg(str); + mch_errmsg((char *)str); mch_errmsg("\""); } mch_errmsg(_("\nMore info with \"")); diff --git a/src/nvim/os/pty_conpty_win.c b/src/nvim/os/pty_conpty_win.c index f9478d951f..43c89f8865 100644 --- a/src/nvim/os/pty_conpty_win.c +++ b/src/nvim/os/pty_conpty_win.c @@ -67,7 +67,7 @@ conpty_t *os_conpty_init(char **in_name, char **out_name, uint16_t width, uint16 | PIPE_ACCESS_OUTBOUND | FILE_FLAG_FIRST_PIPE_INSTANCE; sa.nLength = sizeof(sa); - snprintf(buf, sizeof(buf), "\\\\.\\pipe\\nvim-term-in-%d-%d", + snprintf(buf, sizeof(buf), "\\\\.\\pipe\\nvim-term-in-%lld-%d", os_get_pid(), count); *in_name = xstrdup(buf); if ((in_read = CreateNamedPipeA(*in_name, @@ -81,7 +81,7 @@ conpty_t *os_conpty_init(char **in_name, char **out_name, uint16_t width, uint16 emsg = "create input pipe failed"; goto failed; } - snprintf(buf, sizeof(buf), "\\\\.\\pipe\\nvim-term-out-%d-%d", + snprintf(buf, sizeof(buf), "\\\\.\\pipe\\nvim-term-out-%lld-%d", os_get_pid(), count); *out_name = xstrdup(buf); if ((out_write = CreateNamedPipeA(*out_name, diff --git a/src/nvim/path.c b/src/nvim/path.c index 1413000680..007f55294b 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -1867,7 +1867,7 @@ char *fix_fname(const char *fname) fname = xstrdup(fname); # ifdef USE_FNAME_CASE - path_fix_case(fname); // set correct case for file name + path_fix_case((char *)fname); // set correct case for file name # endif return (char *)fname; |