refactor: fix IWYU mapping file and use IWYU (#21802)

Also add the EXITFREE definition to main_lib rather than the nvim target, as the header generation needs the EXITFREE flag to work properly.
This commit is contained in:
dundargoc 2023-01-15 14:16:33 +01:00 committed by GitHub
parent 43feb973e3
commit 3269902a13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 72 additions and 45 deletions

View File

@ -178,6 +178,8 @@
{ include: [ '"regexp_bt.h.generated.h"', private, '"nvim/regexp.h"', public ] },
{ include: [ '"ui_events_call.h.generated.h"', private, '"nvim/ui.h"', public ] },
{ include: [ '"ui_events_client.h.generated.h"', private, '"nvim/ui_client.h"', public ] },
{ include: [ '"ui_events_remote.generated.h"', private, '"nvim/api/ui.h"', public ] },
{ include: [ '"ui_events_remote.h.generated.h"', private, '"nvim/api/ui.h"', public ] },
# Def to normal headers: nvim/header_defs.h -> nvim/header.h
#

View File

@ -85,7 +85,7 @@ if(ENABLE_IWYU)
string(APPEND iwyu_flags "-Xiwyu;--mapping_file=${PROJECT_SOURCE_DIR}/cmake.config/iwyu/gcc.symbols.imp")
set_target_properties(nvim PROPERTIES C_INCLUDE_WHAT_YOU_USE "${iwyu_flags}")
target_compile_definitions(nvim PRIVATE EXITFREE)
target_compile_definitions(main_lib INTERFACE EXITFREE)
endif()
if(MSVC)

View File

@ -33,7 +33,6 @@
#include "nvim/pos.h"
#include "nvim/ui.h"
#include "nvim/version.h"
#include "nvim/vim.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/private/funcs_metadata.generated.h"

View File

@ -13,7 +13,11 @@
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/api/ui.h"
#include "nvim/autocmd.h"
#include "nvim/channel.h"
#include "nvim/event/loop.h"
#include "nvim/event/wstream.h"
#include "nvim/globals.h"
#include "nvim/grid.h"
#include "nvim/highlight.h"
#include "nvim/main.h"
@ -27,13 +31,12 @@
#include "nvim/types.h"
#include "nvim/ui.h"
#include "nvim/vim.h"
#include "nvim/window.h"
#define BUF_POS(data) ((size_t)((data)->buf_wptr - (data)->buf))
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/ui.c.generated.h"
# include "ui_events_remote.generated.h"
# include "ui_events_remote.generated.h" // IWYU pragma: export
#endif
static PMap(uint64_t) connected_uis = MAP_INIT;

View File

@ -13,6 +13,7 @@
#include <string.h>
#include "auto/config.h"
#include "klib/kvec.h"
#include "nvim/ascii.h"
#include "nvim/buffer_defs.h"
#include "nvim/charset.h"
@ -35,6 +36,7 @@
#include "nvim/plines.h"
#include "nvim/pos.h"
#include "nvim/state.h"
#include "nvim/strings.h"
#include "nvim/vim.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS

View File

@ -5,7 +5,9 @@
#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "nvim/api/private/converter.h"
#include "nvim/api/private/helpers.h"
@ -23,8 +25,6 @@
#include "nvim/message.h"
#include "nvim/option.h"
#include "nvim/shada.h"
#include "nvim/types.h"
#include "nvim/vim.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "context.c.generated.h"

View File

@ -21,7 +21,6 @@
#include "nvim/decoration_provider.h"
#include "nvim/diff.h"
#include "nvim/drawline.h"
#include "nvim/eval.h"
#include "nvim/extmark_defs.h"
#include "nvim/fold.h"
#include "nvim/garray.h"

View File

@ -9,6 +9,7 @@
#include "nvim/ascii.h"
#include "nvim/autocmd.h"
#include "nvim/buffer.h"
#include "nvim/buffer_defs.h"
#include "nvim/change.h"
#include "nvim/cursor.h"
#include "nvim/eval.h"

View File

@ -4,6 +4,7 @@
#include <msgpack.h>
#include <msgpack/pack.h>
#include <stddef.h>
#include <string.h>
#include "nvim/eval.h"
#include "nvim/eval/typval.h"

View File

@ -45,6 +45,7 @@
#include "nvim/runtime.h"
#include "nvim/search.h"
#include "nvim/strings.h"
#include "nvim/types.h"
#include "nvim/ui.h"
#include "nvim/vim.h"

View File

@ -12,6 +12,7 @@
#include "nvim/ascii.h"
#include "nvim/autocmd.h"
#include "nvim/buffer.h"
#include "nvim/buffer_defs.h"
#include "nvim/cursor.h"
#include "nvim/eval/funcs.h"
#include "nvim/eval/typval.h"

View File

@ -2,9 +2,19 @@
#define NVIM_EVAL_WINDOW_H
#include <stdbool.h>
#include <string.h>
#include "nvim/buffer.h"
#include "nvim/buffer_defs.h"
#include "nvim/cursor.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/globals.h"
#include "nvim/mark.h"
#include "nvim/option_defs.h"
#include "nvim/os/os.h"
#include "nvim/pos.h"
#include "nvim/vim.h"
#include "nvim/window.h"
/// Structure used by switch_win() to pass values to restore_win()
typedef struct {

View File

@ -1,6 +1,7 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include <assert.h>
#include <stdint.h>
#include <uv.h>
@ -12,6 +13,7 @@
#include "nvim/log.h"
#include "nvim/macros.h"
#include "nvim/os/os.h"
#include "nvim/ui_client.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "event/libuv_process.c.generated.h"

View File

@ -20,6 +20,7 @@
#include "nvim/os/shell.h"
#include "nvim/os/time.h"
#include "nvim/rbuffer.h"
#include "nvim/ui_client.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "event/process.c.generated.h"

View File

@ -38,7 +38,6 @@
#include "nvim/path.h"
#include "nvim/pos.h"
#include "nvim/runtime.h"
#include "nvim/types.h"
#include "nvim/vim.h"
#include "nvim/window.h"

View File

@ -30,6 +30,7 @@
#include "nvim/hashtab.h"
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/types.h"
#include "nvim/vim.h"
// Magic value for algorithm that walks through the array.

View File

@ -17,6 +17,7 @@
#include "nvim/edit.h"
#include "nvim/eval.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/ex_cmds_defs.h"
#include "nvim/ex_docmd.h"
#include "nvim/extmark.h"
#include "nvim/gettext.h"
@ -24,6 +25,7 @@
#include "nvim/indent.h"
#include "nvim/indent_c.h"
#include "nvim/mark.h"
#include "nvim/mbyte.h"
#include "nvim/memline.h"
#include "nvim/memory.h"
#include "nvim/message.h"

View File

@ -23,7 +23,6 @@
#include "nvim/pos.h"
#include "nvim/search.h"
#include "nvim/strings.h"
#include "nvim/types.h"
#include "nvim/vim.h"
// Find result cache for cpp_baseclass

View File

@ -7,6 +7,7 @@
#include <limits.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -9,7 +9,6 @@
#include "nvim/linematch.h"
#include "nvim/macros.h"
#include "nvim/memory.h"
#include "nvim/vim.h"
// struct for running the diff linematch algorithm
typedef struct {

View File

@ -49,6 +49,7 @@
#include "nvim/message.h"
#include "nvim/msgpack_rpc/channel.h"
#include "nvim/option_defs.h"
#include "nvim/os/fileio.h"
#include "nvim/os/os.h"
#include "nvim/path.h"
#include "nvim/pos.h"
@ -56,7 +57,6 @@
#include "nvim/runtime.h"
#include "nvim/strings.h"
#include "nvim/ui.h"
#include "nvim/ui_compositor.h"
#include "nvim/undo.h"
#include "nvim/usercmd.h"
#include "nvim/version.h"

View File

@ -10,7 +10,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "auto/config.h"
#include "nvim/arglist.h"
@ -62,7 +61,6 @@
#include "nvim/os/fileio.h"
#include "nvim/os/input.h"
#include "nvim/os/os.h"
#include "nvim/os/pty_process.h"
#include "nvim/os/stdpaths_defs.h"
#include "nvim/os/time.h"
#include "nvim/path.h"
@ -97,7 +95,6 @@
#include "nvim/msgpack_rpc/helpers.h"
#include "nvim/msgpack_rpc/server.h"
#include "nvim/os/signal.h"
#include "nvim/tui/tui.h"
// values for "window_layout"
enum {

View File

@ -5,6 +5,7 @@
#include <assert.h>
#include <inttypes.h>
#include <lauxlib.h>
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>

View File

@ -5,6 +5,7 @@
#include <assert.h>
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
@ -39,7 +40,6 @@
#include "nvim/sign.h"
#include "nvim/strings.h"
#include "nvim/textobject.h"
#include "nvim/types.h"
#include "nvim/undo_defs.h"
#include "nvim/vim.h"

View File

@ -62,7 +62,6 @@
#include "nvim/os/os.h"
#include "nvim/path.h"
#include "nvim/pos.h"
#include "nvim/types.h"
#include "nvim/vim.h"
#define MEMFILE_PAGE_SIZE 4096 /// default page size

View File

@ -31,7 +31,6 @@
#include "nvim/message.h"
#include "nvim/sign.h"
#include "nvim/ui.h"
#include "nvim/ui_compositor.h"
#include "nvim/usercmd.h"
#include "nvim/vim.h"

View File

@ -6,6 +6,7 @@
#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include "nvim/ascii.h"

View File

@ -3,6 +3,7 @@
#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>

View File

@ -27,12 +27,14 @@
#include "nvim/eval/window.h"
#include "nvim/fold.h"
#include "nvim/getchar.h"
#include "nvim/gettext.h"
#include "nvim/globals.h"
#include "nvim/grid.h"
#include "nvim/highlight.h"
#include "nvim/macros.h"
#include "nvim/mbyte.h"
#include "nvim/memline_defs.h"
#include "nvim/message.h"
#include "nvim/mouse.h"
#include "nvim/move.h"
#include "nvim/option.h"

View File

@ -20,14 +20,15 @@
#include "nvim/channel.h"
#include "nvim/event/defs.h"
#include "nvim/event/loop.h"
#include "nvim/event/process.h"
#include "nvim/event/rstream.h"
#include "nvim/event/stream.h"
#include "nvim/event/wstream.h"
#include "nvim/globals.h"
#include "nvim/log.h"
#include "nvim/main.h"
#include "nvim/map.h"
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/msgpack_rpc/channel.h"
#include "nvim/msgpack_rpc/channel_defs.h"
#include "nvim/msgpack_rpc/helpers.h"

View File

@ -4,6 +4,7 @@
#include <stdbool.h>
#include "nvim/buffer_defs.h"
#include "nvim/macros.h"
#include "nvim/pos.h"
// Values for find_ident_under_cursor()

View File

@ -3,6 +3,7 @@
#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include "nvim/api/private/helpers.h"

View File

@ -16,6 +16,8 @@
#include "auto/config.h"
#include "nvim/gettext.h"
#include "nvim/globals.h"
#include "nvim/log.h"
#include "nvim/macros.h"
#include "nvim/memory.h"
#include "nvim/message.h"

View File

@ -6,6 +6,7 @@
#include <limits.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>

View File

@ -23,7 +23,6 @@
#include "nvim/option.h"
#include "nvim/plines.h"
#include "nvim/pos.h"
#include "nvim/types.h"
#include "nvim/vim.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS

View File

@ -9,7 +9,6 @@
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <uv.h>

View File

@ -53,7 +53,6 @@
#include "nvim/search.h"
#include "nvim/shada.h"
#include "nvim/strings.h"
#include "nvim/types.h"
#include "nvim/version.h"
#include "nvim/vim.h"

View File

@ -31,12 +31,14 @@
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/move.h"
#include "nvim/normal.h"
#include "nvim/option.h"
#include "nvim/optionstr.h"
#include "nvim/os/os.h"
#include "nvim/path.h"
#include "nvim/pos.h"
#include "nvim/screen.h"
#include "nvim/sign_defs.h"
#include "nvim/statusline.h"
#include "nvim/strings.h"
#include "nvim/types.h"

View File

@ -4,6 +4,7 @@
// textobject.c: functions for text objects
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
@ -28,7 +29,6 @@
#include "nvim/search.h"
#include "nvim/strings.h"
#include "nvim/textobject.h"
#include "nvim/types.h"
#include "nvim/vim.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS

View File

@ -8,31 +8,27 @@
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/api/vim.h"
#include "nvim/ascii.h"
#include "nvim/autocmd.h"
#include "nvim/charset.h"
#include "nvim/event/defs.h"
#include "nvim/event/multiqueue.h"
#include "nvim/globals.h"
#include "nvim/log.h"
#include "nvim/macros.h"
#include "nvim/main.h"
#include "nvim/map.h"
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/option.h"
#include "nvim/os/input.h"
#include "nvim/os/os.h"
#include "nvim/tui/input.h"
#include "nvim/tui/input_defs.h"
#include "nvim/tui/tui.h"
#include "nvim/types.h"
#include "nvim/ui_client.h"
#ifdef MSWIN
# include "nvim/os/os_win_console.h"
#endif
#include "nvim/event/rstream.h"
#include "nvim/msgpack_rpc/channel.h"
#include "nvim/ui.h"
#define KEY_BUFFER_SIZE 0xfff

View File

@ -7,12 +7,12 @@
#include <string.h>
#include <unibilium.h>
#include "klib/kvec.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/ascii.h"
#include "nvim/charset.h"
#include "nvim/globals.h"
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/option.h"
#include "nvim/strings.h"
#include "nvim/tui/terminfo.h"
#include "nvim/tui/terminfo_defs.h"

View File

@ -16,7 +16,6 @@
#include "klib/kvec.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/api/vim.h"
#include "nvim/ascii.h"
#include "nvim/cursor_shape.h"
#include "nvim/event/defs.h"
@ -32,12 +31,10 @@
#include "nvim/main.h"
#include "nvim/mbyte.h"
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/msgpack_rpc/channel.h"
#include "nvim/option.h"
#include "nvim/os/input.h"
#include "nvim/os/os.h"
#include "nvim/os/signal.h"
#include "nvim/ui_client.h"
#ifdef MSWIN
# include "nvim/os/os_win_console.h"
#endif
@ -46,7 +43,6 @@
#include "nvim/tui/tui.h"
#include "nvim/ugrid.h"
#include "nvim/ui.h"
#include "nvim/vim.h"
// Space reserved in two output buffers to make the cursor normal or invisible
// when flushing. No existing terminal will require 32 bytes to do that.

View File

@ -7,8 +7,8 @@
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "auto/config.h"
#include "klib/kvec.h"
#include "nvim/api/private/helpers.h"
#include "nvim/api/ui.h"
@ -17,8 +17,6 @@
#include "nvim/buffer_defs.h"
#include "nvim/cursor_shape.h"
#include "nvim/drawscreen.h"
#include "nvim/event/defs.h"
#include "nvim/event/loop.h"
#include "nvim/ex_getln.h"
#include "nvim/gettext.h"
#include "nvim/globals.h"
@ -27,15 +25,14 @@
#include "nvim/highlight_defs.h"
#include "nvim/log.h"
#include "nvim/lua/executor.h"
#include "nvim/main.h"
#include "nvim/map.h"
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/msgpack_rpc/channel.h"
#include "nvim/option.h"
#include "nvim/os/time.h"
#include "nvim/strings.h"
#include "nvim/tui/tui.h"
#include "nvim/ui.h"
#include "nvim/ui_client.h"
#include "nvim/ui_compositor.h"
#include "nvim/vim.h"
#include "nvim/window.h"

View File

@ -6,15 +6,18 @@
#include <stdlib.h>
#include "nvim/api/private/helpers.h"
#include "nvim/channel.h"
#include "nvim/eval.h"
#include "nvim/eval/typval_defs.h"
#include "nvim/event/loop.h"
#include "nvim/event/multiqueue.h"
#include "nvim/globals.h"
#include "nvim/highlight.h"
#include "nvim/log.h"
#include "nvim/main.h"
#include "nvim/memory.h"
#include "nvim/msgpack_rpc/channel.h"
#include "nvim/msgpack_rpc/channel_defs.h"
#include "nvim/os/os_defs.h"
#include "nvim/tui/tui.h"
#include "nvim/ui.h"
#include "nvim/ui_client.h"

View File

@ -1,11 +1,14 @@
#ifndef NVIM_UI_CLIENT_H
#define NVIM_UI_CLIENT_H
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "nvim/api/private/defs.h"
#include "nvim/grid_defs.h"
#include "nvim/macros.h"
#include "nvim/types.h"
typedef struct {
const char *name;
@ -35,10 +38,11 @@ EXTERN TriState ui_client_bg_respose INIT(= kNone);
EXTERN bool ui_client_forward_stdin INIT(= false);
#define UI_CLIENT_STDIN_FD 3
// uncrustify:off
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "ui_client.h.generated.h"
# include "ui_events_client.h.generated.h"
#endif
// uncrustify:on
#endif // NVIM_UI_CLIENT_H

View File

@ -24,7 +24,6 @@
#include "nvim/highlight_group.h"
#include "nvim/log.h"
#include "nvim/macros.h"
#include "nvim/map.h"
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/option_defs.h"

View File

@ -11,12 +11,14 @@
#include <stdlib.h>
#include <string.h>
#include "klib/kvec.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/arglist.h"
#include "nvim/ascii.h"
#include "nvim/autocmd.h"
#include "nvim/buffer.h"
#include "nvim/buffer_defs.h"
#include "nvim/charset.h"
#include "nvim/cursor.h"
#include "nvim/decoration.h"
@ -59,6 +61,7 @@
#include "nvim/option.h"
#include "nvim/optionstr.h"
#include "nvim/os/os.h"
#include "nvim/os/os_defs.h"
#include "nvim/path.h"
#include "nvim/plines.h"
#include "nvim/pos.h"

View File

@ -6,6 +6,7 @@
#include "nvim/buffer.h"
#include "nvim/buffer_defs.h"
#include "nvim/macros.h"
#include "nvim/mark.h"
#include "nvim/os/os.h"
#include "nvim/os/os_defs.h"