diff --git a/src/ast.cpp b/src/ast.cpp index edd1e9375..c8e827f1a 100644 --- a/src/ast.cpp +++ b/src/ast.cpp @@ -2,8 +2,8 @@ #include "ast.h" -#include #include +#include #include #include #include @@ -14,7 +14,7 @@ #include "parse_constants.h" #include "parse_tree.h" #include "tokenizer.h" -#include "wutil.h" // IWYU pragma: keep +#include "wutil.h" // IWYU pragma: keep namespace { diff --git a/src/builtins/bg.cpp b/src/builtins/bg.cpp index 4b2b5281e..87be5ce60 100644 --- a/src/builtins/bg.cpp +++ b/src/builtins/bg.cpp @@ -3,18 +3,19 @@ #include "bg.h" +#include + #include #include #include -#include #include #include "../builtin.h" #include "../common.h" #include "../fallback.h" // IWYU pragma: keep #include "../io.h" -#include "../maybe.h" #include "../job_group.h" +#include "../maybe.h" #include "../parser.h" #include "../proc.h" #include "../wutil.h" // IWYU pragma: keep diff --git a/src/builtins/bind.cpp b/src/builtins/bind.cpp index 5ac853c9e..8e45327ba 100644 --- a/src/builtins/bind.cpp +++ b/src/builtins/bind.cpp @@ -11,12 +11,12 @@ #include "../builtin.h" #include "../common.h" -#include "../fallback.h" // IWYU pragma: keep +#include "../fallback.h" // IWYU pragma: keep #include "../input.h" #include "../io.h" #include "../maybe.h" #include "../wgetopt.h" -#include "../wutil.h" // IWYU pragma: keep +#include "../wutil.h" // IWYU pragma: keep enum { BIND_INSERT, BIND_ERASE, BIND_KEY_NAMES, BIND_FUNCTION_NAMES }; struct bind_cmd_opts_t { diff --git a/src/builtins/commandline.cpp b/src/builtins/commandline.cpp index aae6baf8d..0c7492281 100644 --- a/src/builtins/commandline.cpp +++ b/src/builtins/commandline.cpp @@ -11,10 +11,10 @@ #include "../builtin.h" #include "../common.h" #include "../fallback.h" // IWYU pragma: keep -#include "../io.h" -#include "../maybe.h" #include "../input.h" #include "../input_common.h" +#include "../io.h" +#include "../maybe.h" #include "../parse_constants.h" #include "../parse_util.h" #include "../parser.h" diff --git a/src/builtins/fg.cpp b/src/builtins/fg.cpp index 455884022..6e453633f 100644 --- a/src/builtins/fg.cpp +++ b/src/builtins/fg.cpp @@ -20,8 +20,8 @@ #include "../fallback.h" // IWYU pragma: keep #include "../fds.h" #include "../io.h" -#include "../maybe.h" #include "../job_group.h" +#include "../maybe.h" #include "../parser.h" #include "../proc.h" #include "../reader.h" diff --git a/src/builtins/function.cpp b/src/builtins/function.cpp index d19fbf39c..a44d8143e 100644 --- a/src/builtins/function.cpp +++ b/src/builtins/function.cpp @@ -23,9 +23,9 @@ #include "../io.h" #include "../maybe.h" #include "../null_terminated_array.h" +#include "../parse_tree.h" #include "../parser.h" #include "../parser_keywords.h" -#include "../parse_tree.h" #include "../proc.h" #include "../signal.h" #include "../wait_handle.h" diff --git a/src/builtins/function.h b/src/builtins/function.h index dc68e0914..f9bb942c9 100644 --- a/src/builtins/function.h +++ b/src/builtins/function.h @@ -10,7 +10,7 @@ class parser_t; struct io_streams_t; namespace ast { - struct block_statement_t; +struct block_statement_t; } maybe_t builtin_function(parser_t &parser, io_streams_t &streams, diff --git a/src/builtins/history.cpp b/src/builtins/history.cpp index 608b9898e..9a9e050b8 100644 --- a/src/builtins/history.cpp +++ b/src/builtins/history.cpp @@ -11,8 +11,8 @@ #include "../builtin.h" #include "../common.h" -#include "../env.h" #include "../enum_map.h" +#include "../env.h" #include "../fallback.h" // IWYU pragma: keep #include "../history.h" #include "../io.h" diff --git a/src/builtins/jobs.cpp b/src/builtins/jobs.cpp index a403d2496..2ba866148 100644 --- a/src/builtins/jobs.cpp +++ b/src/builtins/jobs.cpp @@ -7,7 +7,7 @@ #include "../builtin.h" #include "../common.h" -#include "../fallback.h" // IWYU pragma: keep +#include "../fallback.h" // IWYU pragma: keep #include "../io.h" #include "../maybe.h" #include "../parser.h" diff --git a/src/builtins/path.cpp b/src/builtins/path.cpp index 6524ebb2c..8d774fdd8 100644 --- a/src/builtins/path.cpp +++ b/src/builtins/path.cpp @@ -3,15 +3,15 @@ #include "path.h" +#include #include #include -#include #include #include #include -#include #include +#include #include #include #include diff --git a/src/builtins/set.cpp b/src/builtins/set.cpp index 119d343dd..49787642a 100644 --- a/src/builtins/set.cpp +++ b/src/builtins/set.cpp @@ -16,8 +16,8 @@ #include "../builtin.h" #include "../common.h" #include "../env.h" -#include "../expand.h" #include "../event.h" +#include "../expand.h" #include "../fallback.h" // IWYU pragma: keep #include "../history.h" #include "../io.h" @@ -163,7 +163,8 @@ static int parse_cmd_opts(set_cmd_opts_t &opts, int *optind, //!OCLINT(high ncs case '?': { // Specifically detect `set -o` because people might be bringing over bashisms. if (wcsncmp(argv[w.woptind - 1], L"-o", 2) == 0) { - streams.err.append(L"Fish does not have shell options. See `help fish-for-bash-users`.\n"); + streams.err.append( + L"Fish does not have shell options. See `help fish-for-bash-users`.\n"); if (w.woptind < argc) { if (wcscmp(argv[w.woptind], L"vi") == 0) { // Tell the vi users how to get what they need. @@ -188,7 +189,7 @@ static int parse_cmd_opts(set_cmd_opts_t &opts, int *optind, //!OCLINT(high ncs } static int validate_cmd_opts(const wchar_t *cmd, const set_cmd_opts_t &opts, int argc, - const wchar_t * argv[], parser_t &parser, io_streams_t &streams) { + const wchar_t *argv[], parser_t &parser, io_streams_t &streams) { // Can't query and erase or list. if (opts.query && (opts.erase || opts.list)) { streams.err.append_format(BUILTIN_ERR_COMBO, cmd); diff --git a/src/builtins/set_color.cpp b/src/builtins/set_color.cpp index 93afd88ee..3f9e82adf 100644 --- a/src/builtins/set_color.cpp +++ b/src/builtins/set_color.cpp @@ -8,7 +8,7 @@ #include #if HAVE_CURSES_H -#include // IWYU pragma: keep +#include // IWYU pragma: keep #elif HAVE_NCURSES_H #include #elif HAVE_NCURSES_CURSES_H @@ -27,7 +27,7 @@ #include "../color.h" #include "../common.h" #include "../env.h" -#include "../fallback.h" // IWYU pragma: keep +#include "../fallback.h" // IWYU pragma: keep #include "../io.h" #include "../maybe.h" #include "../output.h" diff --git a/src/builtins/test.cpp b/src/builtins/test.cpp index eb682f9cd..f33a23f24 100644 --- a/src/builtins/test.cpp +++ b/src/builtins/test.cpp @@ -24,7 +24,7 @@ #include "../builtin.h" #include "../common.h" -#include "../fallback.h" // IWYU pragma: keep +#include "../fallback.h" // IWYU pragma: keep #include "../io.h" #include "../maybe.h" #include "../parser.h" diff --git a/src/color.cpp b/src/color.cpp index bf326d594..914bbc2f1 100644 --- a/src/color.cpp +++ b/src/color.cpp @@ -4,10 +4,10 @@ #include "color.h" #include -#include #include #include #include // IWYU pragma: keep +#include #include "common.h" #include "fallback.h" // IWYU pragma: keep diff --git a/src/color.h b/src/color.h index 33139a44b..8bc20ec5d 100644 --- a/src/color.h +++ b/src/color.h @@ -2,9 +2,9 @@ #ifndef FISH_COLOR_H #define FISH_COLOR_H +#include #include #include -#include #include "common.h" diff --git a/src/common.cpp b/src/common.cpp index b1b642e56..d10344c1e 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -27,8 +27,8 @@ #include #include -#include #include +#include #include #include @@ -40,18 +40,18 @@ #include "global_safety.h" #include "iothread.h" #include "signal.h" -#include "topic_monitor.h" #include "termsize.h" +#include "topic_monitor.h" #include "wcstringutil.h" #include "wildcard.h" #include "wutil.h" // IWYU pragma: keep // Keep after "common.h" #ifdef HAVE_SYS_SYSCTL_H -#include // IWYU pragma: keep +#include // IWYU pragma: keep #endif #if defined(__APPLE__) -#include // IWYU pragma: keep +#include // IWYU pragma: keep #endif struct termios shell_modes; diff --git a/src/complete.cpp b/src/complete.cpp index d218b122f..d46bdbb18 100644 --- a/src/complete.cpp +++ b/src/complete.cpp @@ -11,7 +11,6 @@ #include #include - #include #include #include diff --git a/src/complete.h b/src/complete.h index 3ecc1123b..2c27e05b4 100644 --- a/src/complete.h +++ b/src/complete.h @@ -7,8 +7,8 @@ #include "config.h" // IWYU pragma: keep -#include #include +#include #include #include #include diff --git a/src/env.h b/src/env.h index 1d44ec8eb..db05bfc0c 100644 --- a/src/env.h +++ b/src/env.h @@ -9,8 +9,8 @@ #include #include #include -#include #include +#include #include "common.h" #include "maybe.h" diff --git a/src/env_dispatch.cpp b/src/env_dispatch.cpp index 7844605bd..9b3f08c80 100644 --- a/src/env_dispatch.cpp +++ b/src/env_dispatch.cpp @@ -12,11 +12,11 @@ #include #if HAVE_CURSES_H -#include // IWYU pragma: keep +#include // IWYU pragma: keep #elif HAVE_NCURSES_H -#include // IWYU pragma: keep +#include // IWYU pragma: keep #elif HAVE_NCURSES_CURSES_H -#include // IWYU pragma: keep +#include // IWYU pragma: keep #endif #if HAVE_TERM_H #include @@ -261,14 +261,14 @@ static constexpr bool allow_use_posix_spawn() { // shebangless script. Disable posix_spawn on OpenBSD. #if defined(__OpenBSD__) return false; -#elif defined(__GLIBC__) && !defined(__UCLIBC__) // uClibc defines __GLIBC__ +#elif defined(__GLIBC__) && !defined(__UCLIBC__) // uClibc defines __GLIBC__ // Disallow posix_spawn entirely on glibc < 2.24. // See #8021. return __GLIBC_PREREQ(2, 24) ? true : false; -#else // !defined(__OpenBSD__) +#else // !defined(__OpenBSD__) return true; #endif -#else // !defined(FISH_USE_POSIX_SPAWN) +#else // !defined(FISH_USE_POSIX_SPAWN) return false; #endif } @@ -328,8 +328,9 @@ static std::unique_ptr create_dispatch_table() { var_dispatch_table->add(L"fish_history", handle_fish_history_change); var_dispatch_table->add(L"fish_autosuggestion_enabled", handle_autosuggestion_change); var_dispatch_table->add(L"TZ", handle_tz_change); - if (allow_use_posix_spawn) var_dispatch_table->add(L"fish_use_posix_spawn", - handle_fish_use_posix_spawn_change); + if (allow_use_posix_spawn) { + var_dispatch_table->add(L"fish_use_posix_spawn", handle_fish_use_posix_spawn_change); + } var_dispatch_table->add(L"fish_trace", handle_fish_trace); var_dispatch_table->add(L"fish_cursor_selection_mode", handle_fish_cursor_selection_mode_change); diff --git a/src/env_universal_common.cpp b/src/env_universal_common.cpp index 37a5482c9..465ceac67 100644 --- a/src/env_universal_common.cpp +++ b/src/env_universal_common.cpp @@ -25,8 +25,8 @@ #include // IWYU pragma: keep #include -#include #include +#include #include #include #include diff --git a/src/exec.cpp b/src/exec.cpp index a325ffe08..59e72af2e 100644 --- a/src/exec.cpp +++ b/src/exec.cpp @@ -15,16 +15,16 @@ #include #include -#include #include #include +#include #include #include #include #include #include -#include #include +#include #include "ast.h" #include "builtin.h" diff --git a/src/expand.cpp b/src/expand.cpp index 59b4a4355..17af38038 100644 --- a/src/expand.cpp +++ b/src/expand.cpp @@ -1,5 +1,5 @@ // String expansion functions. These functions perform several kinds of parameter expansion. -#include "config.h" // IWYU pragma: keep +#include "config.h" // IWYU pragma: keep #include #include @@ -83,8 +83,8 @@ static void append_syntax_error(parse_error_list_t *errors, size_t source_start, /// Append a cmdsub error to the given error list. But only do so if the error hasn't already been /// recorded. This is needed because command substitution is a recursive process and some errors /// could consequently be recorded more than once. -static void append_cmdsub_error(parse_error_list_t *errors, size_t source_start, size_t source_end, const wchar_t *fmt, - ...) { +static void append_cmdsub_error(parse_error_list_t *errors, size_t source_start, size_t source_end, + const wchar_t *fmt, ...) { if (!errors) return; parse_error_t error; diff --git a/src/fallback.cpp b/src/fallback.cpp index 5e4d2ec61..07d6e21c5 100644 --- a/src/fallback.cpp +++ b/src/fallback.cpp @@ -20,11 +20,11 @@ #endif #if defined(TPARM_SOLARIS_KLUDGE) #if HAVE_CURSES_H -#include // IWYU pragma: keep +#include // IWYU pragma: keep #elif HAVE_NCURSES_H #include // IWYU pragma: keep #elif HAVE_NCURSES_CURSES_H -#include // IWYU pragma: keep +#include // IWYU pragma: keep #endif #if HAVE_TERM_H #include // IWYU pragma: keep diff --git a/src/fds.h b/src/fds.h index ae4928ead..0b315eb95 100644 --- a/src/fds.h +++ b/src/fds.h @@ -3,10 +3,10 @@ #ifndef FISH_FDS_H #define FISH_FDS_H -#include "config.h" // IWYU pragma: keep +#include "config.h" // IWYU pragma: keep -#include // IWYU pragma: keep -#include // IWYU pragma: keep +#include // IWYU pragma: keep +#include // IWYU pragma: keep #include #include diff --git a/src/fish_indent.cpp b/src/fish_indent.cpp index 9fb9c1725..142786608 100644 --- a/src/fish_indent.cpp +++ b/src/fish_indent.cpp @@ -27,8 +27,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA #include #include #include -#include #include +#include #include #include #include diff --git a/src/fish_tests.cpp b/src/fish_tests.cpp index 9c8e80fd5..03f13903c 100644 --- a/src/fish_tests.cpp +++ b/src/fish_tests.cpp @@ -19,8 +19,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -53,13 +53,13 @@ #include "env_universal_common.h" #include "expand.h" #include "fallback.h" // IWYU pragma: keep -#include "fds.h" #include "fd_monitor.h" +#include "fds.h" #include "function.h" #include "future_feature_flags.h" +#include "global_safety.h" #include "highlight.h" #include "history.h" -#include "global_safety.h" #include "input.h" #include "input_common.h" #include "io.h" diff --git a/src/flog.cpp b/src/flog.cpp index e7886f87b..f5e3b887d 100644 --- a/src/flog.cpp +++ b/src/flog.cpp @@ -1,10 +1,10 @@ /// fish logging -#include "config.h" // IWYU pragma: keep +#include "config.h" // IWYU pragma: keep #include "flog.h" -#include #include +#include #include #include diff --git a/src/function.cpp b/src/function.cpp index d54a43011..8f0e8353a 100644 --- a/src/function.cpp +++ b/src/function.cpp @@ -4,8 +4,9 @@ // #include "config.h" // IWYU pragma: keep -#include +#include "function.h" +#include #include #include #include @@ -23,7 +24,6 @@ #include "env.h" #include "event.h" #include "fallback.h" // IWYU pragma: keep -#include "function.h" #include "maybe.h" #include "parse_constants.h" #include "parser.h" diff --git a/src/highlight.cpp b/src/highlight.cpp index 80abd33af..b026af7c5 100644 --- a/src/highlight.cpp +++ b/src/highlight.cpp @@ -1,6 +1,8 @@ // Functions for syntax highlighting. #include "config.h" // IWYU pragma: keep +#include "highlight.h" + #include #include #include @@ -24,11 +26,10 @@ #include "fallback.h" // IWYU pragma: keep #include "function.h" #include "future_feature_flags.h" -#include "highlight.h" #include "history.h" #include "maybe.h" -#include "output.h" #include "operation_context.h" +#include "output.h" #include "parse_constants.h" #include "parse_util.h" #include "path.h" diff --git a/src/history.cpp b/src/history.cpp index 9546bff4c..80876d587 100644 --- a/src/history.cpp +++ b/src/history.cpp @@ -32,8 +32,8 @@ #include "history_file.h" #include "io.h" #include "iothread.h" -#include "operation_context.h" #include "lru.h" +#include "operation_context.h" #include "parse_constants.h" #include "parse_util.h" #include "path.h" diff --git a/src/history_file.cpp b/src/history_file.cpp index e530a8d96..cce13548a 100644 --- a/src/history_file.cpp +++ b/src/history_file.cpp @@ -1,4 +1,4 @@ -#include "config.h" // IWYU pragma: keep +#include "config.h" // IWYU pragma: keep #include "history_file.h" @@ -7,10 +7,10 @@ #include #include -#include -#include #include #include +#include +#include #include #include diff --git a/src/history_file.h b/src/history_file.h index 3a020d9e2..2c05a4110 100644 --- a/src/history_file.h +++ b/src/history_file.h @@ -1,7 +1,7 @@ #ifndef FISH_HISTORY_FILE_H #define FISH_HISTORY_FILE_H -#include "config.h" // IWYU pragma: keep +#include "config.h" // IWYU pragma: keep #include diff --git a/src/input.cpp b/src/input.cpp index 8dfdb652d..562cf7f33 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -4,7 +4,7 @@ #include #if HAVE_TERM_H -#include // IWYU pragma: keep +#include // IWYU pragma: keep #include #elif HAVE_NCURSES_TERM_H #include diff --git a/src/input_common.cpp b/src/input_common.cpp index 6d4723672..d0e0cbc2c 100644 --- a/src/input_common.cpp +++ b/src/input_common.cpp @@ -11,8 +11,8 @@ #include #include -#include #include +#include #include #include #include diff --git a/src/iothread.cpp b/src/iothread.cpp index ee471f42e..c9bbe20ee 100644 --- a/src/iothread.cpp +++ b/src/iothread.cpp @@ -7,12 +7,12 @@ #include #include -#include // IWYU pragma: keep #include +#include // IWYU pragma: keep #include #include -#include #include +#include #include "common.h" #include "fallback.h" diff --git a/src/job_group.cpp b/src/job_group.cpp index b210288fb..ffc93e520 100644 --- a/src/job_group.cpp +++ b/src/job_group.cpp @@ -1,4 +1,4 @@ -#include "config.h" // IWYU pragma: keep +#include "config.h" // IWYU pragma: keep #include "job_group.h" diff --git a/src/job_group.h b/src/job_group.h index 2697f5e33..43d442bca 100644 --- a/src/job_group.h +++ b/src/job_group.h @@ -4,7 +4,6 @@ #include - #include #include "common.h" diff --git a/src/operation_context.cpp b/src/operation_context.cpp index 478f89eec..c91952918 100644 --- a/src/operation_context.cpp +++ b/src/operation_context.cpp @@ -1,9 +1,10 @@ // Utilities for io redirection. #include "config.h" // IWYU pragma: keep +#include "operation_context.h" + #include -#include "operation_context.h" #include "env.h" bool no_cancel() { return false; } diff --git a/src/pager.cpp b/src/pager.cpp index 087536218..a5c5ec199 100644 --- a/src/pager.cpp +++ b/src/pager.cpp @@ -1,10 +1,11 @@ #include "config.h" // IWYU pragma: keep +#include "pager.h" + #include #include #include - #include #include #include @@ -19,7 +20,6 @@ #include "highlight.h" #include "maybe.h" #include "operation_context.h" -#include "pager.h" #include "reader.h" #include "screen.h" #include "termsize.h" @@ -464,10 +464,9 @@ bool pager_t::completion_try_print(size_t cols, const wcstring &prefix, const co // // We do this so we show a useful amount but don't force fish to // THE VERY TOP, which is jarring. - term_height = std::min(term_height, - std::max(term_height / 2, - static_cast(PAGER_UNDISCLOSED_MAX_ROWS)) - ); + term_height = + std::min(term_height, + std::max(term_height / 2, static_cast(PAGER_UNDISCLOSED_MAX_ROWS))); } size_t row_count = divide_round_up(lst.size(), cols); diff --git a/src/parse_execution.h b/src/parse_execution.h index c3e16ca1b..8b1d78aba 100644 --- a/src/parse_execution.h +++ b/src/parse_execution.h @@ -6,7 +6,7 @@ #include -#include "ast.h" // IWYU pragma: keep +#include "ast.h" // IWYU pragma: keep #include "common.h" #include "io.h" #include "maybe.h" @@ -15,7 +15,6 @@ #include "proc.h" #include "redirection.h" - class block_t; class operation_context_t; class parser_t; diff --git a/src/parse_tree.cpp b/src/parse_tree.cpp index da11f58f2..a67e8f88f 100644 --- a/src/parse_tree.cpp +++ b/src/parse_tree.cpp @@ -11,8 +11,8 @@ #include "ast.h" #include "common.h" -#include "fallback.h" #include "enum_map.h" +#include "fallback.h" #include "maybe.h" #include "parse_constants.h" #include "tokenizer.h" @@ -92,8 +92,7 @@ wcstring parse_error_t::describe_with_prefix(const wcstring &src, const wcstring } // Look for the newline after the source range. If the source range itself includes a // newline, that's the one we want, so start just before the end of the range. - size_t last_char_in_range = - (len == 0 ? start : start + len - 1); + size_t last_char_in_range = (len == 0 ? start : start + len - 1); size_t line_end = src.find(L'\n', last_char_in_range); if (line_end == wcstring::npos) { line_end = src.size(); diff --git a/src/parse_util.cpp b/src/parse_util.cpp index 8ac535765..1ae968663 100644 --- a/src/parse_util.cpp +++ b/src/parse_util.cpp @@ -809,8 +809,8 @@ std::vector parse_util_compute_indents(const wcstring &src) { } /// Append a syntax error to the given error list. -static bool append_syntax_error(parse_error_list_t *errors, size_t source_location, size_t source_length, - const wchar_t *fmt, ...) { +static bool append_syntax_error(parse_error_list_t *errors, size_t source_location, + size_t source_length, const wchar_t *fmt, ...) { if (!errors) return true; parse_error_t error; error.source_start = source_location; @@ -1082,7 +1082,8 @@ static bool detect_errors_in_backgrounded_job(const ast::job_t &job, (deco->kw == parse_keyword_t::kw_and || deco->kw == parse_keyword_t::kw_or) && "Unexpected decorator keyword"); const wchar_t *deco_name = (deco->kw == parse_keyword_t::kw_and ? L"and" : L"or"); - errored = append_syntax_error(parse_errors, deco->source_range().start, deco->source_range().length, + errored = append_syntax_error(parse_errors, deco->source_range().start, + deco->source_range().length, BOOL_AFTER_BACKGROUND_ERROR_MSG, deco_name); } } @@ -1133,8 +1134,8 @@ static bool detect_errors_in_decorated_statement(const wcstring &buff_src, // Check that we don't try to pipe through exec. bool is_in_pipeline = (pipe_pos != pipeline_position_t::none); if (is_in_pipeline && decoration == statement_decoration_t::exec) { - errored = - append_syntax_error(parse_errors, source_start, source_length, INVALID_PIPELINE_CMD_ERR_MSG, L"exec"); + errored = append_syntax_error(parse_errors, source_start, source_length, + INVALID_PIPELINE_CMD_ERR_MSG, L"exec"); } // This is a somewhat stale check that 'and' and 'or' are not in pipelines, except at the @@ -1145,13 +1146,14 @@ static bool detect_errors_in_decorated_statement(const wcstring &buff_src, // commands. const wcstring &command = dst.command.source(buff_src, storage); if (command == L"and" || command == L"or") { - errored = append_syntax_error(parse_errors, source_start, source_length, INVALID_PIPELINE_CMD_ERR_MSG, - command.c_str()); + errored = append_syntax_error(parse_errors, source_start, source_length, + INVALID_PIPELINE_CMD_ERR_MSG, command.c_str()); } // Similarly for time (#8841). if (command == L"time") { - errored = append_syntax_error(parse_errors, source_start, source_length, TIME_IN_PIPELINE_ERR_MSG); + errored = append_syntax_error(parse_errors, source_start, source_length, + TIME_IN_PIPELINE_ERR_MSG); } } @@ -1179,8 +1181,8 @@ static bool detect_errors_in_decorated_statement(const wcstring &buff_src, // Check that pipes are sound. if (!errored && parser_is_pipe_forbidden(command) && is_in_pipeline) { - errored = append_syntax_error(parse_errors, source_start, source_length, INVALID_PIPELINE_CMD_ERR_MSG, - command.c_str()); + errored = append_syntax_error(parse_errors, source_start, source_length, + INVALID_PIPELINE_CMD_ERR_MSG, command.c_str()); } // Check that we don't break or continue from outside a loop. @@ -1220,8 +1222,8 @@ static bool detect_errors_in_decorated_statement(const wcstring &buff_src, if (expand_one(command, expand_flag::skip_cmdsubst, operation_context_t::empty(), parse_errors) && !builtin_exists(unexp_command)) { - errored = append_syntax_error(parse_errors, source_start, source_length, UNKNOWN_BUILTIN_ERR_MSG, - unexp_command.c_str()); + errored = append_syntax_error(parse_errors, source_start, source_length, + UNKNOWN_BUILTIN_ERR_MSG, unexp_command.c_str()); } } @@ -1241,7 +1243,8 @@ static bool detect_errors_in_decorated_statement(const wcstring &buff_src, static bool detect_errors_in_block_redirection_list( const ast::argument_or_redirection_list_t &args_or_redirs, parse_error_list_t *out_errors) { if (const auto *first_arg = get_first_arg(args_or_redirs)) { - return append_syntax_error(out_errors, first_arg->source_range().start, first_arg->source_range().length, END_ARG_ERR_MSG); + return append_syntax_error(out_errors, first_arg->source_range().start, + first_arg->source_range().length, END_ARG_ERR_MSG); } return false; } diff --git a/src/parse_util.h b/src/parse_util.h index 96422baaa..460b19b1d 100644 --- a/src/parse_util.h +++ b/src/parse_util.h @@ -11,9 +11,9 @@ #include "parse_constants.h" namespace ast { - struct argument_t; - class ast_t; -} +struct argument_t; +class ast_t; +} // namespace ast struct tok_t; /// Handles slices: the square brackets in an expression like $foo[5..4] diff --git a/src/parser.cpp b/src/parser.cpp index 7b6533ddb..5d382d3fd 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -21,8 +21,8 @@ #include "env.h" #include "event.h" #include "expand.h" -#include "fds.h" #include "fallback.h" // IWYU pragma: keep +#include "fds.h" #include "flog.h" #include "function.h" #include "job_group.h" diff --git a/src/proc.cpp b/src/proc.cpp index 86019e8f9..4c1b18a50 100644 --- a/src/proc.cpp +++ b/src/proc.cpp @@ -14,7 +14,7 @@ #include #if HAVE_TERM_H -#include // IWYU pragma: keep +#include // IWYU pragma: keep #include #elif HAVE_NCURSES_TERM_H #include @@ -27,17 +27,17 @@ #include #include // IWYU pragma: keep -#include #include +#include #include #include #include #include "common.h" #include "env.h" -#include "fds.h" #include "event.h" #include "fallback.h" // IWYU pragma: keep +#include "fds.h" #include "flog.h" #include "global_safety.h" #include "io.h" diff --git a/src/re.cpp b/src/re.cpp index 9ca2e2c99..5b1424350 100644 --- a/src/re.cpp +++ b/src/re.cpp @@ -1,10 +1,10 @@ #include "config.h" // IWYU pragma: keep +#include "re.h" + #include #include -#include "re.h" - #include "flog.h" #define PCRE2_CODE_UNIT_WIDTH WCHAR_T_BITS diff --git a/src/reader.cpp b/src/reader.cpp index ad065e6fb..0651ec089 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -20,23 +20,22 @@ #include #endif #include -#include - -#include #include #include #include +#include #include #include #include #include -#include #include +#include #include #include #include #include +#include #include #include #include @@ -78,8 +77,8 @@ #include "signal.h" #include "termsize.h" #include "tokenizer.h" -#include "wildcard.h" #include "wcstringutil.h" +#include "wildcard.h" #include "wutil.h" // IWYU pragma: keep // Name of the variable that tells how long it took, in milliseconds, for the previous diff --git a/src/reader.h b/src/reader.h index 0401bd598..f22e9a378 100644 --- a/src/reader.h +++ b/src/reader.h @@ -7,10 +7,10 @@ #include #include -#include #include -#include +#include #include +#include #include "common.h" #include "complete.h" diff --git a/src/redirection.cpp b/src/redirection.cpp index 59098f02e..1e884809d 100644 --- a/src/redirection.cpp +++ b/src/redirection.cpp @@ -4,6 +4,7 @@ #include #include + #include #include "io.h" diff --git a/src/screen.cpp b/src/screen.cpp index d106cc0a0..30e27421b 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -17,7 +17,7 @@ #include #if HAVE_CURSES_H -#include // IWYU pragma: keep +#include // IWYU pragma: keep #elif HAVE_NCURSES_H #include #elif HAVE_NCURSES_CURSES_H diff --git a/src/termsize.cpp b/src/termsize.cpp index f9269a7da..8bdcd0d2a 100644 --- a/src/termsize.cpp +++ b/src/termsize.cpp @@ -4,6 +4,9 @@ #include +#include +#include + #include "env.h" #include "flog.h" #include "maybe.h" @@ -11,9 +14,6 @@ #include "wcstringutil.h" #include "wutil.h" -#include -#include - #ifdef HAVE_WINSIZE #include #include diff --git a/src/termsize.h b/src/termsize.h index c3e46a0e5..7050cb51d 100644 --- a/src/termsize.h +++ b/src/termsize.h @@ -7,8 +7,8 @@ #include #include "common.h" -#include "maybe.h" #include "global_safety.h" +#include "maybe.h" class environment_t; class parser_t; diff --git a/src/timer.cpp b/src/timer.cpp index 22b9b6ea4..0341d8157 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -3,9 +3,9 @@ #include "timer.h" -#include #include #include +#include #include #include @@ -16,7 +16,7 @@ #include "common.h" #include "fallback.h" // IWYU pragma: keep -#include "wutil.h" // IWYU pragma: keep +#include "wutil.h" // IWYU pragma: keep // Measuring time is always complicated with many caveats. Quite apart from the typical // gotchas faced by developers attempting to choose between monotonic vs non-monotonic and system vs diff --git a/src/tokenizer.cpp b/src/tokenizer.cpp index c44dfb275..b2ceb2879 100644 --- a/src/tokenizer.cpp +++ b/src/tokenizer.cpp @@ -55,7 +55,8 @@ const wchar_t *tokenizer_get_error_message(tokenizer_error_t err) { /// Return an error token and mark that we no longer have a next token. tok_t tokenizer_t::call_error(tokenizer_error_t error_type, const wchar_t *token_start, - const wchar_t *error_loc, maybe_t token_length, size_t error_len) { + const wchar_t *error_loc, maybe_t token_length, + size_t error_len) { assert(error_type != tokenizer_error_t::none && "tokenizer_error_t::none passed to call_error"); assert(error_loc >= token_start && "Invalid error location"); assert(this->token_cursor >= token_start && "Invalid buff location"); @@ -616,8 +617,7 @@ maybe_t tokenizer_t::next() { return this->call_error(tokenizer_error_t::invalid_redirect, this->token_cursor, this->token_cursor, redir_or_pipe ? redir_or_pipe->consumed : 0, - redir_or_pipe ? redir_or_pipe->consumed : 0 - ); + redir_or_pipe ? redir_or_pipe->consumed : 0); } result.emplace(redir_or_pipe->token_type()); result->offset = start_pos; @@ -639,10 +639,8 @@ maybe_t tokenizer_t::next() { // tokenizer error. if (redir_or_pipe->is_pipe && redir_or_pipe->fd == 0) { return this->call_error(tokenizer_error_t::invalid_pipe, error_location, - error_location, - redir_or_pipe->consumed, - redir_or_pipe->consumed - ); + error_location, redir_or_pipe->consumed, + redir_or_pipe->consumed); } result.emplace(redir_or_pipe->token_type()); result->offset = start_pos; diff --git a/src/tokenizer.h b/src/tokenizer.h index 35a6661c8..3fd12466f 100644 --- a/src/tokenizer.h +++ b/src/tokenizer.h @@ -109,7 +109,8 @@ class tokenizer_t : noncopyable_t { bool continue_line_after_comment{false}; tok_t call_error(tokenizer_error_t error_type, const wchar_t *token_start, - const wchar_t *error_loc, maybe_t token_length = {}, size_t error_len = 0); + const wchar_t *error_loc, maybe_t token_length = {}, + size_t error_len = 0); tok_t read_string(); public: diff --git a/src/topic_monitor.h b/src/topic_monitor.h index f589f13ea..8ec3d771b 100644 --- a/src/topic_monitor.h +++ b/src/topic_monitor.h @@ -5,7 +5,7 @@ #include #include -#include // IWYU pragma: keep +#include // IWYU pragma: keep #include #include #include diff --git a/src/trace.cpp b/src/trace.cpp index 4d352848c..8fa2cfe63 100644 --- a/src/trace.cpp +++ b/src/trace.cpp @@ -1,4 +1,4 @@ -#include "config.h" // IWYU pragma: keep +#include "config.h" // IWYU pragma: keep #include "trace.h" diff --git a/src/wait_handle.cpp b/src/wait_handle.cpp index 43076f801..765419151 100644 --- a/src/wait_handle.cpp +++ b/src/wait_handle.cpp @@ -1,4 +1,4 @@ -#include "config.h" // IWYU pragma: keep +#include "config.h" // IWYU pragma: keep #include "wait_handle.h" diff --git a/src/wcstringutil.cpp b/src/wcstringutil.cpp index 6d8c9e801..2fa6412ff 100644 --- a/src/wcstringutil.cpp +++ b/src/wcstringutil.cpp @@ -10,7 +10,7 @@ #include #include "common.h" -#include "fallback.h" // IWYU pragma: keep +#include "fallback.h" // IWYU pragma: keep #include "flog.h" wcstring truncate(const wcstring &input, int max_len, ellipsis_type etype) { diff --git a/src/wgetopt.cpp b/src/wgetopt.cpp index cd0de046c..2c7c8ec63 100644 --- a/src/wgetopt.cpp +++ b/src/wgetopt.cpp @@ -38,8 +38,8 @@ // Ave, Cambridge, MA 02139, USA. #include "config.h" // IWYU pragma: keep -#include #include +#include #include diff --git a/src/wutil.h b/src/wutil.h index caa69b35f..84a77e668 100644 --- a/src/wutil.h +++ b/src/wutil.h @@ -2,7 +2,7 @@ #ifndef FISH_WUTIL_H #define FISH_WUTIL_H -#include "config.h" // IWYU pragma: keep +#include "config.h" // IWYU pragma: keep #include #include