diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2023-11-28 07:47:36 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-28 07:47:36 +0800 |
| commit | 718053b7a97c4e2fbaa6077d3c9f4dc7012c8aad (patch) | |
| tree | b9dcecd6373c0f9a51c5dde37c2c7c7cf5f43c62 | |
| parent | 6c14ae6bfaf51415b555e9a6b85d1d280976358d (diff) | |
| download | rneovim-718053b7a97c4e2fbaa6077d3c9f4dc7012c8aad.tar.gz rneovim-718053b7a97c4e2fbaa6077d3c9f4dc7012c8aad.tar.bz2 rneovim-718053b7a97c4e2fbaa6077d3c9f4dc7012c8aad.zip | |
refactor: fix runtime_defs.h (#26259)
59 files changed, 299 insertions, 335 deletions
@@ -142,20 +142,12 @@ iwyu: build/.ran-cmake cmake --preset iwyu cmake --build build > build/iwyu.log iwyu-fix-includes --only_re="src/nvim" --ignore_re="(src/nvim/eval/encode.c|src/nvim/auto/|src/nvim/os/lang.c|src/nvim/map.c\ - |src/nvim/api/buffer.h\ - |src/nvim/api/command.h\ |src/nvim/api/extmark.h\ - |src/nvim/api/options.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/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/arglist.h\ |src/nvim/ascii.h\ |src/nvim/assert.h\ |src/nvim/autocmd.h\ @@ -163,28 +155,19 @@ iwyu: build/.ran-cmake |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/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/funcs.h\ |src/nvim/eval/typval.h\ |src/nvim/eval/typval_defs.h\ |src/nvim/eval/typval_encode.h\ @@ -204,46 +187,34 @@ iwyu: build/.ran-cmake |src/nvim/ex_cmds.h\ |src/nvim/ex_cmds_defs.h\ |src/nvim/ex_docmd.h\ - |src/nvim/ex_eval_defs.h\ |src/nvim/ex_getln.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/globals.h\ |src/nvim/grid.h\ - |src/nvim/grid_defs.h\ - |src/nvim/hashtab.h\ |src/nvim/highlight.h\ |src/nvim/highlight_defs.h\ |src/nvim/highlight_group.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/executor.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_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\ @@ -254,31 +225,22 @@ iwyu: build/.ran-cmake |src/nvim/normal.h\ |src/nvim/ops.h\ |src/nvim/option.h\ - |src/nvim/option_defs.h\ |src/nvim/option_vars.h\ |src/nvim/os/fileio.h\ - |src/nvim/os/fs.h\ |src/nvim/os/input.h\ - |src/nvim/os/lang.h\ |src/nvim/os/pty_conpty_win.h\ |src/nvim/os/pty_process_unix.h\ |src/nvim/os/pty_process_win.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/search.h\ - |src/nvim/sign.h\ |src/nvim/spell.h\ |src/nvim/spell_defs.h\ |src/nvim/statusline.h\ |src/nvim/statusline_defs.h\ |src/nvim/strings.h\ |src/nvim/syntax.h\ - |src/nvim/testing.h\ |src/nvim/textformat.h\ |src/nvim/textobject.h\ |src/nvim/tui/input.h\ @@ -287,8 +249,6 @@ iwyu: build/.ran-cmake |src/nvim/ui.h\ |src/nvim/ui_client.h\ |src/nvim/ui_compositor.h\ - |src/nvim/undo.h\ - |src/nvim/usercmd.h\ |src/nvim/version.h\ |src/nvim/vim.h\ |src/nvim/viml/parser/expressions.h\ diff --git a/src/clint.py b/src/clint.py index c6d7d1e8a3..c9e6ca9973 100755 --- a/src/clint.py +++ b/src/clint.py @@ -897,20 +897,12 @@ def CheckIncludes(filename, lines, error): # These should be synced with the ignored headers in the `iwyu` target in # the Makefile. check_includes_ignore = [ - "src/nvim/api/buffer.h", - "src/nvim/api/command.h", "src/nvim/api/extmark.h", - "src/nvim/api/options.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/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/arglist.h", "src/nvim/ascii.h", "src/nvim/assert.h", "src/nvim/autocmd.h", @@ -918,28 +910,19 @@ def CheckIncludes(filename, lines, error): "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/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/funcs.h", "src/nvim/eval/typval.h", "src/nvim/eval/typval_defs.h", "src/nvim/eval/typval_encode.h", @@ -959,46 +942,34 @@ def CheckIncludes(filename, lines, error): "src/nvim/ex_cmds.h", "src/nvim/ex_cmds_defs.h", "src/nvim/ex_docmd.h", - "src/nvim/ex_eval_defs.h", "src/nvim/ex_getln.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/globals.h", "src/nvim/grid.h", - "src/nvim/grid_defs.h", - "src/nvim/hashtab.h", "src/nvim/highlight.h", "src/nvim/highlight_defs.h", "src/nvim/highlight_group.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/executor.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_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", @@ -1009,31 +980,22 @@ def CheckIncludes(filename, lines, error): "src/nvim/normal.h", "src/nvim/ops.h", "src/nvim/option.h", - "src/nvim/option_defs.h", "src/nvim/option_vars.h", "src/nvim/os/fileio.h", - "src/nvim/os/fs.h", "src/nvim/os/input.h", - "src/nvim/os/lang.h", "src/nvim/os/pty_conpty_win.h", "src/nvim/os/pty_process_unix.h", "src/nvim/os/pty_process_win.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/search.h", - "src/nvim/sign.h", "src/nvim/spell.h", "src/nvim/spell_defs.h", "src/nvim/statusline.h", "src/nvim/statusline_defs.h", "src/nvim/strings.h", "src/nvim/syntax.h", - "src/nvim/testing.h", "src/nvim/textformat.h", "src/nvim/textobject.h", "src/nvim/tui/input.h", @@ -1042,8 +1004,6 @@ def CheckIncludes(filename, lines, error): "src/nvim/ui.h", "src/nvim/ui_client.h", "src/nvim/ui_compositor.h", - "src/nvim/undo.h", - "src/nvim/usercmd.h", "src/nvim/version.h", "src/nvim/vim.h", "src/nvim/viml/parser/expressions.h", diff --git a/src/nvim/api/buffer.h b/src/nvim/api/buffer.h index 557cf8db0c..f3971c1d30 100644 --- a/src/nvim/api/buffer.h +++ b/src/nvim/api/buffer.h @@ -3,9 +3,9 @@ #include <lua.h> // IWYU pragma: keep #include <stdint.h> // IWYU pragma: keep -#include "nvim/api/keysets_defs.h" +#include "nvim/api/keysets_defs.h" // IWYU pragma: keep #include "nvim/api/private/defs.h" // IWYU pragma: keep -#include "nvim/buffer_defs.h" +#include "nvim/buffer_defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS # include "api/buffer.h.generated.h" diff --git a/src/nvim/api/command.h b/src/nvim/api/command.h index 95f0e05993..1cccbfb4c7 100644 --- a/src/nvim/api/command.h +++ b/src/nvim/api/command.h @@ -2,7 +2,7 @@ #include <stdint.h> // IWYU pragma: keep -#include "nvim/api/keysets_defs.h" +#include "nvim/api/keysets_defs.h" // IWYU pragma: keep #include "nvim/api/private/defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS diff --git a/src/nvim/api/extmark.h b/src/nvim/api/extmark.h index 2989dee53d..491e468d95 100644 --- a/src/nvim/api/extmark.h +++ b/src/nvim/api/extmark.h @@ -2,7 +2,7 @@ #include <stdint.h> // IWYU pragma: keep -#include "nvim/api/keysets_defs.h" +#include "nvim/api/keysets_defs.h" // IWYU pragma: keep #include "nvim/api/private/defs.h" // IWYU pragma: keep #include "nvim/decoration_defs.h" // IWYU pragma: keep #include "nvim/macros.h" diff --git a/src/nvim/api/options.h b/src/nvim/api/options.h index e44ed44c80..c16c6088b3 100644 --- a/src/nvim/api/options.h +++ b/src/nvim/api/options.h @@ -2,7 +2,7 @@ #include <stdint.h> // IWYU pragma: keep -#include "nvim/api/keysets_defs.h" +#include "nvim/api/keysets_defs.h" // IWYU pragma: keep #include "nvim/api/private/defs.h" // IWYU pragma: keep #include "nvim/option_defs.h" // IWYU pragma: keep diff --git a/src/nvim/api/private/dispatch.h b/src/nvim/api/private/dispatch.h index 3d12b941f4..6a2c9eaf54 100644 --- a/src/nvim/api/private/dispatch.h +++ b/src/nvim/api/private/dispatch.h @@ -4,7 +4,7 @@ #include <stdint.h> #include "nvim/api/private/defs.h" -#include "nvim/memory.h" +#include "nvim/memory_defs.h" #include "nvim/types_defs.h" typedef Object (*ApiDispatchWrapper)(uint64_t channel_id, Array args, Arena *arena, Error *error); diff --git a/src/nvim/api/vim.h b/src/nvim/api/vim.h index b2ebacb309..b620158751 100644 --- a/src/nvim/api/vim.h +++ b/src/nvim/api/vim.h @@ -2,7 +2,7 @@ #include <stdint.h> // IWYU pragma: keep -#include "nvim/api/keysets_defs.h" +#include "nvim/api/keysets_defs.h" // IWYU pragma: keep #include "nvim/api/private/defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS diff --git a/src/nvim/api/vimscript.h b/src/nvim/api/vimscript.h index c068542311..c315e932e9 100644 --- a/src/nvim/api/vimscript.h +++ b/src/nvim/api/vimscript.h @@ -2,7 +2,7 @@ #include <stdint.h> // IWYU pragma: keep -#include "nvim/api/keysets_defs.h" +#include "nvim/api/keysets_defs.h" // IWYU pragma: keep #include "nvim/api/private/defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS diff --git a/src/nvim/api/win_config.h b/src/nvim/api/win_config.h index 47e441a592..6df8ed13fa 100644 --- a/src/nvim/api/win_config.h +++ b/src/nvim/api/win_config.h @@ -2,7 +2,7 @@ #include <stdint.h> // IWYU pragma: keep -#include "nvim/api/keysets_defs.h" +#include "nvim/api/keysets_defs.h" // IWYU pragma: keep #include "nvim/api/private/defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS diff --git a/src/nvim/api/window.h b/src/nvim/api/window.h index 600d6956b5..a5c9f86225 100644 --- a/src/nvim/api/window.h +++ b/src/nvim/api/window.h @@ -1,6 +1,6 @@ #pragma once -#include "nvim/api/keysets_defs.h" +#include "nvim/api/keysets_defs.h" // IWYU pragma: keep #include "nvim/api/private/defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS diff --git a/src/nvim/arglist.h b/src/nvim/arglist.h index bcb5c8f565..97729f466c 100644 --- a/src/nvim/arglist.h +++ b/src/nvim/arglist.h @@ -4,7 +4,7 @@ #include "nvim/cmdexpand_defs.h" // IWYU pragma: keep #include "nvim/eval/typval_defs.h" // IWYU pragma: keep #include "nvim/ex_cmds_defs.h" // IWYU pragma: keep -#include "nvim/types_defs.h" +#include "nvim/types_defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS # include "arglist.h.generated.h" diff --git a/src/nvim/bufwrite.h b/src/nvim/bufwrite.h index 38d4d7745e..9ed6216847 100644 --- a/src/nvim/bufwrite.h +++ b/src/nvim/bufwrite.h @@ -2,7 +2,7 @@ #include "nvim/buffer_defs.h" // IWYU pragma: keep #include "nvim/ex_cmds_defs.h" // IWYU pragma: keep -#include "nvim/pos_defs.h" +#include "nvim/pos_defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS # include "bufwrite.h.generated.h" diff --git a/src/nvim/change.h b/src/nvim/change.h index 1c90b67fe3..06155b6da6 100644 --- a/src/nvim/change.h +++ b/src/nvim/change.h @@ -1,15 +1,17 @@ #pragma once #include "nvim/buffer_defs.h" // IWYU pragma: keep -#include "nvim/pos_defs.h" +#include "nvim/pos_defs.h" // IWYU pragma: keep -// flags for open_line() -#define OPENLINE_DELSPACES 0x01 // delete spaces after cursor -#define OPENLINE_DO_COM 0x02 // format comments -#define OPENLINE_KEEPTRAIL 0x04 // keep trailing spaces -#define OPENLINE_MARKFIX 0x08 // fix mark positions -#define OPENLINE_COM_LIST 0x10 // format comments with list/2nd line indent -#define OPENLINE_FORMAT 0x20 // formatting long comment +/// flags for open_line() +enum { + OPENLINE_DELSPACES = 0x01, ///< delete spaces after cursor + OPENLINE_DO_COM = 0x02, ///< format comments + OPENLINE_KEEPTRAIL = 0x04, ///< keep trailing spaces + OPENLINE_MARKFIX = 0x08, ///< fix mark positions + OPENLINE_COM_LIST = 0x10, ///< format comments with list/2nd line indent + OPENLINE_FORMAT = 0x20, ///< formatting long comment +}; #ifdef INCLUDE_GENERATED_DECLARATIONS # include "change.h.generated.h" diff --git a/src/nvim/cmdexpand.h b/src/nvim/cmdexpand.h index 4ae702f18d..b0772d26a3 100644 --- a/src/nvim/cmdexpand.h +++ b/src/nvim/cmdexpand.h @@ -4,7 +4,7 @@ #include "nvim/eval/typval_defs.h" // IWYU pragma: keep #include "nvim/ex_getln.h" #include "nvim/garray_defs.h" // IWYU pragma: keep -#include "nvim/types_defs.h" +#include "nvim/types_defs.h" // IWYU pragma: keep // Values for nextwild() and ExpandOne(). See ExpandOne() for meaning. diff --git a/src/nvim/cursor.h b/src/nvim/cursor.h index ea63f7c1e5..d50976b598 100644 --- a/src/nvim/cursor.h +++ b/src/nvim/cursor.h @@ -1,7 +1,7 @@ #pragma once #include "nvim/buffer_defs.h" // IWYU pragma: keep -#include "nvim/pos_defs.h" +#include "nvim/pos_defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS # include "cursor.h.generated.h" diff --git a/src/nvim/digraph.h b/src/nvim/digraph.h index 792e859991..267004124b 100644 --- a/src/nvim/digraph.h +++ b/src/nvim/digraph.h @@ -4,7 +4,7 @@ #include "nvim/eval/typval_defs.h" // IWYU pragma: keep #include "nvim/ex_cmds_defs.h" // IWYU pragma: keep #include "nvim/garray_defs.h" // IWYU pragma: keep -#include "nvim/types_defs.h" +#include "nvim/types_defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS # include "digraph.h.generated.h" diff --git a/src/nvim/edit.h b/src/nvim/edit.h index 7cf4141045..434b653f7b 100644 --- a/src/nvim/edit.h +++ b/src/nvim/edit.h @@ -2,29 +2,37 @@ #include "nvim/autocmd_defs.h" // IWYU pragma: keep #include "nvim/buffer_defs.h" // IWYU pragma: keep -#include "nvim/pos_defs.h" +#include "nvim/pos_defs.h" // IWYU pragma: keep -// Values for in_cinkeys() -#define KEY_OPEN_FORW 0x101 -#define KEY_OPEN_BACK 0x102 -#define KEY_COMPLETE 0x103 // end of completion +/// Values for in_cinkeys() +enum { + KEY_OPEN_FORW = 0x101, + KEY_OPEN_BACK = 0x102, + KEY_COMPLETE = 0x103, ///< end of completion +}; -// Values for change_indent() -#define INDENT_SET 1 // set indent -#define INDENT_INC 2 // increase indent -#define INDENT_DEC 3 // decrease indent +/// Values for change_indent() +enum { + INDENT_SET = 1, ///< set indent + INDENT_INC = 2, ///< increase indent + INDENT_DEC = 3, ///< decrease indent +}; -// flags for beginline() -#define BL_WHITE 1 // cursor on first non-white in the line -#define BL_SOL 2 // use 'sol' option -#define BL_FIX 4 // don't leave cursor on a NUL +/// flags for beginline() +enum { + BL_WHITE = 1, ///< cursor on first non-white in the line + BL_SOL = 2, ///< use 'sol' option + BL_FIX = 4, ///< don't leave cursor on a NUL +}; -// flags for insertchar() -#define INSCHAR_FORMAT 1 // force formatting -#define INSCHAR_DO_COM 2 // format comments -#define INSCHAR_CTRLV 4 // char typed just after CTRL-V -#define INSCHAR_NO_FEX 8 // don't use 'formatexpr' -#define INSCHAR_COM_LIST 16 // format comments with list/2nd line indent +/// flags for insertchar() +enum { + INSCHAR_FORMAT = 1, ///< force formatting + INSCHAR_DO_COM = 2, ///< format comments + INSCHAR_CTRLV = 4, ///< char typed just after CTRL-V + INSCHAR_NO_FEX = 8, ///< don't use 'formatexpr' + INSCHAR_COM_LIST = 16, ///< format comments with list/2nd line indent +}; #ifdef INCLUDE_GENERATED_DECLARATIONS # include "edit.h.generated.h" diff --git a/src/nvim/eval/buffer.h b/src/nvim/eval/buffer.h index 106a499bad..1d346b99a5 100644 --- a/src/nvim/eval/buffer.h +++ b/src/nvim/eval/buffer.h @@ -2,7 +2,7 @@ #include "nvim/buffer_defs.h" // IWYU pragma: keep #include "nvim/eval/typval_defs.h" // IWYU pragma: keep -#include "nvim/types_defs.h" +#include "nvim/types_defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DECLARATIONS # include "eval/buffer.h.generated.h" diff --git a/src/nvim/eval/decode.h b/src/nvim/eval/decode.h index 1c0fd445f1..c0d10a469a 100644 --- a/src/nvim/eval/decode.h +++ b/src/nvim/eval/decode.h @@ -4,7 +4,7 @@ #include <stddef.h> // IWYU pragma: keep #include "nvim/eval/typval_defs.h" // IWYU pragma: keep -#include "nvim/types_defs.h" +#include "nvim/types_defs.h" // IWYU pragma: keep #ifdef INCLUDE_GENERATED_DE |