From c26f989b2fe13a4e9439322c736e48268c9c4204 Mon Sep 17 00:00:00 2001 From: bfredl Date: Thu, 14 Aug 2025 10:36:08 +0200 Subject: [PATCH] fix(build): also check os_win sources with uncrustify in CI --- src/nvim/CMakeLists.txt | 6 ++++-- src/nvim/os/os_win_console.c | 7 ++++--- src/nvim/os/pty_conpty_win.c | 4 ++-- src/nvim/os/pty_proc_win.c | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 0115b661b3..d6b5a55ca2 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -416,6 +416,8 @@ endforeach() list(SORT NVIM_SOURCES) list(SORT NVIM_HEADERS) +list(APPEND UNCRUSTIFY_NVIM_SOURCES ${NVIM_SOURCES} ${NVIM_HEADERS}) + foreach(sfile ${NVIM_SOURCES}) get_filename_component(f ${sfile} NAME) if(WIN32 AND ${f} MATCHES "^(pty_proc_unix.c)$") @@ -901,13 +903,13 @@ add_glob_target( TARGET lintc-uncrustify COMMAND ${UNCRUSTIFY_PRG} FLAGS -c ${UNCRUSTIFY_CONFIG} -q --check - FILES ${NVIM_SOURCES} ${NVIM_HEADERS}) + FILES ${UNCRUSTIFY_NVIM_SOURCES}) add_glob_target( TARGET formatc COMMAND ${UNCRUSTIFY_PRG} FLAGS -c ${UNCRUSTIFY_CONFIG} --replace --no-backup - FILES ${NVIM_SOURCES} ${NVIM_HEADERS}) + FILES ${UNCRUSTIFY_NVIM_SOURCES}) # TODO(bfredl): there is a bug in "uncrustify --update-config-with-doc" which breaks # our config (backslash escape in strings). Once fixed these two lines should be deleted diff --git a/src/nvim/os/os_win_console.c b/src/nvim/os/os_win_console.c index 7b62ec153d..af5515e2f2 100644 --- a/src/nvim/os/os_win_console.c +++ b/src/nvim/os/os_win_console.c @@ -7,7 +7,7 @@ #include "nvim/os/os.h" #include "nvim/os/os_win_console.h" -# include "os/os_win_console.c.generated.h" +#include "os/os_win_console.c.generated.h" static char origTitle[256] = { 0 }; static HWND hWnd = NULL; @@ -27,7 +27,7 @@ int os_open_conin_fd(void) return conin_fd; } -void os_clear_hwnd(void) +void os_clear_hwnd(void) { hWnd = NULL; } @@ -57,7 +57,8 @@ void os_replace_stdout_and_stderr_to_conout(void) } /// Resets Windows console icon if we got an original one on startup. -void os_icon_reset(void) { +void os_icon_reset(void) +{ if (hWnd == NULL) { return; } diff --git a/src/nvim/os/pty_conpty_win.c b/src/nvim/os/pty_conpty_win.c index 6402330a52..90adb07b0b 100644 --- a/src/nvim/os/pty_conpty_win.c +++ b/src/nvim/os/pty_conpty_win.c @@ -143,8 +143,8 @@ finished: return conpty_object; } -bool os_conpty_spawn(conpty_t *conpty_object, HANDLE *proc_handle, wchar_t *name, - wchar_t *cmd_line, wchar_t *cwd, wchar_t *env) +bool os_conpty_spawn(conpty_t *conpty_object, HANDLE *proc_handle, wchar_t *name, wchar_t *cmd_line, + wchar_t *cwd, wchar_t *env) { PROCESS_INFORMATION pi = { 0 }; if (!CreateProcessW(name, diff --git a/src/nvim/os/pty_proc_win.c b/src/nvim/os/pty_proc_win.c index a4eeb56ce0..3c23c0f4df 100644 --- a/src/nvim/os/pty_proc_win.c +++ b/src/nvim/os/pty_proc_win.c @@ -12,7 +12,7 @@ #include "nvim/os/pty_conpty_win.h" #include "nvim/os/pty_proc_win.h" -# include "os/pty_proc_win.c.generated.h" +#include "os/pty_proc_win.c.generated.h" static void CALLBACK pty_proc_terminate_cb(void *context, BOOLEAN unused) FUNC_ATTR_NONNULL_ALL