build: enable IWYU on mac

This commit is contained in:
dundargoc
2023-11-26 21:36:02 +01:00
committed by dundargoc
parent 5b765fcab4
commit 40139738eb
29 changed files with 82 additions and 132 deletions

View File

@@ -259,6 +259,7 @@ if(ENABLE_IWYU)
set(iwyu_flags "${IWYU_PRG};")
string(APPEND iwyu_flags "-Xiwyu;--no_default_mappings;")
string(APPEND iwyu_flags "-Xiwyu;--no_fwd_decls;")
string(APPEND iwyu_flags "-Xiwyu;--mapping_file=${PROJECT_SOURCE_DIR}/cmake.config/iwyu/mapping.imp")
set_target_properties(nvim PROPERTIES C_INCLUDE_WHAT_YOU_USE "${iwyu_flags}")

View File

@@ -3,7 +3,7 @@
#include <stdint.h>
#include <string.h>
#include "auto/config.h"
#include "auto/config.h" // IWYU pragma: keep
#include "nvim/base64.h"
#include "nvim/memory.h"

View File

@@ -4,7 +4,7 @@
#include <stdint.h>
#include <stdio.h>
typedef struct file_buffer buf_T; // Forward declaration
typedef struct file_buffer buf_T;
/// Reference to a buffer that stores the value of buf_free_count.
/// bufref_valid() only needs to check "buf" when the count differs.

View File

@@ -6,6 +6,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"

View File

@@ -9,6 +9,7 @@
#include "nvim/ascii.h"
#include "nvim/autocmd.h"
#include "nvim/autocmd_defs.h"
#include "nvim/buffer.h"
#include "nvim/change.h"
#include "nvim/charset.h"

View File

@@ -7,6 +7,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "auto/config.h"
#include "nvim/api/private/converter.h"

View File

@@ -5,6 +5,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "nvim/ascii.h"
#include "nvim/assert.h"

View File

@@ -2,7 +2,7 @@
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <sys/types.h>
#include <uv.h>
#include "nvim/event/loop.h"

View File

@@ -9,6 +9,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "auto/config.h"
#include "nvim/arglist.h"

View File

@@ -11,6 +11,7 @@
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
#include <uv.h>

View File

@@ -4,6 +4,7 @@
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include "nvim/ascii.h"
#include "nvim/charset.h"

View File

@@ -5,8 +5,8 @@
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#ifdef NVIM_VENDOR_BIT
# include "bit.h"

View File

