From 34509bbea3e8c6a8033911aea645b1b5579f7d1a Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sun, 26 Nov 2023 15:34:29 +0100 Subject: [PATCH] build: sync IWYU and clint to ignore the same headers (#26228) Also fix headers for autocmd.c. --- Makefile | 6 +- src/clint.py | 362 +++++++++++++++++++++++++-------------------- src/nvim/autocmd.c | 8 +- 3 files changed, 209 insertions(+), 167 deletions(-) diff --git a/Makefile b/Makefile index cfbf4e79fd..6d9fb820ce 100644 --- a/Makefile +++ b/Makefile @@ -136,6 +136,8 @@ generated-sources benchmark $(FORMAT) $(LINT) $(TEST) doc: | build/.ran-cmake test: $(TEST) +# The ignored header files should be synced with the `check_includes_ignore` +# array in src/clint.py iwyu: build/.ran-cmake cmake --preset iwyu cmake --build build > build/iwyu.log @@ -163,7 +165,6 @@ iwyu: build/.ran-cmake |src/nvim/arglist_defs.h\ |src/nvim/ascii.h\ |src/nvim/assert.h\ - |src/nvim/autocmd.c\ |src/nvim/autocmd.h\ |src/nvim/base64.h\ |src/nvim/buffer.h\ @@ -338,7 +339,8 @@ iwyu: build/.ran-cmake |src/nvim/viml/parser/expressions.h\ |src/nvim/viml/parser/parser.h\ |src/nvim/window.h\ - |src/nvim/winfloat.h)" --nosafe_headers < build/iwyu.log + |src/nvim/winfloat.h\ + )" --nosafe_headers < build/iwyu.log cmake -B build -U ENABLE_IWYU cmake --build build diff --git a/src/clint.py b/src/clint.py index cda7c0e580..e302a10505 100755 --- a/src/clint.py +++ b/src/clint.py @@ -893,169 +893,207 @@ def CheckIncludes(filename, lines, error): }: return + # These should be synced with the ignored headers in the `iwyu` target in + # the Makefile. check_includes_ignore = [ - "api/command.h", - "api/deprecated.h", - "api/extmark.h", - "api/keysets.h", - "api/options.h", - "api/private/converter.h", - "api/private/defs.h", - "api/private/dispatch.h", - "api/private/helpers.h", - "api/private/validate.h", - "api/tabpage.h", - "api/ui.h", - "api/vim.h", - "api/vimscript.h", - "api/win_config.h", - "arglist.h", - "arglist_defs.h", - "ascii.h", - "assert.h", - "autocmd.h", - "buffer.h", - "buffer_defs.h", - "buffer_updates.h", - "change.h", - "channel.h", - "charset.h", - "cmdexpand.h", - "cmdexpand_defs.h", - "cmdhist.h", - "context.h", - "cursor.h", - "cursor_shape.h", - "decoration.h", - "decoration_defs.h", - "decoration_provider.h", - "diff.h", - "digraph.h", - "drawline.h", - "drawscreen.h", - "edit.h", - "eval.h", - "eval/decode.h", - "eval/encode.h", - "eval/funcs.h", - "eval/typval.h", - "eval/typval_defs.h", - "eval/typval_encode.h", - "eval/userfunc.h", - "event/libuv_process.h", - "event/loop.h", - "event/multiqueue.h", - "event/process.h", - "event/rstream.h", - "event/signal.h", - "event/socket.h", - "event/stream.h", - "event/time.h", - "event/wstream.h", - "ex_cmds.h", - "ex_cmds_defs.h", - "ex_docmd.h", - "ex_eval_defs.h", - "ex_getln.h", - "extmark_defs.h", - "file_search.h", - "fileio.h", - "fold.h", - "fold_defs.h", - "garray.h", - "getchar.h", - "getchar_defs.h", - "globals.h", - "grid.h", - "grid_defs.h", - "hashtab.h", - "highlight.h", - "highlight_defs.h", - "highlight_group.h", - "iconv.h", - "indent.h", - "indent_c.h", - "input.h", - "insexpand.h", - "keycodes.h", - "linematch.h", - "log.h", - "lua/converter.h", - "lua/executor.h", - "lua/treesitter.h", - "macros.h", - "main.h", - "map.h", - "mapping.h", - "mapping_defs.h", - "mark.h", - "mark_defs.h", - "marktree.h", - "mbyte.h", - "mbyte_defs.h", - "memfile_defs.h", - "memline.h", - "memory.h", - "menu.h", - "message.h", - "mouse.h", - "move.h", - "msgpack_rpc/channel_defs.h", - "msgpack_rpc/helpers.h", - "msgpack_rpc/unpacker.h", - "normal.h", - "nvim/extmark.h", - "ops.h", - "option.h", - "option_defs.h", - "option_vars.h", - "os/fileio.h", - "os/fs.h", - "os/input.h", - "os/lang.h", - "os/os.h", - "os/process.h", - "os/pty_conpty_win.h", - "os/pty_process_unix.h", - "os/pty_process_win.h", - "os/shell.h", - "path.h", - "plines.h", - "popupmenu.h", - "profile.h", - "quickfix.h", - "regexp.h", - "regexp_defs.h", - "runtime.h", - "search.h", - "sha256.h", - "sign_defs.h", - "spell.h", - "spell_defs.h", - "spellfile.h", - "spellsuggest.h", - "statusline.h", - "statusline_defs.h", - "strings.h", - "syntax.h", - "tag.h", - "textformat.h", - "textobject.h", - "tui/input.h", - "tui/terminfo.h", - "tui/tui.h", - "ugrid.h", - "ui.h", - "ui_client.h", - "ui_compositor.h", - "undo_defs.h", - "usercmd.h", - "version.h", - "vim.h", - "viml/parser/expressions.h", - "viml/parser/parser.h", - "window.h", - "winfloat.h", + "src/nvim/api/autocmd.h", + "src/nvim/api/buffer.h", + "src/nvim/api/command.h", + "src/nvim/api/deprecated.h", + "src/nvim/api/extmark.h", + "src/nvim/api/keysets.h", + "src/nvim/api/options.h", + "src/nvim/api/private/converter.h", + "src/nvim/api/private/defs.h", + "src/nvim/api/private/dispatch.h", + "src/nvim/api/private/helpers.h", + "src/nvim/api/private/validate.h", + "src/nvim/api/tabpage.h", + "src/nvim/api/ui.h", + "src/nvim/api/vim.h", + "src/nvim/api/vimscript.h", + "src/nvim/api/win_config.h", + "src/nvim/api/window.h", + "src/nvim/arabic.h", + "src/nvim/arglist.h", + "src/nvim/arglist_defs.h", + "src/nvim/ascii.h", + "src/nvim/assert.h", + "src/nvim/autocmd.h", + "src/nvim/base64.h", + "src/nvim/buffer.h", + "src/nvim/buffer_defs.h", + "src/nvim/buffer_updates.h", + "src/nvim/bufwrite.h", + "src/nvim/change.h", + "src/nvim/channel.h", + "src/nvim/charset.h", + "src/nvim/cmdexpand.h", + "src/nvim/cmdexpand_defs.h", + "src/nvim/cmdhist.h", + "src/nvim/context.h", + "src/nvim/cursor.h", + "src/nvim/cursor_shape.h", + "src/nvim/debugger.h", + "src/nvim/decoration.h", + "src/nvim/decoration_defs.h", + "src/nvim/decoration_provider.h", + "src/nvim/diff.h", + "src/nvim/digraph.h", + "src/nvim/drawline.h", + "src/nvim/drawscreen.h", + "src/nvim/edit.h", + "src/nvim/eval.h", + "src/nvim/eval/buffer.h", + "src/nvim/eval/decode.h", + "src/nvim/eval/encode.h", + "src/nvim/eval/executor.h", + "src/nvim/eval/funcs.h", + "src/nvim/eval/gc.h", + "src/nvim/eval/typval.h", + "src/nvim/eval/typval_defs.h", + "src/nvim/eval/typval_encode.h", + "src/nvim/eval/userfunc.h", + "src/nvim/eval/vars.h", + "src/nvim/eval/window.h", + "src/nvim/event/libuv_process.h", + "src/nvim/event/loop.h", + "src/nvim/event/multiqueue.h", + "src/nvim/event/process.h", + "src/nvim/event/rstream.h", + "src/nvim/event/signal.h", + "src/nvim/event/socket.h", + "src/nvim/event/stream.h", + "src/nvim/event/time.h", + "src/nvim/event/wstream.h", + "src/nvim/ex_cmds.h", + "src/nvim/ex_cmds2.h", + "src/nvim/ex_cmds_defs.h", + "src/nvim/ex_docmd.h", + "src/nvim/ex_eval.h", + "src/nvim/ex_eval_defs.h", + "src/nvim/ex_getln.h", + "src/nvim/ex_session.h", + "src/nvim/extmark.h", + "src/nvim/extmark_defs.h", + "src/nvim/file_search.h", + "src/nvim/fileio.h", + "src/nvim/fold.h", + "src/nvim/fold_defs.h", + "src/nvim/garray.h", + "src/nvim/getchar.h", + "src/nvim/getchar_defs.h", + "src/nvim/globals.h", + "src/nvim/grid.h", + "src/nvim/grid_defs.h", + "src/nvim/hashtab.h", + "src/nvim/help.h", + "src/nvim/highlight.h", + "src/nvim/highlight_defs.h", + "src/nvim/highlight_group.h", + "src/nvim/iconv.h", + "src/nvim/indent.h", + "src/nvim/indent_c.h", + "src/nvim/input.h", + "src/nvim/insexpand.h", + "src/nvim/keycodes.h", + "src/nvim/linematch.h", + "src/nvim/log.h", + "src/nvim/lua/base64.h", + "src/nvim/lua/converter.h", + "src/nvim/lua/executor.h", + "src/nvim/lua/secure.h", + "src/nvim/lua/spell.h", + "src/nvim/lua/stdlib.h", + "src/nvim/lua/treesitter.h", + "src/nvim/lua/xdiff.h", + "src/nvim/macros.h", + "src/nvim/main.h", + "src/nvim/map.h", + "src/nvim/mapping.h", + "src/nvim/mapping_defs.h", + "src/nvim/mark.h", + "src/nvim/mark_defs.h", + "src/nvim/marktree.h", + "src/nvim/match.h", + "src/nvim/mbyte.h", + "src/nvim/mbyte_defs.h", + "src/nvim/memfile.h", + "src/nvim/memfile_defs.h", + "src/nvim/memline.h", + "src/nvim/memory.h", + "src/nvim/menu.h", + "src/nvim/message.h", + "src/nvim/mouse.h", + "src/nvim/move.h", + "src/nvim/msgpack_rpc/channel.h", + "src/nvim/msgpack_rpc/channel_defs.h", + "src/nvim/msgpack_rpc/helpers.h", + "src/nvim/msgpack_rpc/server.h", + "src/nvim/msgpack_rpc/unpacker.h", + "src/nvim/normal.h", + "src/nvim/nvim/extmark.h", + "src/nvim/ops.h", + "src/nvim/option.h", + "src/nvim/option_defs.h", + "src/nvim/option_vars.h", + "src/nvim/optionstr.h", + "src/nvim/os/dl.h", + "src/nvim/os/fileio.h", + "src/nvim/os/fs.h", + "src/nvim/os/input.h", + "src/nvim/os/lang.h", + "src/nvim/os/os.h", + "src/nvim/os/process.h", + "src/nvim/os/pty_conpty_win.h", + "src/nvim/os/pty_process_unix.h", + "src/nvim/os/pty_process_win.h", + "src/nvim/os/shell.h", + "src/nvim/os/time.h", + "src/nvim/os/tty.h", + "src/nvim/path.h", + "src/nvim/plines.h", + "src/nvim/popupmenu.h", + "src/nvim/profile.h", + "src/nvim/quickfix.h", + "src/nvim/regexp.h", + "src/nvim/regexp_defs.h", + "src/nvim/runtime.h", + "src/nvim/search.h", + "src/nvim/sha256.h", + "src/nvim/shada.h", + "src/nvim/sign.h", + "src/nvim/sign_defs.h", + "src/nvim/spell.h", + "src/nvim/spell_defs.h", + "src/nvim/spellfile.h", + "src/nvim/spellsuggest.h", + "src/nvim/state.h", + "src/nvim/statusline.h", + "src/nvim/statusline_defs.h", + "src/nvim/strings.h", + "src/nvim/syntax.h", + "src/nvim/tag.h", + "src/nvim/terminal.h", + "src/nvim/testing.h", + "src/nvim/textformat.h", + "src/nvim/textobject.h", + "src/nvim/tui/input.h", + "src/nvim/tui/terminfo.h", + "src/nvim/tui/tui.h", + "src/nvim/ugrid.h", + "src/nvim/ui.h", + "src/nvim/ui_client.h", + "src/nvim/ui_compositor.h", + "src/nvim/undo.h", + "src/nvim/undo_defs.h", + "src/nvim/usercmd.h", + "src/nvim/version.h", + "src/nvim/vim.h", + "src/nvim/viml/parser/expressions.h", + "src/nvim/viml/parser/parser.h", + "src/nvim/window.h", + "src/nvim/winfloat.h", ] for i in check_includes_ignore: diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c index 65e902ed4b..80c9ad9465 100644 --- a/src/nvim/autocmd.c +++ b/src/nvim/autocmd.c @@ -4,34 +4,36 @@ #include #include #include -#include #include "nvim/api/private/helpers.h" #include "nvim/ascii.h" #include "nvim/autocmd.h" #include "nvim/buffer.h" #include "nvim/charset.h" +#include "nvim/cmdexpand_defs.h" #include "nvim/cursor.h" #include "nvim/eval.h" #include "nvim/eval/typval.h" #include "nvim/eval/userfunc.h" #include "nvim/eval/vars.h" +#include "nvim/event/multiqueue.h" #include "nvim/ex_docmd.h" #include "nvim/ex_eval.h" #include "nvim/fileio.h" -#include "nvim/garray.h" #include "nvim/getchar.h" #include "nvim/gettext.h" +#include "nvim/globals.h" #include "nvim/grid.h" #include "nvim/hashtab.h" #include "nvim/highlight_defs.h" #include "nvim/insexpand.h" #include "nvim/lua/executor.h" +#include "nvim/main.h" #include "nvim/map.h" -#include "nvim/memline_defs.h" #include "nvim/memory.h" #include "nvim/message.h" #include "nvim/option.h" +#include "nvim/option_vars.h" #include "nvim/optionstr.h" #include "nvim/os/input.h" #include "nvim/os/os.h"