From 731cdde28ea8d48cc23ba2752a08c261c87eee92 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sat, 22 Oct 2022 12:36:38 +0200 Subject: refactor: fix clang-tidy warnings Enable and fix bugprone-misplaced-widening-cast warning. Fix some modernize-macro-to-enum and readability-else-after-return warnings, but don't enable them. While the warnings can be useful, they are in general too noisy to enable. --- src/nvim/api/tabpage.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/nvim/api/tabpage.c') diff --git a/src/nvim/api/tabpage.c b/src/nvim/api/tabpage.c index b81fc3b7d7..31f9fab82a 100644 --- a/src/nvim/api/tabpage.c +++ b/src/nvim/api/tabpage.c @@ -110,15 +110,14 @@ Window nvim_tabpage_get_win(Tabpage tabpage, Error *err) if (tab == curtab) { return nvim_get_current_win(); - } else { - FOR_ALL_WINDOWS_IN_TAB(wp, tab) { - if (wp == tab->tp_curwin) { - return wp->handle; - } + } + FOR_ALL_WINDOWS_IN_TAB(wp, tab) { + if (wp == tab->tp_curwin) { + return wp->handle; } - // There should always be a current window for a tabpage - abort(); } + // There should always be a current window for a tabpage + abort(); } /// Gets the tabpage number -- cgit From 66360675cf4d091b7460e4a8e1435c13216c1929 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sun, 11 Sep 2022 17:12:44 +0200 Subject: build: allow IWYU to fix includes for all .c files Allow Include What You Use to remove unnecessary includes and only include what is necessary. This helps with reducing compilation times and makes it easier to visualise which dependencies are actually required. Work on https://github.com/neovim/neovim/issues/549, but doesn't close it since this only works fully for .c files and not headers. --- src/nvim/api/tabpage.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/nvim/api/tabpage.c') diff --git a/src/nvim/api/tabpage.c b/src/nvim/api/tabpage.c index 31f9fab82a..21eb326c3b 100644 --- a/src/nvim/api/tabpage.c +++ b/src/nvim/api/tabpage.c @@ -2,13 +2,14 @@ // it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com #include -#include #include #include "nvim/api/private/defs.h" #include "nvim/api/private/helpers.h" #include "nvim/api/tabpage.h" #include "nvim/api/vim.h" +#include "nvim/buffer_defs.h" +#include "nvim/globals.h" #include "nvim/memory.h" #include "nvim/window.h" -- cgit