From 0d41c4dee126b6d93ee8ed82302af47df9a50576 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Wed, 27 Apr 2022 06:38:12 +0200 Subject: [PATCH] refactor(build): remove unused includes #17078 Remove unused includes in src/nvim/buffer.c|h using the IWYU library. Yet another step towards #6371 and #549 --- .clang-format | 12 ++++++++++-- src/nvim/autocmd.c | 4 +++- src/nvim/buffer.c | 4 ---- src/nvim/buffer.h | 3 --- src/nvim/buffer_defs.h | 2 -- src/nvim/buffer_updates.h | 4 ++-- src/nvim/eval/funcs.c | 3 +-- src/nvim/if_cscope.c | 1 + src/nvim/sign.c | 3 ++- 9 files changed, 19 insertions(+), 17 deletions(-) diff --git a/.clang-format b/.clang-format index 5e31777265..a37e2fdbd1 100644 --- a/.clang-format +++ b/.clang-format @@ -36,8 +36,16 @@ BraceWrapping: BeforeElse: false IndentBraces: false PointerAlignment: Right -SortIncludes: false +SortIncludes: true Cpp11BracedListStyle: false +IncludeCategories: + - Regex: '<[/[:alnum:].]+>' + Priority: 0 + - Regex: '^"(nvim|vim)/' + Priority: 1 + SortPriority: 1 + CaseSensitive: false +IndentPPDirectives: AfterHash SpaceBeforeParens: ControlStatementsExceptControlMacros ForEachMacros: - FOR_ALL_AUEVENTS @@ -54,4 +62,4 @@ ForEachMacros: - RBUFFER_EACH_REVERSE - RBUFFER_UNTIL_EMPTY - RBUFFER_UNTIL_FULL - - kl_iter + - kl_iter \ No newline at end of file diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c index 3dc3d3d7a9..783cec4d60 100644 --- a/src/nvim/autocmd.c +++ b/src/nvim/autocmd.c @@ -4,7 +4,6 @@ // autocmd.c: Autocommand related functions #include -#include "lauxlib.h" #include "nvim/api/private/helpers.h" #include "nvim/ascii.h" #include "nvim/autocmd.h" @@ -27,6 +26,9 @@ #include "nvim/state.h" #include "nvim/ui_compositor.h" #include "nvim/vim.h" +#include "nvim/window.h" + +#include "lauxlib.h" #ifdef INCLUDE_GENERATED_DECLARATIONS # include "auevents_name_map.generated.h" diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 8840813b84..99a24464a8 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -25,7 +25,6 @@ #include #include "nvim/api/private/helpers.h" -#include "nvim/api/vim.h" #include "nvim/ascii.h" #include "nvim/assert.h" #include "nvim/buffer.h" @@ -50,7 +49,6 @@ #include "nvim/garray.h" #include "nvim/getchar.h" #include "nvim/hashtab.h" -#include "nvim/highlight.h" #include "nvim/highlight_group.h" #include "nvim/indent.h" #include "nvim/indent_c.h" @@ -64,13 +62,11 @@ #include "nvim/os/input.h" #include "nvim/os/os.h" #include "nvim/os/time.h" -#include "nvim/os_unix.h" #include "nvim/path.h" #include "nvim/plines.h" #include "nvim/quickfix.h" #include "nvim/regexp.h" #include "nvim/screen.h" -#include "nvim/shada.h" #include "nvim/sign.h" #include "nvim/spell.h" #include "nvim/strings.h" diff --git a/src/nvim/buffer.h b/src/nvim/buffer.h index 7f4bbcc9e5..b452eb227e 100644 --- a/src/nvim/buffer.h +++ b/src/nvim/buffer.h @@ -2,14 +2,11 @@ #define NVIM_BUFFER_H #include "nvim/eval.h" -#include "nvim/ex_cmds_defs.h" // for exarg_T #include "nvim/func_attr.h" #include "nvim/macros.h" #include "nvim/memline.h" #include "nvim/pos.h" // for linenr_T #include "nvim/screen.h" // for StlClickRecord -#include "nvim/vim.h" -#include "nvim/window.h" // Values for buflist_getfile() enum getf_values { diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h index d6d5ecc907..8d2f7c4545 100644 --- a/src/nvim/buffer_defs.h +++ b/src/nvim/buffer_defs.h @@ -102,8 +102,6 @@ typedef uint64_t disptick_T; // display tick type // for struct memline (it needs memfile_T) #include "nvim/memline_defs.h" -// for struct memfile, bhdr_T, blocknr_T... (it needs buf_T) -#include "nvim/memfile_defs.h" // for regprog_T. Needs win_T and buf_T. #include "nvim/regexp_defs.h" diff --git a/src/nvim/buffer_updates.h b/src/nvim/buffer_updates.h index 961fec879b..3c2635be71 100644 --- a/src/nvim/buffer_updates.h +++ b/src/nvim/buffer_updates.h @@ -1,8 +1,8 @@ #ifndef NVIM_BUFFER_UPDATES_H #define NVIM_BUFFER_UPDATES_H -#include "nvim/buffer_defs.h" -#include "nvim/extmark.h" +#include "nvim/buffer_defs.h" // for buf_T +#include "nvim/extmark.h" // for bcount_t #ifdef INCLUDE_GENERATED_DECLARATIONS # include "buffer_updates.h.generated.h" diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 9170dd113a..f572440edc 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -25,7 +25,6 @@ #include "nvim/eval/funcs.h" #include "nvim/eval/typval.h" #include "nvim/eval/userfunc.h" -#include "nvim/ex_cmds2.h" #include "nvim/ex_docmd.h" #include "nvim/ex_getln.h" #include "nvim/file_search.h" @@ -70,7 +69,7 @@ #include "nvim/undo.h" #include "nvim/version.h" #include "nvim/vim.h" - +#include "nvim/window.h" /// Describe data to return from find_some_match() typedef enum { diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c index 093ca238f1..e0372c5632 100644 --- a/src/nvim/if_cscope.c +++ b/src/nvim/if_cscope.c @@ -32,6 +32,7 @@ #include "nvim/quickfix.h" #include "nvim/strings.h" #include "nvim/tag.h" +#include "nvim/window.h" #if defined(UNIX) # include #endif diff --git a/src/nvim/sign.c b/src/nvim/sign.c index a50b4a5a99..6685c2f231 100644 --- a/src/nvim/sign.c +++ b/src/nvim/sign.c @@ -5,6 +5,7 @@ // sign.c: functions for managing with signs // +#include "nvim/sign.h" #include "nvim/ascii.h" #include "nvim/buffer.h" @@ -17,9 +18,9 @@ #include "nvim/move.h" #include "nvim/option.h" #include "nvim/screen.h" -#include "nvim/sign.h" #include "nvim/syntax.h" #include "nvim/vim.h" +#include "nvim/window.h" /// Struct to hold the sign properties. typedef struct sign sign_T;