diff --git a/autoload.cpp b/autoload.cpp index c883f8bf0..0028b1848 100644 --- a/autoload.cpp +++ b/autoload.cpp @@ -3,14 +3,21 @@ The classes responsible for autoloading functions and completions. */ -#include "config.h" +#include "config.h" // IWYU pragma: keep #include "autoload.h" #include "wutil.h" #include "common.h" -#include "signal.h" +#include "signal.h" // IWYU pragma: keep - needed for CHECK_BLOCK #include "env.h" #include "exec.h" #include +#include +#include +#include +#include +#include +#include +#include #include /* The time before we'll recheck an autoloaded file */ diff --git a/autoload.h b/autoload.h index b4338538d..610efed00 100644 --- a/autoload.h +++ b/autoload.h @@ -6,10 +6,10 @@ #ifndef FISH_AUTOLOAD_H #define FISH_AUTOLOAD_H -#include -#include +#include +#include +#include #include -#include #include "common.h" #include "lru.h" @@ -40,7 +40,6 @@ struct builtin_script_t const char *def; }; -struct builtin_script_t; class env_vars_snapshot_t; /** diff --git a/builtin.cpp b/builtin.cpp index 59778862b..e6b3c414c 100644 --- a/builtin.cpp +++ b/builtin.cpp @@ -17,27 +17,27 @@ */ -#include "config.h" +#include "config.h" // IWYU pragma: keep #include #include #include #include -#include #include -#include #include #include -#include #include #include #include -#include #include #include +#include +#include +#include +#include +#include -#include "fallback.h" -#include "util.h" +#include "fallback.h" // IWYU pragma: keep #include "wutil.h" #include "builtin.h" @@ -47,12 +47,8 @@ #include "parser.h" #include "reader.h" #include "env.h" -#include "common.h" #include "wgetopt.h" -#include "sanity.h" #include "tokenizer.h" -#include "wildcard.h" -#include "input_common.h" #include "input.h" #include "intern.h" #include "event.h" @@ -65,6 +61,7 @@ #include "path.h" #include "history.h" #include "parse_tree.h" +#include "parse_constants.h" #include "wcstringutil.h" /** diff --git a/builtin.h b/builtin.h index 3472995cf..ca0f4f300 100644 --- a/builtin.h +++ b/builtin.h @@ -5,12 +5,13 @@ #ifndef FISH_BUILTIN_H #define FISH_BUILTIN_H -#include +#include // for size_t +#include // for vector -#include "util.h" #include "io.h" #include "common.h" +class completion_t; class parser_t; enum diff --git a/builtin_test.cpp b/builtin_test.cpp index 233696284..84d5fa9c2 100644 --- a/builtin_test.cpp +++ b/builtin_test.cpp @@ -10,6 +10,8 @@ Implemented from scratch (yes, really) by way of IEEE 1003.1 as reference. #include "builtin.h" #include "wutil.h" #include "proc.h" +#include +#include #include #include diff --git a/color.cpp b/color.cpp index 5b19b900d..d076ea17f 100644 --- a/color.cpp +++ b/color.cpp @@ -2,7 +2,12 @@ */ #include "color.h" -#include "fallback.h" +#include "fallback.h" // IWYU pragma: keep +#include +#include +#include +#include +#include bool rgb_color_t::try_parse_special(const wcstring &special) { diff --git a/color.h b/color.h index b3da47d02..988bfdb8a 100644 --- a/color.h +++ b/color.h @@ -3,9 +3,8 @@ #ifndef FISH_COLOR_H #define FISH_COLOR_H -#include -#include -#include "config.h" +#include +#include #include "common.h" /* 24 bit color */ diff --git a/common.cpp b/common.cpp index 473f3502d..ea1cc4e33 100644 --- a/common.cpp +++ b/common.cpp @@ -9,10 +9,6 @@ parts of fish. #include -#ifdef HAVE_STROPTS_H -#include -#endif - #ifdef HAVE_SIGINFO_H #include #endif @@ -22,53 +18,35 @@ parts of fish. #include #include #include -#include #include +#include +#include +#include + #ifdef HAVE_SYS_IOCTL_H #include #endif #include -#include #include #include #include #include #include -#include #include -#include #include #ifdef HAVE_EXECINFO_H #include #endif -#if HAVE_NCURSES_H -#include -#elif HAVE_NCURSES_CURSES_H -#include -#else -#include -#endif - -#if HAVE_TERM_H -#include -#elif HAVE_NCURSES_TERM_H -#include -#endif - #include "fallback.h" -#include "util.h" #include "wutil.h" #include "common.h" #include "expand.h" -#include "proc.h" #include "wildcard.h" -#include "parser.h" -#include "complete.h" #include "util.cpp" #include "fallback.cpp" diff --git a/common.h b/common.h index f0d558940..e27968fd5 100644 --- a/common.h +++ b/common.h @@ -17,10 +17,13 @@ #include #include #include +#include +#include +#include #include -#include -#include "util.h" +#include "config.h" +#include "fallback.h" /** Avoid writing the type name twice in a common "static_cast-initialization". @@ -28,8 +31,6 @@ */ #define CAST_INIT(type, dst, src) type dst = static_cast(src) -class completion_t; - /* Common string type */ typedef std::wstring wcstring; typedef std::vector wcstring_list_t; diff --git a/complete.cpp b/complete.cpp index 1f3cc6564..877ac9847 100644 --- a/complete.cpp +++ b/complete.cpp @@ -4,29 +4,23 @@ */ #include "config.h" +#include #include -#include -#include -#include +#include #include #include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include #include #include +#include +#include +#include +#include +#include -#include "fallback.h" +#include "fallback.h" // IWYU pragma: keep #include "util.h" -#include "tokenizer.h" #include "wildcard.h" #include "proc.h" #include "parser.h" @@ -37,15 +31,13 @@ #include "exec.h" #include "expand.h" #include "common.h" -#include "reader.h" -#include "history.h" -#include "intern.h" #include "parse_util.h" -#include "parser_keywords.h" #include "wutil.h" #include "path.h" #include "parse_tree.h" #include "iothread.h" +#include "autoload.h" +#include "parse_constants.h" /* Completion description strings, mostly for different types of files, such as sockets, block devices, etc. diff --git a/complete.h b/complete.h index 99dcbf6a0..c1e156e1a 100644 --- a/complete.h +++ b/complete.h @@ -12,11 +12,9 @@ */ #define FISH_COMPLETE_H - -#include +#include #include -#include "util.h" #include "common.h" /** * Use all completions diff --git a/env.cpp b/env.cpp index 6b09c07f8..649e0f2a3 100644 --- a/env.cpp +++ b/env.cpp @@ -1,46 +1,26 @@ /** \file env.c Functions for setting and getting environment variables. */ -#include "config.h" +#include "config.h" // IWYU pragma: keep #include #include -#include -#include #include #include -#include #include -#include #include #include #include #include #include #include - -#if HAVE_NCURSES_H -#include -#elif HAVE_NCURSES_CURSES_H -#include -#else -#include -#endif - -#if HAVE_TERM_H -#include -#elif HAVE_NCURSES_TERM_H -#include -#endif - -#if HAVE_LIBINTL_H -#include -#endif - #include +#include +#include +#include +#include #include "fallback.h" -#include "util.h" #include "wutil.h" #include "proc.h" @@ -50,13 +30,11 @@ #include "expand.h" #include "history.h" #include "reader.h" -#include "parser.h" #include "env_universal_common.h" #include "input.h" #include "event.h" #include "path.h" -#include "complete.h" #include "fish_version.h" /** Value denoting a null string */ diff --git a/env.h b/env.h index e69b7fc94..411b51ecd 100644 --- a/env.h +++ b/env.h @@ -6,9 +6,10 @@ #define FISH_ENV_H #include +#include +#include #include -#include "util.h" #include "common.h" /* Flags that may be passed as the 'mode' in env_set / env_get_string */ diff --git a/env_universal_common.cpp b/env_universal_common.cpp index b493de210..d29381f50 100644 --- a/env_universal_common.cpp +++ b/env_universal_common.cpp @@ -10,26 +10,39 @@ #include "env_universal_common.h" #include -#include #include #include #include #include -#include +#include // IWYU pragma: keep - needed for htonl #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #ifdef HAVE_SYS_SELECT_H #include #endif -#include "fallback.h" +#include "fallback.h" // IWYU pragma: keep #include "util.h" #include "common.h" #include "wutil.h" #include "utf8.h" -#include "path.h" -#include "iothread.h" #if __APPLE__ #define FISH_NOTIFYD_AVAILABLE 1 diff --git a/env_universal_common.h b/env_universal_common.h index fcf5b6312..7aca60df1 100644 --- a/env_universal_common.h +++ b/env_universal_common.h @@ -1,12 +1,13 @@ #ifndef FISH_ENV_UNIVERSAL_COMMON_H #define FISH_ENV_UNIVERSAL_COMMON_H -#include -#include #include #include +#include +#include +#include +#include "common.h" #include "wutil.h" -#include "util.h" #include "env.h" /** @@ -24,8 +25,6 @@ typedef enum */ #define ENV_UNIVERSAL_BUFFER_SIZE 1024 -typedef std::vector callback_data_list_t; - /** Callback data, reflecting a change in universal variables */ @@ -40,6 +39,8 @@ struct callback_data_t } }; +typedef std::vector callback_data_list_t; + /** Class representing universal variables */ class env_universal_t { diff --git a/event.cpp b/event.cpp index 14def5f41..eeff3eb5d 100644 --- a/event.cpp +++ b/event.cpp @@ -3,28 +3,23 @@ Functions for handling event triggers */ -#include "config.h" +#include "config.h" // IWYU pragma: keep -#include -#include -#include -#include -#include #include -#include #include +#include +#include +#include -#include "fallback.h" -#include "util.h" - -#include "wutil.h" -#include "function.h" +#include "fallback.h" // IWYU pragma: keep +#include "wutil.h" // IWYU pragma: keep - needed for gettext #include "input_common.h" #include "proc.h" #include "parser.h" #include "common.h" #include "event.h" #include "signal.h" +#include "io.h" /** diff --git a/event.h b/event.h index 645eeda46..80737596d 100644 --- a/event.h +++ b/event.h @@ -12,7 +12,8 @@ #ifndef FISH_EVENT_H #define FISH_EVENT_H -#include +#include +#include #include "common.h" diff --git a/exec.cpp b/exec.cpp index 972291804..d6df94e69 100644 --- a/exec.cpp +++ b/exec.cpp @@ -5,37 +5,32 @@ manual, though the changes performed have been massive. */ -#include "config.h" +#include "config.h" // IWYU pragma: keep #include #include -#include -#include -#include #include #include #include #include #include -#include #include -#include #include -#include -#include #include #include -#include +#include +#include +#include +#include +#include // IWYU pragma: keep - suggests instead +#include #ifdef HAVE_SIGINFO_H #include #endif -#include "fallback.h" -#include "util.h" -#include "iothread.h" +#include "fallback.h" // IWYU pragma: keep #include "postfork.h" - #include "common.h" #include "wutil.h" #include "proc.h" @@ -44,12 +39,10 @@ #include "builtin.h" #include "function.h" #include "env.h" -#include "wildcard.h" -#include "sanity.h" -#include "expand.h" #include "signal.h" - #include "parse_util.h" +#include "io.h" +#include "parse_tree.h" /** file descriptor redirection error message diff --git a/exec.h b/exec.h index f0a0e148f..41dc31937 100644 --- a/exec.h +++ b/exec.h @@ -8,11 +8,9 @@ */ #define FISH_EXEC_H -#include +#include #include -#include "proc.h" -#include "util.h" #include "common.h" /** @@ -41,6 +39,7 @@ */ +class job_t; class parser_t; void exec_job(parser_t &parser, job_t *j); diff --git a/expand.cpp b/expand.cpp index 1d541a246..6d9785824 100644 --- a/expand.cpp +++ b/expand.cpp @@ -5,27 +5,20 @@ parameter expansion. */ -#include "config.h" +#include "config.h" // IWYU pragma: keep #include #include +#include +#include #include #include #include #include #include -#include -#include -#include -#include -#ifdef HAVE_SYS_SYSCTL_H -#include -#endif -#include #include #include #include -#include #include #include @@ -35,7 +28,7 @@ parameter expansion. #include #endif -#include "fallback.h" +#include "fallback.h" // IWYU pragma: keep #include "util.h" #include "common.h" @@ -46,7 +39,6 @@ parameter expansion. #include "expand.h" #include "wildcard.h" #include "exec.h" -#include "signal.h" #include "tokenizer.h" #include "complete.h" #include "iothread.h" diff --git a/expand.h b/expand.h index 1f42982b2..8fe80b3b8 100644 --- a/expand.h +++ b/expand.h @@ -15,12 +15,14 @@ */ #define FISH_EXPAND_H -#include +#include "config.h" // for __warn_unused + +#include +#include // for string +#include // for vector -#include "util.h" #include "common.h" #include "parse_constants.h" -#include enum { @@ -134,8 +136,6 @@ enum */ #define ARRAY_BOUNDS_ERR _(L"Array index out of bounds") -class parser_t; - /** Perform various forms of expansion on in, such as tilde expansion (\~USER becomes the users home directory), variable expansion diff --git a/fish.cpp b/fish.cpp index 2a757ba62..a50e08869 100644 --- a/fish.cpp +++ b/fish.cpp @@ -22,20 +22,21 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA #include "config.h" - +#include +#include +#include +#include +#include +#include #include #include #include #include #include #include -#include -#include #include -#include -#include +#include // IWYU pragma: keep - suggests internal header #include -#include #include #ifdef HAVE_GETOPT_H @@ -43,29 +44,24 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA #endif #include -#include -#include "fallback.h" -#include "util.h" +#include "fallback.h" // IWYU pragma: keep #include "common.h" #include "reader.h" #include "builtin.h" #include "function.h" -#include "complete.h" #include "wutil.h" #include "env.h" -#include "sanity.h" #include "proc.h" #include "parser.h" #include "expand.h" #include "intern.h" -#include "exec.h" #include "event.h" -#include "output.h" #include "history.h" #include "path.h" #include "input.h" +#include "io.h" #include "fish_version.h" /* PATH_MAX may not exist */ diff --git a/fish_indent.cpp b/fish_indent.cpp index 22934e9e0..59efbd1ed 100644 --- a/fish_indent.cpp +++ b/fish_indent.cpp @@ -25,15 +25,20 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA #include #include #include -#include #ifdef HAVE_GETOPT_H #include #endif +#include +#include +#include +#include +#include "color.h" +#include "highlight.h" +#include "parse_constants.h" #include "wutil.h" #include "common.h" #include "output.h" -#include "screen.h" #include "env.h" #include "input.h" #include "parse_tree.h" diff --git a/function.cpp b/function.cpp index fb8dbf6ac..2a8c20be8 100644 --- a/function.cpp +++ b/function.cpp @@ -7,35 +7,28 @@ handling library. */ -#include "config.h" +#include "config.h" // IWYU pragma: keep -#include -#include -#include #include -#include -#include -#include #include -#include #include #include +#include +#include +#include +#include #include "wutil.h" -#include "fallback.h" -#include "util.h" +#include "fallback.h" // IWYU pragma: keep +#include "autoload.h" #include "function.h" -#include "proc.h" -#include "parser.h" #include "common.h" #include "intern.h" #include "event.h" #include "reader.h" -#include "parse_util.h" #include "parser_keywords.h" #include "env.h" -#include "expand.h" /** Table containing all functions diff --git a/function.h b/function.h index ac56bd46c..cd3f6f5a4 100644 --- a/function.h +++ b/function.h @@ -10,16 +10,14 @@ #ifndef FISH_FUNCTION_H #define FISH_FUNCTION_H -#include +#include #include -#include "util.h" #include "common.h" #include "event.h" #include "env.h" class parser_t; -class env_vars_snapshot_t; /** Structure describing a function. This is used by the parser to diff --git a/highlight.cpp b/highlight.cpp index ef57519e4..e07c7040e 100644 --- a/highlight.cpp +++ b/highlight.cpp @@ -1,36 +1,31 @@ /** \file highlight.c Functions for syntax highlighting */ -#include "config.h" -#include -#include +#include "config.h" // IWYU pragma: keep + #include #include #include #include -#include -#include -#include #include +#include +#include +#include +#include #include "fallback.h" -#include "util.h" #include "wutil.h" #include "highlight.h" #include "tokenizer.h" -#include "proc.h" -#include "parser.h" #include "parse_util.h" -#include "parser_keywords.h" +#include "parse_constants.h" #include "builtin.h" #include "function.h" #include "env.h" #include "expand.h" -#include "sanity.h" #include "common.h" -#include "complete.h" #include "output.h" #include "wildcard.h" #include "path.h" diff --git a/highlight.h b/highlight.h index d4f61e959..9b89c0f21 100644 --- a/highlight.h +++ b/highlight.h @@ -5,10 +5,13 @@ #ifndef FISH_HIGHLIGHT_H #define FISH_HIGHLIGHT_H -#include +#include // for assert +#include // for size_t +#include // for uint32_t +#include // for vector +#include "common.h" // for wcstring, wcstring_list_t #include "env.h" -#include "util.h" #include "color.h" /* Internally, we specify highlight colors using a set of bits. Each highlight_spec is a 32 bit uint. We divide this into low 16 (foreground) and high 16 (background). Each half we further subdivide into low 8 (primary) and high 8 (modifiers). The primary is not a bitmask; specify exactly one. The modifiers are a bitmask; specify any number */ diff --git a/history.cpp b/history.cpp index 9bed7b05e..c526eb392 100644 --- a/history.cpp +++ b/history.cpp @@ -7,8 +7,6 @@ #include #include #include -#include -#include #include #include #include @@ -16,22 +14,23 @@ #include #include #include +#include +#include +#include -#include "fallback.h" -#include "util.h" +#include "fallback.h" // IWYU pragma: keep #include "sanity.h" -#include "tokenizer.h" #include "reader.h" #include "parse_tree.h" - #include "wutil.h" #include "history.h" #include "common.h" -#include "intern.h" #include "path.h" #include "signal.h" -#include "autoload.h" #include "iothread.h" +#include "env.h" +#include "lru.h" +#include "parse_constants.h" #include #include diff --git a/history.h b/history.h index 4bbdf7883..7f04890ed 100644 --- a/history.h +++ b/history.h @@ -5,15 +5,18 @@ #ifndef FISH_HISTORY_H #define FISH_HISTORY_H -#include #include "common.h" -#include "pthread.h" #include "wutil.h" #include #include #include -#include #include +#include +#include +#include +#include +#include +#include /* fish supports multiple shells writing to history at once. Here is its strategy: diff --git a/input.cpp b/input.cpp index 4dfe80cd6..2629506fe 100644 --- a/input.cpp +++ b/input.cpp @@ -6,19 +6,8 @@ #include "config.h" -#include -#include #include -#include #include -#include -#include -#include - -#ifdef HAVE_SYS_IOCTL_H -#include -#endif - #include #include @@ -36,30 +25,21 @@ #include #endif -#include -#include #include - - -#include "fallback.h" -#include "util.h" - -#include "wutil.h" +#include "fallback.h" // IWYU pragma: keep +#include "wutil.h" // IWYU pragma: keep - needed for wgettext #include "reader.h" #include "proc.h" #include "common.h" -#include "sanity.h" #include "input_common.h" #include "input.h" #include "parser.h" #include "env.h" -#include "expand.h" #include "event.h" -#include "signal.h" - +#include "signal.h" // IWYU pragma: keep - needed for CHECK_BLOCK +#include "io.h" #include "output.h" -#include "intern.h" #include #include diff --git a/input.h b/input.h index 323eb26d4..38facddb1 100644 --- a/input.h +++ b/input.h @@ -8,8 +8,12 @@ inputrc information for key bindings. #ifndef FISH_INPUT_H #define FISH_INPUT_H -#include -#include +#include +#include +#include + +#include "common.h" +#include "env.h" #include "input_common.h" diff --git a/input_common.cpp b/input_common.cpp index b748ca22f..24fde6e2d 100644 --- a/input_common.cpp +++ b/input_common.cpp @@ -6,28 +6,26 @@ Implementation file for the low level input library #include "config.h" -#include -#include #include #include #include -#include #include -#include -#include #include #include +#include // for wint_t +#include // for deque +#include // for swap, pair #ifdef HAVE_SYS_SELECT_H #include #endif -#include "fallback.h" +#include "fallback.h" // IWYU pragma: keep #include "util.h" #include "common.h" -#include "wutil.h" #include "input_common.h" #include "env_universal_common.h" +#include "env.h" #include "iothread.h" /** diff --git a/input_common.h b/input_common.h index 46430af40..5ec34b398 100644 --- a/input_common.h +++ b/input_common.h @@ -6,7 +6,7 @@ Header file for the low level input library #ifndef INPUT_COMMON_H #define INPUT_COMMON_H -#include +#include /** Use unencoded private-use keycodes for internal characters diff --git a/intern.cpp b/intern.cpp index 56dec21a8..2ec0af8a6 100644 --- a/intern.cpp +++ b/intern.cpp @@ -3,20 +3,14 @@ Library for pooling common strings */ -#include "config.h" +#include "config.h" // IWYU pragma: keep - -#include -#include #include -#include -#include +#include +#include #include -#include "fallback.h" -#include "util.h" - -#include "wutil.h" +#include "fallback.h" // IWYU pragma: keep #include "common.h" #include "intern.h" diff --git a/intern.h b/intern.h index 1403e66c6..b9d07526f 100644 --- a/intern.h +++ b/intern.h @@ -7,8 +7,6 @@ #ifndef FISH_INTERN_H #define FISH_INTERN_H -#include - /** Return an identical copy of the specified string from a pool of unique strings. If the string was not in the pool, add a copy. diff --git a/io.cpp b/io.cpp index 264f0b9ff..a013b9ef9 100644 --- a/io.cpp +++ b/io.cpp @@ -3,42 +3,15 @@ Utilities for io redirection. */ -#include "config.h" +#include "config.h" // IWYU pragma: keep -#include #include -#include -#include #include -#include -#include -#include - -#ifdef HAVE_SYS_IOCTL_H -#include -#endif - +#include #include -#include - -#if HAVE_NCURSES_H -#include -#elif HAVE_NCURSES_CURSES_H -#include -#else -#include -#endif - -#if HAVE_TERM_H -#include -#elif HAVE_NCURSES_TERM_H -#include -#endif - -#include "fallback.h" -#include "util.h" +#include "fallback.h" // IWYU pragma: keep #include "wutil.h" #include "exec.h" #include "common.h" diff --git a/io.h b/io.h index 4ca5f9421..86fc79620 100644 --- a/io.h +++ b/io.h @@ -2,6 +2,8 @@ #define FISH_IO_H #include +#include +#include // Note that we have to include something to get any _LIBCPP_VERSION defined so we can detect libc++ // So it's key that vector go above. If we didn't need vector for other reasons, we might include ciso646, which does nothing @@ -16,6 +18,8 @@ using std::shared_ptr; using std::tr1::shared_ptr; #endif +#include "common.h" + /** Describes what type of IO operation an io_data_t represents */ diff --git a/iothread.cpp b/iothread.cpp index 920d2aae1..7a37b63bc 100644 --- a/iothread.cpp +++ b/iothread.cpp @@ -1,16 +1,17 @@ -#include "config.h" +#include "config.h" // IWYU pragma: keep #include "iothread.h" #include "common.h" #include #include -#include #include -#include -#include +#include // IWYU pragma: keep - for _POSIX_THREADS_MAX, suggests internal header +#include +#include #include #include #include #include +#include #ifdef _POSIX_THREAD_THREADS_MAX #if _POSIX_THREAD_THREADS_MAX < 64 diff --git a/kill.cpp b/kill.cpp index 0033ca2fc..22f214757 100644 --- a/kill.cpp +++ b/kill.cpp @@ -6,26 +6,15 @@ with the X clipboard. */ -#include "config.h" +#include "config.h" // IWYU pragma: keep -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include +#include +#include -#include "fallback.h" -#include "util.h" - -#include "wutil.h" +#include "fallback.h" // IWYU pragma: keep #include "kill.h" -#include "proc.h" -#include "sanity.h" #include "common.h" #include "env.h" #include "exec.h" diff --git a/kill.h b/kill.h index 35df3dbd6..686122a29 100644 --- a/kill.h +++ b/kill.h @@ -7,7 +7,7 @@ #ifndef FISH_KILL_H #define FISH_KILL_H -#include +#include "common.h" /** Replace the specified string in the killring diff --git a/lru.h b/lru.h index 5899087c6..779c2edcf 100644 --- a/lru.h +++ b/lru.h @@ -6,6 +6,7 @@ #ifndef FISH_LRU_H #define FISH_LRU_H +#include #include #include #include diff --git a/output.cpp b/output.cpp index 5a0d221b3..8f97ce61a 100644 --- a/output.cpp +++ b/output.cpp @@ -7,18 +7,6 @@ #include #include #include -#include -#include -#include -#include - -#ifdef HAVE_SYS_IOCTL_H -#include -#endif - -#include -#include -#include #if HAVE_NCURSES_H #include @@ -34,22 +22,14 @@ #include #endif -#include -#include -#include -#include #include - +#include +#include #include "fallback.h" -#include "util.h" - -#include "wutil.h" -#include "expand.h" +#include "wutil.h" // IWYU pragma: keep - needed for wgettext #include "common.h" #include "output.h" -#include "highlight.h" -#include "env.h" /** Number of color names in the col array diff --git a/output.h b/output.h index 6c7e4f32c..a952d8a44 100644 --- a/output.h +++ b/output.h @@ -8,9 +8,10 @@ #ifndef FISH_OUTPUT_H #define FISH_OUTPUT_H -#include +#include +#include +#include "common.h" #include "fallback.h" -#include "screen.h" #include "color.h" /** diff --git a/pager.cpp b/pager.cpp index b2a4e4da4..a5cf0eccd 100644 --- a/pager.cpp +++ b/pager.cpp @@ -1,11 +1,14 @@ -#include "config.h" +#include "config.h" // IWYU pragma: keep -#include "pager.h" -#include "highlight.h" -#include "input_common.h" -#include "wutil.h" +#include +#include +#include #include #include +#include "util.h" +#include "wutil.h" // IWYU pragma: keep - needed for wgettext +#include "pager.h" +#include "highlight.h" typedef pager_t::comp_t comp_t; typedef std::vector completion_list_t; diff --git a/pager.h b/pager.h index c3e47df75..61c37ce67 100644 --- a/pager.h +++ b/pager.h @@ -2,6 +2,10 @@ Pager support */ +#include +#include +#include +#include "common.h" #include "complete.h" #include "screen.h" #include "reader.h" diff --git a/parse_execution.cpp b/parse_execution.cpp index e190ed8a5..8381958fc 100644 --- a/parse_execution.cpp +++ b/parse_execution.cpp @@ -8,17 +8,33 @@ */ #include "parse_execution.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // IWYU pragma: keep - suggests instead +#include +#include "env.h" +#include "event.h" +#include "tokenizer.h" +#include "util.h" #include "parse_util.h" #include "complete.h" #include "wildcard.h" -#include "builtin.h" #include "parser.h" #include "expand.h" #include "reader.h" #include "wutil.h" -#include "exec.h" #include "path.h" -#include +#include "function.h" +#include "builtin.h" +#include "exec.h" /* These are the specific statement types that support redirections */ static bool specific_statement_type_is_redirectable_block(const parse_node_t &node) diff --git a/parse_execution.h b/parse_execution.h index 6a3d6db73..7e1c1f467 100644 --- a/parse_execution.h +++ b/parse_execution.h @@ -6,12 +6,14 @@ #ifndef FISH_PARSE_EXECUTION_H #define FISH_PARSE_EXECUTION_H -#include "config.h" -#include "util.h" +#include +#include "common.h" +#include "io.h" +#include "parse_constants.h" #include "parse_tree.h" #include "proc.h" -class job_t; +class parser_t; struct block_t; enum parse_execution_result_t diff --git a/parse_productions.cpp b/parse_productions.cpp index c1b378ecc..0d28c6a13 100644 --- a/parse_productions.cpp +++ b/parse_productions.cpp @@ -1,4 +1,7 @@ #include "parse_productions.h" +#include +#include +#include "parse_tree.h" using namespace parse_productions; #define NO_PRODUCTION ((production_option_idx_t)(-1)) diff --git a/parse_productions.h b/parse_productions.h index df3ae9c96..1d64ccfca 100644 --- a/parse_productions.h +++ b/parse_productions.h @@ -6,8 +6,11 @@ #ifndef FISH_PARSE_TREE_CONSTRUCTION_H #define FISH_PARSE_TREE_CONSTRUCTION_H -#include "parse_tree.h" -#include +#include // for uint8_t, uint32_t +#include "common.h" // for wcstring +#include "parse_constants.h" // for parse_token_type_t, etc + +struct parse_token_t; namespace parse_productions { diff --git a/parse_tree.cpp b/parse_tree.cpp index ed3025ed2..f357d5ff3 100644 --- a/parse_tree.cpp +++ b/parse_tree.cpp @@ -1,9 +1,18 @@ +#include +#include +#include +#include +#include +#include +#include +#include "common.h" +#include "parse_constants.h" #include "parse_productions.h" +#include "parse_tree.h" #include "tokenizer.h" #include "fallback.h" -#include "wutil.h" +#include "wutil.h" // IWYU pragma: keep - needed for wgettext #include "proc.h" -#include "expand.h" #include #include diff --git a/parse_tree.h b/parse_tree.h index 84114c5f4..e4d4eb366 100644 --- a/parse_tree.h +++ b/parse_tree.h @@ -6,17 +6,15 @@ #ifndef FISH_PARSE_PRODUCTIONS_H #define FISH_PARSE_PRODUCTIONS_H -#include +#include +#include +#include -#include "config.h" -#include "util.h" #include "common.h" #include "tokenizer.h" #include "parse_constants.h" #include -#include -class parse_node_t; class parse_node_tree_t; typedef uint32_t node_offset_t; diff --git a/parse_util.cpp b/parse_util.cpp index 9aac4a6a7..10388cb72 100644 --- a/parse_util.cpp +++ b/parse_util.cpp @@ -8,38 +8,24 @@ parsing the code. */ -#include "config.h" - +#include "config.h" // IWYU pragma: keep #include -#include -#include -#include -#include - +#include #include -#include -#include -#include - -#include +#include #include #include "fallback.h" #include "util.h" - -#include "wutil.h" +#include "wutil.h" // IWYU pragma: keep #include "common.h" #include "tokenizer.h" #include "parse_util.h" #include "expand.h" -#include "intern.h" -#include "exec.h" #include "env.h" -#include "signal.h" #include "wildcard.h" #include "parse_tree.h" -#include "parser.h" #include "builtin.h" /** Error message for improper use of the exec builtin */ diff --git a/parse_util.h b/parse_util.h index 28286ed89..760d4477e 100644 --- a/parse_util.h +++ b/parse_util.h @@ -7,11 +7,10 @@ #ifndef FISH_PARSE_UTIL_H #define FISH_PARSE_UTIL_H -#include "autoload.h" -#include "parse_tree.h" -#include -#include -#include +#include +#include +#include "common.h" +#include "parse_constants.h" /** Find the beginning and end of the first subshell in the specified string. @@ -186,6 +185,7 @@ parser_test_error_bits_t parse_util_detect_errors(const wcstring &buff_src, pars This does NOT currently detect unterminated quotes. */ +class parse_node_t; parser_test_error_bits_t parse_util_detect_errors_in_argument(const parse_node_t &node, const wcstring &arg_src, parse_error_list_t *out_errors = NULL); /* Given a string containing a variable expansion error, append an appropriate error to the errors list. The global_token_pos is the offset of the token in the larger source, and the dollar_pos is the offset of the offending dollar sign within the token. */ diff --git a/parser.cpp b/parser.cpp index ec8f22534..2e5ebe754 100644 --- a/parser.cpp +++ b/parser.cpp @@ -4,44 +4,28 @@ The fish parser. Contains functions for parsing and evaluating code. */ -#include "config.h" +#include "config.h" // IWYU pragma: keep -#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include #include #include "fallback.h" -#include "util.h" - #include "common.h" #include "wutil.h" #include "proc.h" #include "parser.h" -#include "parser_keywords.h" -#include "tokenizer.h" -#include "exec.h" -#include "wildcard.h" #include "function.h" -#include "builtin.h" #include "env.h" #include "expand.h" #include "reader.h" #include "sanity.h" #include "event.h" #include "intern.h" +#include "signal.h" // IWYU pragma: keep - needed for CHECK_BLOCK #include "parse_util.h" -#include "path.h" -#include "signal.h" -#include "complete.h" #include "parse_tree.h" #include "parse_execution.h" diff --git a/parser.h b/parser.h index 4c03bd960..ba0edd6a0 100644 --- a/parser.h +++ b/parser.h @@ -5,13 +5,16 @@ #ifndef FISH_PARSER_H #define FISH_PARSER_H -#include +#include // for size_t +#include // for _List_const_iterator, list, etc +#include "common.h" #include "proc.h" -#include "util.h" #include "event.h" -#include "function.h" #include "parse_tree.h" +#include "io.h" +#include "parse_constants.h" + #include /** @@ -226,8 +229,8 @@ struct profile_item_t wcstring cmd; }; -struct tokenizer_t; class parse_execution_context_t; +class completion_t; class parser_t { diff --git a/parser_keywords.cpp b/parser_keywords.cpp index eb47f87f4..adf9c40cf 100644 --- a/parser_keywords.cpp +++ b/parser_keywords.cpp @@ -3,13 +3,9 @@ Functions having to do with parser keywords, like testing if a function is a block command. */ -#include "config.h" +#include "config.h" // IWYU pragma: keep - -#include -#include - -#include "fallback.h" +#include "fallback.h" // IWYU pragma: keep #include "common.h" #include "parser_keywords.h" diff --git a/parser_keywords.h b/parser_keywords.h index 6794b294e..94cd0eb75 100644 --- a/parser_keywords.h +++ b/parser_keywords.h @@ -6,6 +6,8 @@ Functions having to do with parser keywords, like testing if a function is a blo #ifndef FISH_PARSER_KEYWORD_H #define FISH_PARSER_KEYWORD_H +#include "common.h" + /** Tests if the specified commands parameters should be interpreted as another command, which will be true if the command is either 'command', 'exec', 'if', 'while', or 'builtin'. This does not handle "else if" which is more complicated. diff --git a/path.cpp b/path.cpp index e61ae6516..62a31a635 100644 --- a/path.cpp +++ b/path.cpp @@ -1,17 +1,14 @@ -#include "config.h" +#include "config.h" // IWYU pragma: keep -#include -#include #include -#include #include #include #include -#include - -#include "fallback.h" -#include "util.h" +#include +#include +#include +#include "fallback.h" // IWYU pragma: keep #include "common.h" #include "env.h" #include "wutil.h" diff --git a/path.h b/path.h index b822f6e9c..eb79ee8a1 100644 --- a/path.h +++ b/path.h @@ -9,6 +9,8 @@ #ifndef FISH_PATH_H #define FISH_PATH_H +#include +#include "common.h" #include "env.h" /** diff --git a/postfork.cpp b/postfork.cpp index f47c2e1e2..9416b35db 100644 --- a/postfork.cpp +++ b/postfork.cpp @@ -4,6 +4,15 @@ */ #include +#include +#include +#include +#include +#include +#include // IWYU pragma: keep - suggests instead +#include "common.h" +#include "proc.h" +#include "wutil.h" #include "signal.h" #include "postfork.h" #include "iothread.h" diff --git a/postfork.h b/postfork.h index 439cedff6..c277da529 100644 --- a/postfork.h +++ b/postfork.h @@ -6,17 +6,10 @@ #ifndef FISH_POSTFORK_H #define FISH_POSTFORK_H -#include -#include +#include #include -#include -#include #include "config.h" -#include "common.h" -#include "util.h" -#include "proc.h" -#include "wutil.h" #include "io.h" #if HAVE_SPAWN_H @@ -40,6 +33,8 @@ Returns 0 on sucess, -1 on failiure. */ +class job_t; +class process_t; int set_child_group(job_t *j, process_t *p, int print_errors); /** diff --git a/print_help.cpp b/print_help.cpp index 06bed30c2..da401134e 100644 --- a/print_help.cpp +++ b/print_help.cpp @@ -6,6 +6,8 @@ #include #include #include +#include +#include #include "print_help.h" diff --git a/proc.cpp b/proc.cpp index 7caf2d6cf..0a0da0a8b 100644 --- a/proc.cpp +++ b/proc.cpp @@ -18,27 +18,16 @@ Some of the code in this file is based on code from the Glibc manual. #include #include #include -#include -#include +#include +#include #include - -#ifdef HAVE_SYS_IOCTL_H -#include -#endif +#include // IWYU pragma: keep - suggests instead +#include #include #include -#include #include -#if HAVE_NCURSES_H -#include -#elif HAVE_NCURSES_CURSES_H -#include -#else -#include -#endif - #if HAVE_TERM_H #include #elif HAVE_NCURSES_TERM_H @@ -53,7 +42,7 @@ Some of the code in this file is based on code from the Glibc manual. #include #endif -#include "fallback.h" +#include "fallback.h" // IWYU pragma: keep #include "util.h" #include "wutil.h" @@ -61,7 +50,6 @@ Some of the code in this file is based on code from the Glibc manual. #include "common.h" #include "reader.h" #include "sanity.h" -#include "env.h" #include "parser.h" #include "signal.h" #include "event.h" diff --git a/proc.h b/proc.h index 4bb6b3956..8dd66c7ce 100644 --- a/proc.h +++ b/proc.h @@ -11,13 +11,14 @@ #ifndef FISH_PROC_H #define FISH_PROC_H -#include #include -#include #include #include +#include // for assert +#include // for size_t +#include // for pid_t, termios -#include "util.h" +#include "config.h" // for HAVE__PROC_SELF_STAT #include "io.h" #include "common.h" #include "parse_tree.h" @@ -268,7 +269,6 @@ void release_job_id(job_id_t jobid); A struct represeting a job. A job is basically a pipeline of one or more processes and a couple of flags. */ -class parser_t; class job_t { /** diff --git a/reader.cpp b/reader.cpp index 5e386dc7f..eaf5829fb 100644 --- a/reader.cpp +++ b/reader.cpp @@ -24,39 +24,17 @@ commence. #include #include +#include #include #include #include -#include -#include - -#ifdef HAVE_SYS_IOCTL_H -#include -#endif - #include #include -#include -#include #include #include #include #include -#if HAVE_NCURSES_H -#include -#elif HAVE_NCURSES_CURSES_H -#include -#else -#include -#endif - -#if HAVE_TERM_H -#include -#elif HAVE_NCURSES_TERM_H -#include -#endif - #ifdef HAVE_SIGINFO_H #include #endif @@ -67,9 +45,7 @@ commence. #include #include -#include #include - #include @@ -98,11 +74,11 @@ commence. #include "screen.h" #include "iothread.h" #include "intern.h" -#include "path.h" #include "parse_util.h" -#include "parser_keywords.h" #include "parse_tree.h" #include "pager.h" +#include "color.h" +#include "event.h" /** Maximum length of prefix string when printing completion diff --git a/reader.h b/reader.h index 744a360ed..b4a159be1 100644 --- a/reader.h +++ b/reader.h @@ -10,17 +10,15 @@ #define FISH_READER_H #include -#include +#include +#include -#include "util.h" #include "io.h" #include "common.h" #include "complete.h" #include "highlight.h" #include "parse_constants.h" -class parser_t; -class completion_t; class history_t; /* Helper class for storing a command line */ diff --git a/sanity.cpp b/sanity.cpp index f89769414..e918c805c 100644 --- a/sanity.cpp +++ b/sanity.cpp @@ -1,30 +1,17 @@ /** \file sanity.c Functions for performing sanity checks on the program state */ -#include "config.h" +#include "config.h" // IWYU pragma: keep -#include -#include -#include -#include -#include #include -#include -#include -#include -#include - - -#include "fallback.h" -#include "util.h" +#include "fallback.h" // IWYU pragma: keep #include "common.h" #include "sanity.h" #include "proc.h" #include "history.h" #include "reader.h" #include "kill.h" -#include "wutil.h" /** diff --git a/sanity.h b/sanity.h index 6d8e293ae..7480c403c 100644 --- a/sanity.h +++ b/sanity.h @@ -5,8 +5,6 @@ #ifndef FISH_SANITY_H #define FISH_SANITY_H -#include - /** Call this function to tell the program it is not in a sane state. */ diff --git a/screen.cpp b/screen.cpp index 8eb514afc..1971bb571 100644 --- a/screen.cpp +++ b/screen.cpp @@ -11,12 +11,8 @@ efficient way for transforming that to the desired screen content. #include #include #include -#include -#include -#include #include -#include #if HAVE_NCURSES_H #include @@ -36,13 +32,14 @@ efficient way for transforming that to the desired screen content. #include #include +#include +#include #include #include "fallback.h" #include "common.h" #include "util.h" -#include "wutil.h" #include "output.h" #include "highlight.h" #include "screen.h" diff --git a/screen.h b/screen.h index c9e4ac407..e84d8497b 100644 --- a/screen.h +++ b/screen.h @@ -12,8 +12,11 @@ #ifndef FISH_SCREEN_H #define FISH_SCREEN_H +#include +#include #include #include +#include "common.h" #include "highlight.h" class page_rendering_t; diff --git a/signal.cpp b/signal.cpp index 8e62f7885..b13f0c010 100644 --- a/signal.cpp +++ b/signal.cpp @@ -4,15 +4,11 @@ The library for various signal related issues */ -#include "config.h" +#include "config.h" // IWYU pragma: keep - -#include +#include #include -#include #include -#include -#include #include #ifdef HAVE_SIGINFO_H @@ -20,9 +16,7 @@ The library for various signal related issues #endif #include "common.h" -#include "fallback.h" -#include "util.h" - +#include "fallback.h" // IWYU pragma: keep #include "wutil.h" #include "signal.h" #include "event.h" diff --git a/tokenizer.cpp b/tokenizer.cpp index c491bd0e3..319eb2d91 100644 --- a/tokenizer.cpp +++ b/tokenizer.cpp @@ -6,22 +6,19 @@ tokenizing multiple strings and disposing of unused string segments. */ -#include "config.h" +#include "config.h" // IWYU pragma: keep -#include -#include #include #include -#include #include #include +#include +#include -#include "fallback.h" -#include "util.h" - -#include "wutil.h" -#include "tokenizer.h" +#include "fallback.h" // IWYU pragma: keep #include "common.h" +#include "wutil.h" // IWYU pragma: keep - needed for wgettext +#include "tokenizer.h" /* Wow what a hack */ #define TOK_CALL_ERROR(t, e, x) do { tok_call_error((t), (e), (t)->squash_errors ? L"" : (x)); } while (0) diff --git a/tokenizer.h b/tokenizer.h index 954957cc4..09a49509a 100644 --- a/tokenizer.h +++ b/tokenizer.h @@ -9,7 +9,7 @@ #ifndef FISH_TOKENIZER_H #define FISH_TOKENIZER_H -#include +#include #include "common.h" /** diff --git a/utf8.cpp b/utf8.cpp index 196b52681..62453be46 100644 --- a/utf8.cpp +++ b/utf8.cpp @@ -16,13 +16,12 @@ #include #include -#include #include "utf8.h" #include -#include #include +#include #define _NXT 0x80 #define _SEQ2 0xc0 diff --git a/utf8.h b/utf8.h index a1f501545..1c9923db5 100644 --- a/utf8.h +++ b/utf8.h @@ -20,10 +20,9 @@ #ifndef _UTF8_H_ #define _UTF8_H_ -#include +#include #include -#include #define UTF8_IGNORE_ERROR 0x01 #define UTF8_SKIP_BOM 0x02 diff --git a/wcstringutil.cpp b/wcstringutil.cpp index 51ec1a1cf..e61e331bf 100644 --- a/wcstringutil.cpp +++ b/wcstringutil.cpp @@ -3,7 +3,7 @@ Helper functions for working with wcstring */ -#include "config.h" +#include "config.h" // IWYU pragma: keep #include "wcstringutil.h" diff --git a/wcstringutil.h b/wcstringutil.h index 73ca7ac69..4d19fc0b0 100644 --- a/wcstringutil.h +++ b/wcstringutil.h @@ -6,6 +6,7 @@ Helper functions for working with wcstring #ifndef FISH_WCSTRINGUTIL_H #define FISH_WCSTRINGUTIL_H +#include #include #include "common.h" diff --git a/wgetopt.cpp b/wgetopt.cpp index 2d2117f6d..4e4a72419 100644 --- a/wgetopt.cpp +++ b/wgetopt.cpp @@ -61,12 +61,7 @@ #include #include - -#include -#include -#include -#include - +#include "common.h" /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ @@ -92,7 +87,7 @@ #include "wgetopt.h" #include "wutil.h" -#include "fallback.h" +#include "fallback.h" // IWYU pragma: keep @@ -198,7 +193,7 @@ static char *posixly_correct; because there are many ways it can cause trouble. On some systems, it contains special magic macros that don't work in GCC. */ -#include +#include // IWYU pragma: keep #define my_index wcschr #else diff --git a/wgetopt.h b/wgetopt.h index 5a03ba33c..75c790d9a 100644 --- a/wgetopt.h +++ b/wgetopt.h @@ -47,7 +47,7 @@ Cambridge, MA 02139, USA. */ #ifndef FISH_WGETOPT_H #define FISH_WGETOPT_H -#include +#include #ifdef __cplusplus extern "C" { diff --git a/wildcard.cpp b/wildcard.cpp index 24769e807..22672f605 100644 --- a/wildcard.cpp +++ b/wildcard.cpp @@ -6,32 +6,28 @@ wildcards using **. */ -#include "config.h" -#include +#include "config.h" // IWYU pragma: keep #include -#include -#include #include #include -#include #include #include #include #include #include - +#include +#include +#include +#include +#include #include "fallback.h" -#include "util.h" - #include "wutil.h" -#include "complete.h" #include "common.h" #include "wildcard.h" #include "complete.h" #include "reader.h" #include "expand.h" -#include "exec.h" #include /** diff --git a/wildcard.h b/wildcard.h index 8c542221a..9e70f4aaa 100644 --- a/wildcard.h +++ b/wildcard.h @@ -12,10 +12,8 @@ */ #define FISH_WILDCARD_H -#include #include -#include "util.h" #include "common.h" #include "expand.h" #include "complete.h" @@ -26,7 +24,6 @@ #define WILDCARD_RESERVED 0xf400 -class completion_t; /** Enumeration of all wildcard types */ diff --git a/wutil.cpp b/wutil.cpp index 2faec2576..9b95d3b46 100644 --- a/wutil.cpp +++ b/wutil.cpp @@ -12,23 +12,17 @@ #include #include #include -#include #include #include -#include #include #include #include +#include +#include #include #include - -#if HAVE_LIBINTL_H -#include -#endif - #include "fallback.h" -#include "util.h" #include "common.h" #include "wutil.h" diff --git a/wutil.h b/wutil.h index a1945c07b..011f34779 100644 --- a/wutil.h +++ b/wutil.h @@ -6,16 +6,12 @@ #ifndef FISH_WUTIL_H #define FISH_WUTIL_H -#include #include -#include #include -#include -#include #include -#include +#include +#include #include -#include #include #include "common.h"