aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordundargoc <gocdundar@gmail.com>2023-11-26 21:36:02 +0100
committerdundargoc <33953936+dundargoc@users.noreply.github.com>2023-11-27 15:50:45 +0100
commit40139738eb479d0913ec6ce751ca5adfa50ad8c3 (patch)
treee6b2928fad2afb74235316b31261e2c2d01dc047 /src
parent5b765fcab42308cd4d97a4c37da0c2b1cdb3514d (diff)
downloadrneovim-40139738eb479d0913ec6ce751ca5adfa50ad8c3.tar.gz
rneovim-40139738eb479d0913ec6ce751ca5adfa50ad8c3.tar.bz2
rneovim-40139738eb479d0913ec6ce751ca5adfa50ad8c3.zip
build: enable IWYU on mac
Diffstat (limited to 'src')
-rw-r--r--src/nvim/CMakeLists.txt1
-rw-r--r--src/nvim/base64.c2
-rw-r--r--src/nvim/buffer_defs.h2
-rw-r--r--src/nvim/cmdexpand.c1
-rw-r--r--src/nvim/edit.c1
-rw-r--r--src/nvim/eval.c1
-rw-r--r--src/nvim/eval/typval.c1
-rw-r--r--src/nvim/event/rstream.c2
-rw-r--r--src/nvim/ex_docmd.c1
-rw-r--r--src/nvim/fileio.c1
-rw-r--r--src/nvim/keycodes.c1
-rw-r--r--src/nvim/lua/stdlib.c2
-rw-r--r--src/nvim/main.c21
-rw-r--r--src/nvim/marktree.c1
-rw-r--r--src/nvim/mbyte.c1
-rw-r--r--src/nvim/memline.c1
-rw-r--r--src/nvim/message.c1
-rw-r--r--src/nvim/ops.c1
-rw-r--r--src/nvim/os/fileio.c4
-rw-r--r--src/nvim/os/fs.c2
-rw-r--r--src/nvim/os/process.c12
-rw-r--r--src/nvim/os/signal.c6
-rw-r--r--src/nvim/os/time.c2
-rw-r--r--src/nvim/os/unix_defs.h17
-rw-r--r--src/nvim/ui_compositor.c2
-rw-r--r--src/nvim/undo.c1
26 files changed, 58 insertions, 30 deletions
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
index 59af5e3818..3505f8be4f 100644
--- a/src/nvim/CMakeLists.txt
+++ b/src/nvim/CMakeLists.txt
@@ -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}")
diff --git a/src/nvim/base64.c b/src/nvim/base64.c
index 5bc0c34f06..295dedd8d3 100644
--- a/src/nvim/base64.c
+++ b/src/nvim/base64.c
@@ -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"
diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h
index 803d2aa0c6..0e7e5723cd 100644
--- a/src/nvim/buffer_defs.h
+++ b/src/nvim/buffer_defs.h
@@ -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.
diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c
index 7a6cc02cb8..58ec3d31bf 100644
--- a/src/nvim/cmdexpand.c
+++ b/src/nvim/cmdexpand.c
@@ -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"
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 7b21cc5bdb..23a246dcf5 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -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"
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 52ab610267..d48e126229 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -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"
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c
index e8ed6e5d32..936e043b6a 100644
--- a/src/nvim/eval/typval.c
+++ b/src/nvim/eval/typval.c
@@ -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"
diff --git a/src/nvim/event/rstream.c b/src/nvim/event/rstream.c
index 218293e44a..7745cd8fcc 100644
--- a/src/nvim/event/rstream.c
+++ b/src/nvim/event/rstream.c
@@ -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"
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 373dd8cd96..12aeb509fb 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -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"
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 6de6f01a52..dcc1b8eea5 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -11,6 +11,7 @@
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
+#include <sys/types.h>
#include <time.h>
#include <uv.h>
diff --git a/src/nvim/keycodes.c b/src/nvim/keycodes.c
index e2fb1fa3ee..aa61b40476 100644
--- a/src/nvim/keycodes.c
+++ b/src/nvim/keycodes.c
@@ -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"
diff --git a/src/nvim/lua/stdlib.c b/src/nvim/lua/stdlib.c
index c1e0af5aa1..a200b0a32f 100644
--- a/src/nvim/lua/stdlib.c
+++ b/src/nvim/lua/stdlib.c
@@ -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"
diff --git a/src/nvim/main.c b/src/nvim/main.c
index c5ab9f0cb2..68659d8a54 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -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 {
diff --git a/src/nvim/marktree.c b/src/nvim/marktree.c
index 6f6a91eae0..cffeb077f8 100644
--- a/src/nvim/marktree.c
+++ b/src/nvim/marktree.c
@@ -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"
diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c
index 1151e80e4c..a2c0e70d77 100644
--- a/src/nvim/mbyte.c
+++ b/src/nvim/mbyte.c
@@ -32,6 +32,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/types.h>
#include <wctype.h>
#include "auto/config.h"
diff --git a/src/nvim/memline.c b/src/nvim/memline.c
index ea7a61b8dd..f9169030a6 100644
--- a/src/nvim/memline.c
+++ b/src/nvim/memline.c
@@ -39,6 +39,7 @@
#include <stddef.h>
#include <stdio.h>
#include <string.h>
+#include <sys/types.h>
#include <time.h>
#include <uv.h>
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 032f079f46..641ceff2e8 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -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"
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index c6f7c74d6b..1144829a17 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -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"
diff --git a/src/nvim/os/fileio.c b/src/nvim/os/fileio.c
index b205481e98..55c12f2986 100644
--- a/src/nvim/os/fileio.c
+++ b/src/nvim/os/fileio.c
@@ -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
diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c
index b9448ddf4b..4721bc3f1c 100644
--- a/src/nvim/os/fs.c
+++ b/src/nvim/os/fs.c
@@ -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; \
diff --git a/src/nvim/os/process.c b/src/nvim/os/process.c
index 889d1f453f..7b47ba7020 100644
--- a/src/nvim/os/process.c
+++ b/src/nvim/os/process.c
@@ -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"
diff --git a/src/nvim/os/signal.c b/src/nvim/os/signal.c
index e73a579a27..3a861b87b4 100644
--- a/src/nvim/os/signal.c
+++ b/src/nvim/os/signal.c
@@ -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;
diff --git a/src/nvim/os/time.c b/src/nvim/os/time.c
index 8aa3170963..be95412c01 100644
--- a/src/nvim/os/time.c
+++ b/src/nvim/os/time.c
@@ -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
diff --git a/src/nvim/os/unix_defs.h b/src/nvim/os/unix_defs.h
index fe5dce5655..d2bec7b361 100644
--- a/src/nvim/os/unix_defs.h
+++ b/src/nvim/os/unix_defs.h
@@ -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
diff --git a/src/nvim/ui_compositor.c b/src/nvim/ui_compositor.c
index b1751f32fd..b243e1088b 100644
--- a/src/nvim/ui_compositor.c
+++ b/src/nvim/ui_compositor.c
@@ -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"
diff --git a/src/nvim/undo.c b/src/nvim/undo.c
index 15577931f3..288b23f56c 100644
--- a/src/nvim/undo.c
+++ b/src/nvim/undo.c
@@ -77,6 +77,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/types.h>
#include <time.h>
#include <uv.h>