@@ -21,6 +21,11 @@
#include "nvim/vim.h"
// uncrustify:on
#include "auto/config.h" // IWYU pragma: keep
#include "nvim/api/extmark.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/api/ui.h"
#include "nvim/arglist.h"
#include "nvim/ascii.h"
#include "nvim/autocmd.h"
@@ -34,7 +39,9 @@
#include "nvim/eval.h"
#include "nvim/eval/typval.h"
#include "nvim/eval/userfunc.h"
#include "nvim/event/loop.h"
#include "nvim/event/multiqueue.h"
#include "nvim/event/process.h"
#include "nvim/event/stream.h"
#include "nvim/ex_cmds.h"
#include "nvim/ex_docmd.h"
@@ -61,6 +68,9 @@
#include "nvim/message.h"
#include "nvim/mouse.h"
#include "nvim/move.h"
#include "nvim/msgpack_rpc/channel.h"
#include "nvim/msgpack_rpc/helpers.h"
#include "nvim/msgpack_rpc/server.h"
#include "nvim/normal.h"
#include "nvim/ops.h"
#include "nvim/option.h"
@@ -71,6 +81,7 @@
#include "nvim/os/input.h"
#include "nvim/os/lang.h"
#include "nvim/os/os.h"
#include "nvim/os/signal.h"
#include "nvim/os/stdpaths_defs.h"
#include "nvim/path.h"
#include "nvim/popupmenu.h"
@@ -91,16 +102,6 @@
#ifdef MSWIN
# include "nvim/os/os_win_console.h"
#endif
#include "nvim/api/extmark.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/api/ui.h"
#include "nvim/event/loop.h"
#include "nvim/event/process.h"
#include "nvim/msgpack_rpc/channel.h"
#include "nvim/msgpack_rpc/helpers.h"
#include "nvim/msgpack_rpc/server.h"
#include "nvim/os/signal.h"
// values for "window_layout"
enum {

View File

@@ -47,6 +47,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "klib/kvec.h"
#include "nvim/garray.h"

View File

@@ -32,6 +32,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <wctype.h>
#include "auto/config.h"

View File

@@ -39,6 +39,7 @@
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <time.h>
#include <uv.h>

View File

@@ -8,6 +8,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "nvim/api/private/helpers.h"
#include "nvim/ascii.h"

View File

@@ -9,6 +9,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "nvim/api/private/defs.h"
#include "nvim/ascii.h"

View File

@@ -28,6 +28,10 @@
# include "nvim/os/os_win_console.h"
#endif
#ifdef HAVE_SYS_UIO_H
# include <sys/uio.h>
#endif
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "os/fileio.c.generated.h"
#endif

View File

@@ -67,8 +67,6 @@ static const char e_xattr_other[]
= N_("E1509: Error occurred when reading or writing extended attribute");
#endif
struct iovec;
#define RUN_UV_FS_FUNC(ret, func, ...) \
do { \
uv_fs_t req; \

View File

@@ -3,18 +3,19 @@
/// psutil is a good reference for cross-platform syscall voodoo:
/// https://github.com/giampaolo/psutil/tree/master/psutil/arch
// IWYU pragma: no_include <sys/param.h>
#include <assert.h>
#include <signal.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <uv.h>
#ifdef MSWIN
# include <tlhelp32.h>
#endif
#if defined(__FreeBSD__) // XXX: OpenBSD ?
#if defined(__FreeBSD__)
# include <string.h>
# include <sys/types.h>
# include <sys/user.h>
@@ -25,8 +26,13 @@
#endif
#if defined(__APPLE__) || defined(BSD)
# include <pwd.h>
# include <sys/sysctl.h>
# include "nvim/macros.h"
#endif
#if defined(__linux__)
# include <stdio.h>
#endif
#include "nvim/log.h"

View File

@@ -1,6 +1,7 @@
#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#ifndef MSWIN
# include <signal.h>
#endif
@@ -11,9 +12,12 @@
#include "nvim/globals.h"
#include "nvim/log.h"
#include "nvim/main.h"
#include "nvim/memline.h"
#include "nvim/os/signal.h"
#ifdef SIGPWR
# include "nvim/memline.h"
#endif
static SignalWatcher spipe, shup, squit, sterm, susr1, swinch;
#ifdef SIGPWR
static SignalWatcher spwr;

View File

@@ -17,8 +17,6 @@
#include "nvim/os/os.h"
#include "nvim/os/time.h"
struct tm;
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "os/time.c.generated.h" // IWYU pragma: export
#endif

View File

@@ -1,15 +1,18 @@
#pragma once
// IWYU pragma: private, include "nvim/os/os_defs.h"
#include <sys/param.h> // IWYU pragma: export
#include <sys/socket.h> // IWYU pragma: export
#include <unistd.h> // IWYU pragma: export
// IWYU pragma: begin_exports
#include <arpa/inet.h>
#include <netdb.h>
#include <netinet/in.h>
#include <pthread.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <unistd.h>
#if defined(HAVE_TERMIOS_H)
# include <termios.h> // IWYU pragma: export
# include <termios.h>
#endif
// POSIX.1-2008 says that NAME_MAX should be in here
#include <limits.h>
// IWYU pragma: end_exports
#define TEMP_DIR_NAMES { "$TMPDIR", "/tmp", ".", "~" }
#define TEMP_FILE_PATH_MAXLEN 256

View File

@@ -7,9 +7,9 @@
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "klib/kvec.h"
#include "nvim/api/private/defs.h"

View File

@@ -77,6 +77,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <time.h>
#include <uv.h>