From ce56e0a845d68862118f44cb66c5f080e3c1bbed Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 30 Nov 2023 17:16:57 +0800 Subject: refactor(IWYU): move UI and LineFlags to ui_defs.h (#26318) --- src/clint.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'src/clint.py') diff --git a/src/clint.py b/src/clint.py index 1f588322f3..cb43ed59c7 100755 --- a/src/clint.py +++ b/src/clint.py @@ -898,14 +898,10 @@ def CheckIncludes(filename, lines, error): # the Makefile. check_includes_ignore = [ "src/nvim/api/extmark.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/ascii_defs.h", "src/nvim/assert_defs.h", "src/nvim/autocmd.h", - "src/nvim/autocmd_defs.h", "src/nvim/buffer.h", "src/nvim/buffer_defs.h", "src/nvim/channel.h", @@ -933,7 +929,6 @@ def CheckIncludes(filename, lines, error): "src/nvim/event/time.h", "src/nvim/event/wstream.h", "src/nvim/ex_cmds.h", - "src/nvim/ex_cmds_defs.h", "src/nvim/ex_docmd.h", "src/nvim/extmark.h", "src/nvim/file_search.h", @@ -972,10 +967,7 @@ def CheckIncludes(filename, lines, error): "src/nvim/syntax.h", "src/nvim/textobject.h", "src/nvim/tui/input.h", - "src/nvim/tui/tui.h", "src/nvim/ui.h", - "src/nvim/ui_client.h", - "src/nvim/ui_compositor.h", "src/nvim/viml/parser/expressions.h", "src/nvim/viml/parser/parser.h", "src/nvim/window.h", @@ -999,8 +991,10 @@ def CheckIncludes(filename, lines, error): if name in skip_headers: continue if (not name.endswith('.h.generated.h') and + not name.endswith('/defs.h') and not name.endswith('_defs.h') and - not name.endswith('/defs.h')): + not name.endswith('_defs.generated.h') and + not name.endswith('_enum.generated.h')): error(filename, i, 'build/include_defs', 5, 'Headers should not include non-"_defs" headers') -- cgit From 95dbf1af73a6f73f08f988adb6d6436d680f53c4 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 30 Nov 2023 18:41:52 +0800 Subject: refactor: move extern variables out of _defs.h files (#26320) --- src/clint.py | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'src/clint.py') diff --git a/src/clint.py b/src/clint.py index cb43ed59c7..a45969af31 100755 --- a/src/clint.py +++ b/src/clint.py @@ -880,18 +880,21 @@ def CheckForHeaderGuard(filename, lines, error): error(filename, 0, 'build/header_guard', 5, 'No "#pragma once" found in header') + def CheckIncludes(filename, lines, error): - """Checks that headers only include _defs headers + """Checks that headers only include _defs headers. Args: filename: The name of the C++ header file. lines: An array of strings, each representing a line of the file. error: The function to call with any errors found. """ - if filename.endswith('.c.h') or filename.endswith('.in.h') or FileInfo(filename).RelativePath() in { + if (filename.endswith('.c.h') + or filename.endswith('.in.h') + or FileInfo(filename).RelativePath() in { 'func_attr.h', 'os/pty_process.h', - }: + }): return # These should be synced with the ignored headers in the `iwyu` target in @@ -999,6 +1002,21 @@ def CheckIncludes(filename, lines, error): 'Headers should not include non-"_defs" headers') +def CheckNonSymbols(filename, lines, error): + """Checks that a _defs.h header only contains non-symbols. + + Args: + filename: The name of the C++ header file. + lines: An array of strings, each representing a line of the file. + error: The function to call with any errors found. + """ + for i, line in enumerate(lines): + # Only a check against extern variables for now. + if line.startswith('EXTERN ') or line.startswith('extern '): + error(filename, i, 'build/defs_header', 5, + '"_defs" headers should not contain extern variables') + + def CheckForBadCharacters(filename, lines, error): """Logs an error for each line containing bad characters. @@ -2286,6 +2304,8 @@ def ProcessFileData(filename, file_extension, lines, error, if file_extension == 'h': CheckForHeaderGuard(filename, lines, error) CheckIncludes(filename, lines, error) + if filename.endswith('/defs.h') or filename.endswith('_defs.h'): + CheckNonSymbols(filename, lines, error) RemoveMultiLineComments(filename, lines, error) clean_lines = CleansedLines(lines, init_lines) -- cgit From c8e37a589a4bffbdf374a5893ef269d2fe233ce6 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 30 Nov 2023 19:52:23 +0800 Subject: refactor(IWYU): move typedefs out of globals.h (#26322) --- src/clint.py | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'src/clint.py') diff --git a/src/clint.py b/src/clint.py index a45969af31..9b946998c9 100755 --- a/src/clint.py +++ b/src/clint.py @@ -931,11 +931,7 @@ def CheckIncludes(filename, lines, error): "src/nvim/event/stream.h", "src/nvim/event/time.h", "src/nvim/event/wstream.h", - "src/nvim/ex_cmds.h", - "src/nvim/ex_docmd.h", "src/nvim/extmark.h", - "src/nvim/file_search.h", - "src/nvim/fileio.h", "src/nvim/fold.h", "src/nvim/garray.h", "src/nvim/getchar.h", @@ -944,14 +940,11 @@ def CheckIncludes(filename, lines, error): "src/nvim/highlight.h", "src/nvim/highlight_group.h", "src/nvim/input.h", - "src/nvim/insexpand.h", "src/nvim/keycodes.h", "src/nvim/log.h", "src/nvim/lua/executor.h", "src/nvim/main.h", "src/nvim/mark.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", @@ -965,10 +958,6 @@ def CheckIncludes(filename, lines, error): "src/nvim/path.h", "src/nvim/plines.h", "src/nvim/popupmenu.h", - "src/nvim/search.h", - "src/nvim/spell.h", - "src/nvim/syntax.h", - "src/nvim/textobject.h", "src/nvim/tui/input.h", "src/nvim/ui.h", "src/nvim/viml/parser/expressions.h", -- cgit From a6f26c86cb74222fe2449f8a035f29b0ee45c98e Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 30 Nov 2023 22:48:15 +0800 Subject: refactor(IWYU): fix includes for cmdhist.h (#26324) --- src/clint.py | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src/clint.py') diff --git a/src/clint.py b/src/clint.py index 9b946998c9..ddd3ff7d44 100755 --- a/src/clint.py +++ b/src/clint.py @@ -910,11 +910,8 @@ def CheckIncludes(filename, lines, error): "src/nvim/channel.h", "src/nvim/charset.h", "src/nvim/cmdexpand.h", - "src/nvim/cmdhist.h", "src/nvim/decoration.h", - "src/nvim/diff.h", "src/nvim/drawline.h", - "src/nvim/drawscreen.h", "src/nvim/eval.h", "src/nvim/eval/encode.h", "src/nvim/eval/typval.h", @@ -932,7 +929,6 @@ def CheckIncludes(filename, lines, error): "src/nvim/event/time.h", "src/nvim/event/wstream.h", "src/nvim/extmark.h", - "src/nvim/fold.h", "src/nvim/garray.h", "src/nvim/getchar.h", "src/nvim/globals.h", @@ -941,7 +937,6 @@ def CheckIncludes(filename, lines, error): "src/nvim/highlight_group.h", "src/nvim/input.h", "src/nvim/keycodes.h", - "src/nvim/log.h", "src/nvim/lua/executor.h", "src/nvim/main.h", "src/nvim/mark.h", @@ -955,14 +950,11 @@ def CheckIncludes(filename, lines, error): "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/tui/input.h", "src/nvim/ui.h", "src/nvim/viml/parser/expressions.h", "src/nvim/viml/parser/parser.h", - "src/nvim/window.h", ] skip_headers = [ -- cgit From 09e93d7c4d33451ffe2dd2edeb7e2124b83c8078 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 1 Dec 2023 08:06:37 +0800 Subject: refactor(IWYU): create {ex_getln,rbuffer,os/fileio}_defs.h (#26338) --- src/clint.py | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/clint.py') diff --git a/src/clint.py b/src/clint.py index ddd3ff7d44..2a7eb16c9a 100755 --- a/src/clint.py +++ b/src/clint.py @@ -909,7 +909,6 @@ def CheckIncludes(filename, lines, error): "src/nvim/buffer_defs.h", "src/nvim/channel.h", "src/nvim/charset.h", - "src/nvim/cmdexpand.h", "src/nvim/decoration.h", "src/nvim/drawline.h", "src/nvim/eval.h", @@ -930,7 +929,6 @@ def CheckIncludes(filename, lines, error): "src/nvim/event/wstream.h", "src/nvim/extmark.h", "src/nvim/garray.h", - "src/nvim/getchar.h", "src/nvim/globals.h", "src/nvim/grid.h", "src/nvim/highlight.h", @@ -945,7 +943,6 @@ def CheckIncludes(filename, lines, error): "src/nvim/msgpack_rpc/helpers.h", "src/nvim/msgpack_rpc/unpacker.h", "src/nvim/option.h", - "src/nvim/os/fileio.h", "src/nvim/os/input.h", "src/nvim/os/pty_conpty_win.h", "src/nvim/os/pty_process_unix.h", -- cgit From 0bbe8e7fc257bd06a857bfc762c2b1e8e84463e1 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 1 Dec 2023 09:38:04 +0800 Subject: refactor(IWYU): fix includes for highlight_group.h (#26340) --- src/clint.py | 1 - 1 file changed, 1 deletion(-) (limited to 'src/clint.py') diff --git a/src/clint.py b/src/clint.py index 2a7eb16c9a..596e2d8a26 100755 --- a/src/clint.py +++ b/src/clint.py @@ -932,7 +932,6 @@ def CheckIncludes(filename, lines, error): "src/nvim/globals.h", "src/nvim/grid.h", "src/nvim/highlight.h", - "src/nvim/highlight_group.h", "src/nvim/input.h", "src/nvim/keycodes.h", "src/nvim/lua/executor.h", -- cgit From 14572727261278e5bf68080c9369a8507f3d564f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 5 Dec 2023 20:05:12 +0800 Subject: refactor(IWYU): move marktree types to marktree_defs.h (#26402) --- src/clint.py | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/clint.py') diff --git a/src/clint.py b/src/clint.py index 596e2d8a26..ed5aaf43d2 100755 --- a/src/clint.py +++ b/src/clint.py @@ -900,16 +900,13 @@ 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/extmark.h", "src/nvim/api/private/helpers.h", "src/nvim/api/private/validate.h", "src/nvim/assert_defs.h", - "src/nvim/autocmd.h", "src/nvim/buffer.h", "src/nvim/buffer_defs.h", "src/nvim/channel.h", "src/nvim/charset.h", - "src/nvim/decoration.h", "src/nvim/drawline.h", "src/nvim/eval.h", "src/nvim/eval/encode.h", @@ -927,7 +924,6 @@ def CheckIncludes(filename, lines, error): "src/nvim/event/stream.h", "src/nvim/event/time.h", "src/nvim/event/wstream.h", - "src/nvim/extmark.h", "src/nvim/garray.h", "src/nvim/globals.h", "src/nvim/grid.h", @@ -946,7 +942,6 @@ def CheckIncludes(filename, lines, error): "src/nvim/os/pty_conpty_win.h", "src/nvim/os/pty_process_unix.h", "src/nvim/os/pty_process_win.h", - "src/nvim/plines.h", "src/nvim/tui/input.h", "src/nvim/ui.h", "src/nvim/viml/parser/expressions.h", -- cgit From 1d63a057a6cb47e84c204f64ba5406cfe7a3ab93 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Wed, 13 Dec 2023 19:16:41 +0100 Subject: docs: fix links --- src/clint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/clint.py') diff --git a/src/clint.py b/src/clint.py index ed5aaf43d2..021d6b0a16 100755 --- a/src/clint.py +++ b/src/clint.py @@ -2082,7 +2082,7 @@ def CheckLanguage(filename, clean_lines, linenum, error): if match: error(filename, linenum, 'runtime/deprecated', 4, 'Accessing list_T internals directly is prohibited; ' - 'see https://github.com/neovim/neovim/wiki/List-management-in-Neovim') + 'see https://neovim.io/doc/user/dev_vimpatch.html#dev-vimpatch-list-management') # Check for suspicious usage of "if" like # } if (a == b) { -- cgit From 69bc519b53ebf78fd95c8256468e7d538ebcb948 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Tue, 12 Dec 2023 15:40:21 +0100 Subject: refactor: move non-symbols to defs.h headers --- src/clint.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/clint.py') diff --git a/src/clint.py b/src/clint.py index 021d6b0a16..537406cd24 100755 --- a/src/clint.py +++ b/src/clint.py @@ -900,12 +900,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/private/helpers.h", "src/nvim/api/private/validate.h", "src/nvim/assert_defs.h", "src/nvim/buffer.h", "src/nvim/buffer_defs.h", "src/nvim/channel.h", + "src/nvim/channel_defs.h", "src/nvim/charset.h", "src/nvim/drawline.h", "src/nvim/eval.h", @@ -916,7 +916,6 @@ def CheckIncludes(filename, lines, error): "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", @@ -932,8 +931,6 @@ def CheckIncludes(filename, lines, error): "src/nvim/keycodes.h", "src/nvim/lua/executor.h", "src/nvim/main.h", - "src/nvim/mark.h", - "src/nvim/msgpack_rpc/channel.h", "src/nvim/msgpack_rpc/channel_defs.h", "src/nvim/msgpack_rpc/helpers.h", "src/nvim/msgpack_rpc/unpacker.h", @@ -949,10 +946,12 @@ def CheckIncludes(filename, lines, error): ] skip_headers = [ - "klib/kvec.h", - "klib/klist.h", "auto/config.h", - "nvim/func_attr.h" + "klib/klist.h", + "klib/kvec.h", + "nvim/func_attr.h", + "nvim/gettext.h", + "nvim/globals.h" ] for i in check_includes_ignore: -- cgit From d82a586a9e39f1d346c1aea78167a85c586ed3f4 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 18 Dec 2023 06:18:11 +0800 Subject: refactor: move some anonymous enums back to non-defs headers (#26622) It isn't really useful to put anonymous enums only used as arguments to functions calls in _defs.h headers, as they will only be used by a file that calls those functions, which requires including a non-defs header. Also move os_msg() and os_errmsg() back to message.h, as on Windows they are actual functions instead of macros. Also remove gettext.h and globals.h from private/helpers.h. --- src/clint.py | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/clint.py') diff --git a/src/clint.py b/src/clint.py index 537406cd24..446593303b 100755 --- a/src/clint.py +++ b/src/clint.py @@ -905,7 +905,6 @@ def CheckIncludes(filename, lines, error): "src/nvim/buffer.h", "src/nvim/buffer_defs.h", "src/nvim/channel.h", - "src/nvim/channel_defs.h", "src/nvim/charset.h", "src/nvim/drawline.h", "src/nvim/eval.h", @@ -950,8 +949,6 @@ def CheckIncludes(filename, lines, error): "klib/klist.h", "klib/kvec.h", "nvim/func_attr.h", - "nvim/gettext.h", - "nvim/globals.h" ] for i in check_includes_ignore: -- cgit From 6abdc1ac1f904173d01efcf440d1460c001bc299 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 18 Dec 2023 09:05:59 +0800 Subject: refactor: split WIN_EXECUTE() into two functions (#26627) --- src/clint.py | 1 - 1 file changed, 1 deletion(-) (limited to 'src/clint.py') diff --git a/src/clint.py b/src/clint.py index 446593303b..51155f0038 100755 --- a/src/clint.py +++ b/src/clint.py @@ -912,7 +912,6 @@ def CheckIncludes(filename, lines, error): "src/nvim/eval/typval.h", "src/nvim/eval/typval_defs.h", "src/nvim/eval/userfunc.h", - "src/nvim/eval/window.h", "src/nvim/event/libuv_process.h", "src/nvim/event/loop.h", "src/nvim/event/process.h", -- cgit From 8533adb4844b771b84dac2141fa2fa60e0487b47 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 21 Dec 2023 16:50:05 +0800 Subject: refactor(IWYU): move decor provider types to decoration_defs.h (#26692) --- src/clint.py | 1 - 1 file changed, 1 deletion(-) (limited to 'src/clint.py') diff --git a/src/clint.py b/src/clint.py index 51155f0038..80ebf565a1 100755 --- a/src/clint.py +++ b/src/clint.py @@ -906,7 +906,6 @@ def CheckIncludes(filename, lines, error): "src/nvim/buffer_defs.h", "src/nvim/channel.h", "src/nvim/charset.h", - "src/nvim/drawline.h", "src/nvim/eval.h", "src/nvim/eval/encode.h", "src/nvim/eval/typval.h", -- cgit From af93a74a0f4afa9a3a4f55ffdf28141eaf776d22 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 18 Dec 2023 10:55:23 +0100 Subject: refactor: run IWYU on entire repo Reference: https://github.com/neovim/neovim/issues/6371. --- src/clint.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/clint.py') diff --git a/src/clint.py b/src/clint.py index 80ebf565a1..303c3df25d 100755 --- a/src/clint.py +++ b/src/clint.py @@ -897,8 +897,6 @@ def CheckIncludes(filename, lines, error): }): return - # These should be synced with the ignored headers in the `iwyu` target in - # the Makefile. check_includes_ignore = [ "src/nvim/api/private/validate.h", "src/nvim/assert_defs.h", @@ -913,6 +911,7 @@ def CheckIncludes(filename, lines, error): "src/nvim/eval/userfunc.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", @@ -928,6 +927,7 @@ def CheckIncludes(filename, lines, error): "src/nvim/keycodes.h", "src/nvim/lua/executor.h", "src/nvim/main.h", + "src/nvim/mark.h", "src/nvim/msgpack_rpc/channel_defs.h", "src/nvim/msgpack_rpc/helpers.h", "src/nvim/msgpack_rpc/unpacker.h", -- cgit From 089b934352437ab310a6dd3b138c7ed9445a3d7b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 22 Dec 2023 12:24:23 +0800 Subject: refactor(options): generate BV_ and WV_ constants (#26705) --- src/clint.py | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'src/clint.py') diff --git a/src/clint.py b/src/clint.py index 303c3df25d..663416553e 100755 --- a/src/clint.py +++ b/src/clint.py @@ -901,7 +901,6 @@ def CheckIncludes(filename, lines, error): "src/nvim/api/private/validate.h", "src/nvim/assert_defs.h", "src/nvim/buffer.h", - "src/nvim/buffer_defs.h", "src/nvim/channel.h", "src/nvim/charset.h", "src/nvim/eval.h", @@ -910,34 +909,22 @@ def CheckIncludes(filename, lines, error): "src/nvim/eval/typval_defs.h", "src/nvim/eval/userfunc.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/garray.h", "src/nvim/globals.h", "src/nvim/grid.h", "src/nvim/highlight.h", - "src/nvim/input.h", "src/nvim/keycodes.h", "src/nvim/lua/executor.h", "src/nvim/main.h", "src/nvim/mark.h", "src/nvim/msgpack_rpc/channel_defs.h", - "src/nvim/msgpack_rpc/helpers.h", "src/nvim/msgpack_rpc/unpacker.h", "src/nvim/option.h", - "src/nvim/os/input.h", "src/nvim/os/pty_conpty_win.h", "src/nvim/os/pty_process_unix.h", "src/nvim/os/pty_process_win.h", "src/nvim/tui/input.h", - "src/nvim/ui.h", "src/nvim/viml/parser/expressions.h", "src/nvim/viml/parser/parser.h", ] -- cgit From 242261d4e77806cdb4559c2be58613113a393a4e Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 23 Dec 2023 08:28:17 +0800 Subject: refactor(IWYU): move evalarg_T to eval_defs.h (#26716) --- src/clint.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/clint.py') diff --git a/src/clint.py b/src/clint.py index 663416553e..32ed81f95c 100755 --- a/src/clint.py +++ b/src/clint.py @@ -903,11 +903,9 @@ def CheckIncludes(filename, lines, error): "src/nvim/buffer.h", "src/nvim/channel.h", "src/nvim/charset.h", - "src/nvim/eval.h", "src/nvim/eval/encode.h", "src/nvim/eval/typval.h", "src/nvim/eval/typval_defs.h", - "src/nvim/eval/userfunc.h", "src/nvim/event/libuv_process.h", "src/nvim/event/multiqueue.h", "src/nvim/garray.h", -- cgit From c16d5729b52d2f878cd035341b951b1f185b45c9 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 23 Dec 2023 15:53:28 +0800 Subject: refactor: remove CPO_TO_CPO_FLAGS() (#26718) Just pass p_cpo to replace_termcodes() directly. This allows removing option_vars.h from keycodes.h, and also avoids the mistake of passing 0 as cpo_flags. --- src/clint.py | 1 - 1 file changed, 1 deletion(-) (limited to 'src/clint.py') diff --git a/src/clint.py b/src/clint.py index 32ed81f95c..2659abbb0e 100755 --- a/src/clint.py +++ b/src/clint.py @@ -912,7 +912,6 @@ def CheckIncludes(filename, lines, error): "src/nvim/globals.h", "src/nvim/grid.h", "src/nvim/highlight.h", - "src/nvim/keycodes.h", "src/nvim/lua/executor.h", "src/nvim/main.h", "src/nvim/mark.h", -- cgit From 675522af18f59918a64e6dbe5f0ba3b1d3b4eb65 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sun, 24 Dec 2023 13:26:28 +0100 Subject: build: remove clint checks and style text covered by uncrustify --- src/clint.py | 53 ++--------------------------------------------------- 1 file changed, 2 insertions(+), 51 deletions(-) (limited to 'src/clint.py') diff --git a/src/clint.py b/src/clint.py index 2659abbb0e..7fcf840487 100755 --- a/src/clint.py +++ b/src/clint.py @@ -749,53 +749,6 @@ BRACES = { } -CLOSING_BRACES = {v: k for k, v in BRACES.items()} - - -def GetExprBracesPosition(clean_lines, linenum, pos): - """List positions of all kinds of braces - - If input points to ( or { or [ then function proceeds until finding the - position which closes it. - - Args: - clean_lines: A CleansedLines instance containing the file. - linenum: Current line number. - pos: A position on the line. - - Yields: - A tuple (linenum, pos, brace, depth) that points to each brace. - Additionally each new line (linenum, pos, 's', depth) is yielded, for each - line end (linenum, pos, 'e', depth) is yielded and at the very end it - yields (linenum, pos, None, None). - """ - depth = 0 - yielded_line_start = True - startpos = pos - while linenum < clean_lines.NumLines() - 1: - line = clean_lines.elided_with_space_strings[linenum] - if not line.startswith('#') or yielded_line_start: - # Ignore #ifdefs, but not if it is macros that are checked - for i, brace in enumerate(line[startpos:]): - pos = i + startpos - if brace != ' ' and not yielded_line_start: - yield (linenum, pos, 's', depth) - yielded_line_start = True - if brace in BRACES: - depth += 1 - yield (linenum, pos, brace, depth) - elif brace in CLOSING_BRACES: - yield (linenum, pos, brace, depth) - depth -= 1 - if depth == 0: - yield (linenum, pos, None, None) - return - yield (linenum, len(line) - 1, 'e', depth) - yielded_line_start = False - startpos = 0 - linenum += 1 - - def FindEndOfExpressionInLine(line, startpos, depth, startchar, endchar): """Find the position just after the matching endchar. @@ -1665,8 +1618,7 @@ def CheckSpacing(filename, clean_lines, linenum, error): line[commentpos - 1] not in string.whitespace) or (commentpos >= 2 and line[commentpos - 2] not in string.whitespace))): - error(filename, linenum, 'whitespace/comments', 2, - 'At least two spaces is best between code and comments') + return # There should always be a space between the // and the comment commentend = commentpos + 2 if commentend < len(line) and not line[commentend] == ' ': @@ -1777,8 +1729,7 @@ def CheckSpacing(filename, clean_lines, linenum, error): # There shouldn't be space around unary operators match = Search(r'(!\s|~\s|[\s]--[\s;]|[\s]\+\+[\s;])', line) if match: - error(filename, linenum, 'whitespace/operators', 4, - 'Extra space for operator %s' % match.group(1)) + return # For if/for/while/switch, the left and right parens should be # consistent about how many spaces are inside the parens, and -- cgit From 1813661a6197c76ea6621284570aca1d56597099 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Thu, 4 Jan 2024 15:38:16 +0100 Subject: refactor(IWYU): fix headers Remove `export` pramgas from defs headers as it causes IWYU to believe that the definitions from the defs headers comes from main header, which is not what we really want. --- src/clint.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'src/clint.py') diff --git a/src/clint.py b/src/clint.py index 7fcf840487..78eabb698f 100755 --- a/src/clint.py +++ b/src/clint.py @@ -853,17 +853,12 @@ def CheckIncludes(filename, lines, error): check_includes_ignore = [ "src/nvim/api/private/validate.h", "src/nvim/assert_defs.h", - "src/nvim/buffer.h", "src/nvim/channel.h", "src/nvim/charset.h", - "src/nvim/eval/encode.h", "src/nvim/eval/typval.h", - "src/nvim/eval/typval_defs.h", - "src/nvim/event/libuv_process.h", "src/nvim/event/multiqueue.h", "src/nvim/garray.h", "src/nvim/globals.h", - "src/nvim/grid.h", "src/nvim/highlight.h", "src/nvim/lua/executor.h", "src/nvim/main.h", @@ -872,18 +867,17 @@ def CheckIncludes(filename, lines, error): "src/nvim/msgpack_rpc/unpacker.h", "src/nvim/option.h", "src/nvim/os/pty_conpty_win.h", - "src/nvim/os/pty_process_unix.h", "src/nvim/os/pty_process_win.h", - "src/nvim/tui/input.h", - "src/nvim/viml/parser/expressions.h", - "src/nvim/viml/parser/parser.h", ] skip_headers = [ "auto/config.h", "klib/klist.h", "klib/kvec.h", + "mpack/mpack_core.h", + "mpack/object.h", "nvim/func_attr.h", + "termkey/termkey.h", ] for i in check_includes_ignore: -- cgit From dcb11c1091416db04101dab3566563c74b47452b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 10 Feb 2024 11:11:30 +0800 Subject: build(clint): don't allow INIT() in non-header files (#27407) --- src/clint.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/clint.py') diff --git a/src/clint.py b/src/clint.py index 78eabb698f..062901b43a 100755 --- a/src/clint.py +++ b/src/clint.py @@ -152,8 +152,10 @@ _ERROR_CATEGORIES = [ 'build/endif_comment', 'build/header_guard', 'build/include_defs', + 'build/defs_header', 'build/printf_format', 'build/storage_class', + 'build/init_macro', 'readability/bool', 'readability/multiline_comment', 'readability/multiline_string', @@ -2086,6 +2088,11 @@ def CheckLanguage(filename, clean_lines, linenum, error): " named ('k' followed by CamelCase) compile-time constant for" " the size.") + # INIT() macro should only be used in header files. + if not filename.endswith('.h') and Search(r' INIT\(', line): + error(filename, linenum, 'build/init_macro', 4, + 'INIT() macro should only be used in header files.') + # Detect TRUE and FALSE. match = Search(r'\b(TRUE|FALSE)\b', line) if match: -- cgit