From 82eca4bc867204fe87b4efbf5ec73feb215d97fb Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sun, 13 Oct 2019 15:50:48 -0700 Subject: [PATCH] Run clang-format on all files The main change here is to reorder headers. --- src/autoload.h | 8 ++++---- src/builtin.cpp | 7 ++++--- src/builtin_argparse.cpp | 5 +++-- src/builtin_bg.cpp | 3 ++- src/builtin_bind.cpp | 3 ++- src/builtin_block.cpp | 3 ++- src/builtin_builtin.cpp | 3 ++- src/builtin_cd.cpp | 3 ++- src/builtin_command.cpp | 3 ++- src/builtin_commandline.cpp | 1 + src/builtin_complete.cpp | 6 +++--- src/builtin_complete.h | 3 +-- src/builtin_contains.cpp | 4 +++- src/builtin_disown.cpp | 3 ++- src/builtin_echo.cpp | 3 ++- src/builtin_emit.cpp | 3 ++- src/builtin_exit.cpp | 3 ++- src/builtin_fg.cpp | 4 +++- src/builtin_function.cpp | 3 ++- src/builtin_functions.cpp | 8 +++++--- src/builtin_history.cpp | 5 +++-- src/builtin_jobs.h | 3 +-- src/builtin_math.cpp | 8 ++++---- src/builtin_printf.cpp | 1 + src/builtin_printf.h | 3 +-- src/builtin_pwd.cpp | 3 ++- src/builtin_random.cpp | 5 +++-- src/builtin_read.cpp | 7 ++++--- src/builtin_realpath.cpp | 4 +++- src/builtin_return.cpp | 3 ++- src/builtin_set.cpp | 4 ++-- src/builtin_set.h | 3 +-- src/builtin_set_color.cpp | 2 +- src/builtin_set_color.h | 3 +-- src/builtin_source.cpp | 4 +++- src/builtin_status.cpp | 7 ++++--- src/builtin_string.cpp | 2 +- src/builtin_string.h | 3 +-- src/builtin_test.cpp | 7 ++++--- src/builtin_ulimit.h | 3 +-- src/builtin_wait.cpp | 7 ++++--- src/builtin_wait.h | 1 + src/color.cpp | 4 +++- src/color.h | 1 - src/common.cpp | 1 + src/complete.cpp | 5 +++-- src/complete.h | 1 - src/env.cpp | 3 ++- src/env_dispatch.cpp | 2 ++ src/env_dispatch.h | 4 ++-- src/env_universal_common.cpp | 3 ++- src/event.cpp | 3 ++- src/exec.cpp | 4 ++-- src/expand.cpp | 1 + src/fallback.cpp | 4 +++- src/fallback.h | 4 ++-- src/fish.cpp | 2 +- src/fish_indent.cpp | 2 +- src/fish_key_reader.cpp | 2 +- src/fish_tests.cpp | 6 +++--- src/flog.cpp | 6 +++--- src/flog.h | 5 +++-- src/function.cpp | 2 +- src/future_feature_flags.cpp | 3 ++- src/future_feature_flags.h | 1 + src/global_safety.h | 4 ++-- src/highlight.cpp | 2 +- src/history.cpp | 1 + src/history_file.cpp | 3 ++- src/history_file.h | 4 ++-- src/input.cpp | 1 + src/input_common.cpp | 3 ++- src/input_common.h | 7 ++++--- src/intern.cpp | 5 +++-- src/io.cpp | 4 +++- src/iothread.cpp | 7 ++++--- src/iothread.h | 1 + src/kill.cpp | 1 + src/lru.h | 1 - src/output.cpp | 3 ++- src/pager.cpp | 2 +- src/parse_constants.h | 3 ++- src/parse_execution.cpp | 8 +++++--- src/parse_grammar.h | 1 + src/parse_productions.cpp | 3 ++- src/parse_tree.cpp | 5 +++-- src/parse_util.cpp | 5 +++-- src/parser.cpp | 5 +++-- src/parser_keywords.cpp | 3 ++- src/path.cpp | 5 +++-- src/postfork.cpp | 1 + src/print_help.cpp | 4 +++- src/proc.cpp | 1 + src/reader.cpp | 8 +++++--- src/redirection.cpp | 3 ++- src/redirection.h | 4 ++-- src/sanity.cpp | 3 ++- src/screen.cpp | 25 ++++++++++++------------- src/screen.h | 2 +- src/tinyexpr.cpp | 5 +++-- src/tokenizer.cpp | 5 +++-- src/topic_monitor.cpp | 7 ++++--- src/topic_monitor.h | 8 ++++---- src/utf8.cpp | 3 ++- src/util.cpp | 6 ++++-- src/wcstringutil.cpp | 3 ++- src/wgetopt.cpp | 1 + src/wildcard.cpp | 5 +++-- src/wutil.cpp | 3 ++- src/wutil.h | 1 + 110 files changed, 250 insertions(+), 171 deletions(-) diff --git a/src/autoload.h b/src/autoload.h index 3a17538fd..64efce9c4 100644 --- a/src/autoload.h +++ b/src/autoload.h @@ -4,15 +4,15 @@ #include "config.h" // IWYU pragma: keep -#include "common.h" -#include "env.h" -#include "wutil.h" - #include #include #include #include +#include "common.h" +#include "env.h" +#include "wutil.h" + class autoload_file_cache_t; class environment_t; class parser_t; diff --git a/src/builtin.cpp b/src/builtin.cpp index fd6b51331..0d7ecc7f2 100644 --- a/src/builtin.cpp +++ b/src/builtin.cpp @@ -17,17 +17,18 @@ // 4). Use 'git add sphinx_doc_src/NAME.txt' to start tracking changes to the documentation file. #include "config.h" // IWYU pragma: keep +#include "builtin.h" + #include #include #include -#include -#include #include +#include +#include #include #include -#include "builtin.h" #include "builtin_argparse.h" #include "builtin_bg.h" #include "builtin_bind.h" diff --git a/src/builtin_argparse.cpp b/src/builtin_argparse.cpp index b6c4405c6..4d482773e 100644 --- a/src/builtin_argparse.cpp +++ b/src/builtin_argparse.cpp @@ -3,12 +3,14 @@ // See issue #4190 for the rationale behind the original behavior of this builtin. #include "config.h" // IWYU pragma: keep +#include "builtin_argparse.h" + #include #include #include -#include #include +#include #include #include #include @@ -16,7 +18,6 @@ #include #include "builtin.h" -#include "builtin_argparse.h" #include "common.h" #include "env.h" #include "exec.h" diff --git a/src/builtin_bg.cpp b/src/builtin_bg.cpp index b2d8f3aae..60bc11bb4 100644 --- a/src/builtin_bg.cpp +++ b/src/builtin_bg.cpp @@ -1,6 +1,8 @@ // Implementation of the bg builtin. #include "config.h" // IWYU pragma: keep +#include "builtin_bg.h" + #include #include @@ -8,7 +10,6 @@ #include #include "builtin.h" -#include "builtin_bg.h" #include "common.h" #include "fallback.h" // IWYU pragma: keep #include "io.h" diff --git a/src/builtin_bind.cpp b/src/builtin_bind.cpp index 035949623..477e15075 100644 --- a/src/builtin_bind.cpp +++ b/src/builtin_bind.cpp @@ -1,6 +1,8 @@ // Implementation of the bind builtin. #include "config.h" // IWYU pragma: keep +#include "builtin_bind.h" + #include #include @@ -10,7 +12,6 @@ #include #include "builtin.h" -#include "builtin_bind.h" #include "common.h" #include "fallback.h" // IWYU pragma: keep #include "input.h" // IWYU pragma: keep diff --git a/src/builtin_block.cpp b/src/builtin_block.cpp index dfe8ef046..b42487dd3 100644 --- a/src/builtin_block.cpp +++ b/src/builtin_block.cpp @@ -1,10 +1,11 @@ // Implementation of the bind builtin. #include "config.h" // IWYU pragma: keep +#include "builtin_block.h" + #include #include "builtin.h" -#include "builtin_block.h" #include "common.h" #include "event.h" #include "fallback.h" // IWYU pragma: keep diff --git a/src/builtin_builtin.cpp b/src/builtin_builtin.cpp index c27eeae35..dd8391c8a 100644 --- a/src/builtin_builtin.cpp +++ b/src/builtin_builtin.cpp @@ -1,12 +1,13 @@ // Implementation of the builtin builtin. #include "config.h" // IWYU pragma: keep +#include "builtin.h" + #include #include #include -#include "builtin.h" #include "builtin_builtin.h" #include "common.h" #include "fallback.h" // IWYU pragma: keep diff --git a/src/builtin_cd.cpp b/src/builtin_cd.cpp index ae34ceb12..7599e5cd3 100644 --- a/src/builtin_cd.cpp +++ b/src/builtin_cd.cpp @@ -1,12 +1,13 @@ // Implementation of the cd builtin. #include "config.h" // IWYU pragma: keep +#include "builtin_cd.h" + #include #include #include #include "builtin.h" -#include "builtin_cd.h" #include "common.h" #include "env.h" #include "fallback.h" // IWYU pragma: keep diff --git a/src/builtin_command.cpp b/src/builtin_command.cpp index 28a98c1ad..b13fdd390 100644 --- a/src/builtin_command.cpp +++ b/src/builtin_command.cpp @@ -1,12 +1,13 @@ // Implementation of the command builtin. #include "config.h" // IWYU pragma: keep +#include "builtin_command.h" + #include #include #include "builtin.h" -#include "builtin_command.h" #include "common.h" #include "fallback.h" // IWYU pragma: keep #include "io.h" diff --git a/src/builtin_commandline.cpp b/src/builtin_commandline.cpp index 9e7db57e0..0c849612b 100644 --- a/src/builtin_commandline.cpp +++ b/src/builtin_commandline.cpp @@ -4,6 +4,7 @@ #include #include #include + #include #include "builtin.h" diff --git a/src/builtin_complete.cpp b/src/builtin_complete.cpp index abb5ecd63..19fcd435c 100644 --- a/src/builtin_complete.cpp +++ b/src/builtin_complete.cpp @@ -2,23 +2,23 @@ #include "config.h" // IWYU pragma: keep #include -#include +#include #include #include #include #include "builtin.h" +#include "color.h" #include "common.h" #include "complete.h" #include "env.h" #include "fallback.h" // IWYU pragma: keep +#include "highlight.h" #include "io.h" #include "parse_constants.h" #include "parse_util.h" #include "parser.h" -#include "highlight.h" -#include "color.h" #include "reader.h" #include "wgetopt.h" #include "wutil.h" // IWYU pragma: keep diff --git a/src/builtin_complete.h b/src/builtin_complete.h index 7cbaccd5b..f69d98356 100644 --- a/src/builtin_complete.h +++ b/src/builtin_complete.h @@ -2,9 +2,8 @@ #ifndef FISH_BUILTIN_COMPLETE_H #define FISH_BUILTIN_COMPLETE_H -#include - #include +#include class parser_t; diff --git a/src/builtin_contains.cpp b/src/builtin_contains.cpp index 2589f2dce..289b04645 100644 --- a/src/builtin_contains.cpp +++ b/src/builtin_contains.cpp @@ -1,11 +1,13 @@ // Implementation of the contains builtin. #include "config.h" // IWYU pragma: keep +#include "builtin_contains.h" + #include + #include #include "builtin.h" -#include "builtin_contains.h" #include "common.h" #include "fallback.h" // IWYU pragma: keep #include "io.h" diff --git a/src/builtin_disown.cpp b/src/builtin_disown.cpp index 622d1373f..d8e568ec9 100644 --- a/src/builtin_disown.cpp +++ b/src/builtin_disown.cpp @@ -1,13 +1,14 @@ // Implementation of the disown builtin. #include "config.h" // IWYU pragma: keep +#include "builtin_disown.h" + #include #include #include #include "builtin.h" -#include "builtin_disown.h" #include "common.h" #include "fallback.h" // IWYU pragma: keep #include "io.h" diff --git a/src/builtin_echo.cpp b/src/builtin_echo.cpp index cbd7949e0..cb5b9f891 100644 --- a/src/builtin_echo.cpp +++ b/src/builtin_echo.cpp @@ -1,11 +1,12 @@ // Implementation of the echo builtin. #include "config.h" // IWYU pragma: keep +#include "builtin_echo.h" + #include #include #include "builtin.h" -#include "builtin_echo.h" #include "common.h" #include "fallback.h" // IWYU pragma: keep #include "io.h" diff --git a/src/builtin_emit.cpp b/src/builtin_emit.cpp index 46045ef5c..8ef33a320 100644 --- a/src/builtin_emit.cpp +++ b/src/builtin_emit.cpp @@ -1,8 +1,9 @@ // Implementation of the emit builtin. #include "config.h" // IWYU pragma: keep -#include "builtin.h" #include "builtin_emit.h" + +#include "builtin.h" #include "common.h" #include "event.h" #include "fallback.h" // IWYU pragma: keep diff --git a/src/builtin_exit.cpp b/src/builtin_exit.cpp index 853b83cf0..e747f10ae 100644 --- a/src/builtin_exit.cpp +++ b/src/builtin_exit.cpp @@ -1,11 +1,12 @@ // Implementation of the exit builtin. #include "config.h" // IWYU pragma: keep +#include "builtin_exit.h" + #include #include #include "builtin.h" -#include "builtin_exit.h" #include "common.h" #include "fallback.h" // IWYU pragma: keep #include "io.h" diff --git a/src/builtin_fg.cpp b/src/builtin_fg.cpp index 7e24477a0..072e038a2 100644 --- a/src/builtin_fg.cpp +++ b/src/builtin_fg.cpp @@ -1,13 +1,15 @@ // Implementation of the fg builtin. #include "config.h" // IWYU pragma: keep +#include "builtin_fg.h" + #include #include #include + #include #include "builtin.h" -#include "builtin_fg.h" #include "common.h" #include "env.h" #include "fallback.h" // IWYU pragma: keep diff --git a/src/builtin_function.cpp b/src/builtin_function.cpp index 3012e8832..415778880 100644 --- a/src/builtin_function.cpp +++ b/src/builtin_function.cpp @@ -1,6 +1,8 @@ // Implementation of the function builtin. #include "config.h" // IWYU pragma: keep +#include "builtin_function.h" + #include #include #include @@ -11,7 +13,6 @@ #include #include "builtin.h" -#include "builtin_function.h" #include "common.h" #include "complete.h" #include "event.h" diff --git a/src/builtin_functions.cpp b/src/builtin_functions.cpp index b871bff9e..8d8ccfe22 100644 --- a/src/builtin_functions.cpp +++ b/src/builtin_functions.cpp @@ -1,11 +1,13 @@ // Implementation of the functions builtin. #include "config.h" // IWYU pragma: keep +#include "builtin_functions.h" + #include #include -#include #include +#include #include #include #include @@ -13,7 +15,6 @@ #include #include "builtin.h" -#include "builtin_functions.h" #include "common.h" #include "complete.h" #include "env.h" @@ -266,7 +267,8 @@ static int report_function_metadata(const wchar_t *funcname, bool verbose, io_st append_format(comment, L"# Defined in %ls @ line %d\n", path, line_number); if (!streams.out_is_redirected && isatty(STDOUT_FILENO)) { std::vector colors; - highlight_shell_no_io(comment, colors, comment.size(), nullptr, env_stack_t::globals()); + highlight_shell_no_io(comment, colors, comment.size(), nullptr, + env_stack_t::globals()); streams.out.append(str2wcstring(colorize(comment, colors))); } else { streams.out.append(comment); diff --git a/src/builtin_history.cpp b/src/builtin_history.cpp index 661dc50b0..70d68da61 100644 --- a/src/builtin_history.cpp +++ b/src/builtin_history.cpp @@ -1,16 +1,17 @@ // Implementation of the history builtin. #include "config.h" // IWYU pragma: keep +#include "builtin_history.h" + #include #include #include -#include +#include #include #include #include "builtin.h" -#include "builtin_history.h" #include "common.h" #include "fallback.h" // IWYU pragma: keep #include "history.h" diff --git a/src/builtin_jobs.h b/src/builtin_jobs.h index 7f6babbf9..adb3cfba0 100644 --- a/src/builtin_jobs.h +++ b/src/builtin_jobs.h @@ -2,9 +2,8 @@ #ifndef FISH_BUILTIN_JOBS_H #define FISH_BUILTIN_JOBS_H -#include - #include +#include class parser_t; diff --git a/src/builtin_math.cpp b/src/builtin_math.cpp index ebe3918af..b2d1e11fb 100644 --- a/src/builtin_math.cpp +++ b/src/builtin_math.cpp @@ -1,22 +1,22 @@ // Implementation of the math builtin. #include "config.h" // IWYU pragma: keep +#include "builtin_math.h" + #include #include -#include #include #include +#include #include #include -#include "tinyexpr.h" - #include "builtin.h" -#include "builtin_math.h" #include "common.h" #include "fallback.h" // IWYU pragma: keep #include "io.h" +#include "tinyexpr.h" #include "wgetopt.h" #include "wutil.h" // IWYU pragma: keep diff --git a/src/builtin_printf.cpp b/src/builtin_printf.cpp index 55c4be7b6..d722dd4e7 100644 --- a/src/builtin_printf.cpp +++ b/src/builtin_printf.cpp @@ -59,6 +59,7 @@ #include #include #include + #include #include diff --git a/src/builtin_printf.h b/src/builtin_printf.h index b0608cbb5..4248d9785 100644 --- a/src/builtin_printf.h +++ b/src/builtin_printf.h @@ -2,9 +2,8 @@ #ifndef FISH_BUILTIN_PRINTF_H #define FISH_BUILTIN_PRINTF_H -#include - #include +#include class parser_t; diff --git a/src/builtin_pwd.cpp b/src/builtin_pwd.cpp index 143bc6e8c..328cec5d7 100644 --- a/src/builtin_pwd.cpp +++ b/src/builtin_pwd.cpp @@ -1,10 +1,11 @@ // Implementation of the pwd builtin. #include "config.h" // IWYU pragma: keep +#include "builtin_pwd.h" + #include #include "builtin.h" -#include "builtin_pwd.h" #include "common.h" #include "fallback.h" // IWYU pragma: keep #include "io.h" diff --git a/src/builtin_random.cpp b/src/builtin_random.cpp index d6cfbb602..f97a63914 100644 --- a/src/builtin_random.cpp +++ b/src/builtin_random.cpp @@ -1,15 +1,16 @@ // Implementation of the random builtin. #include "config.h" // IWYU pragma: keep +#include "builtin_random.h" + #include #include -#include #include +#include #include #include "builtin.h" -#include "builtin_random.h" #include "common.h" #include "fallback.h" // IWYU pragma: keep #include "io.h" diff --git a/src/builtin_read.cpp b/src/builtin_read.cpp index 94e831f2d..0fd657305 100644 --- a/src/builtin_read.cpp +++ b/src/builtin_read.cpp @@ -1,23 +1,24 @@ // Implementation of the read builtin. #include "config.h" // IWYU pragma: keep +#include "builtin_read.h" + #include #include #include #include #include #include -#include -#include #include +#include +#include #include #include #include #include #include "builtin.h" -#include "builtin_read.h" #include "common.h" #include "complete.h" #include "env.h" diff --git a/src/builtin_realpath.cpp b/src/builtin_realpath.cpp index 98f51234c..bd4118805 100644 --- a/src/builtin_realpath.cpp +++ b/src/builtin_realpath.cpp @@ -1,13 +1,15 @@ // Implementation of the realpath builtin. #include "config.h" // IWYU pragma: keep +#include "builtin_realpath.h" + #include #include + #include #include #include "builtin.h" -#include "builtin_realpath.h" #include "common.h" #include "fallback.h" // IWYU pragma: keep #include "io.h" diff --git a/src/builtin_return.cpp b/src/builtin_return.cpp index ec6fd5739..0debc5ca5 100644 --- a/src/builtin_return.cpp +++ b/src/builtin_return.cpp @@ -1,11 +1,12 @@ // Implementation of the return builtin. #include "config.h" // IWYU pragma: keep +#include "builtin_return.h" + #include #include #include "builtin.h" -#include "builtin_return.h" #include "common.h" #include "fallback.h" // IWYU pragma: keep #include "io.h" diff --git a/src/builtin_set.cpp b/src/builtin_set.cpp index 996a5b9d7..5b8c06fea 100644 --- a/src/builtin_set.cpp +++ b/src/builtin_set.cpp @@ -6,10 +6,10 @@ #include #include #include -#include -#include #include +#include +#include #include #include #include diff --git a/src/builtin_set.h b/src/builtin_set.h index af930ad23..ffd517da3 100644 --- a/src/builtin_set.h +++ b/src/builtin_set.h @@ -2,9 +2,8 @@ #ifndef FISH_BUILTIN_SET_H #define FISH_BUILTIN_SET_H -#include - #include +#include class parser_t; diff --git a/src/builtin_set_color.cpp b/src/builtin_set_color.cpp index cb1bfcfdb..f84e33fac 100644 --- a/src/builtin_set_color.cpp +++ b/src/builtin_set_color.cpp @@ -43,7 +43,7 @@ static void print_colors(io_streams_t &streams) { } outp.writestr(color_name); outp.writech(L'\n'); - } // conveniently, 'normal' is always the last color so we don't need to reset here + } // conveniently, 'normal' is always the last color so we don't need to reset here streams.out.append(str2wcstring(outp.contents())); } diff --git a/src/builtin_set_color.h b/src/builtin_set_color.h index f35d57936..87ae3e37f 100644 --- a/src/builtin_set_color.h +++ b/src/builtin_set_color.h @@ -2,9 +2,8 @@ #ifndef FISH_BUILTIN_SET_COLOR_H #define FISH_BUILTIN_SET_COLOR_H -#include - #include +#include class parser_t; diff --git a/src/builtin_source.cpp b/src/builtin_source.cpp index 8f4b4f14b..aec69ffef 100644 --- a/src/builtin_source.cpp +++ b/src/builtin_source.cpp @@ -1,13 +1,15 @@ // Implementation of the source builtin. #include "config.h" // IWYU pragma: keep +#include "builtin_source.h" + #include #include #include + #include #include "builtin.h" -#include "builtin_source.h" #include "common.h" #include "env.h" #include "fallback.h" // IWYU pragma: keep diff --git a/src/builtin_status.cpp b/src/builtin_status.cpp index 25fe787cf..28b8e0489 100644 --- a/src/builtin_status.cpp +++ b/src/builtin_status.cpp @@ -1,13 +1,14 @@ // Implementation of the status builtin. #include "config.h" // IWYU pragma: keep -#include -#include +#include "builtin_status.h" +#include + +#include #include #include "builtin.h" -#include "builtin_status.h" #include "common.h" #include "fallback.h" // IWYU pragma: keep #include "future_feature_flags.h" diff --git a/src/builtin_string.cpp b/src/builtin_string.cpp index 3b4b17b6a..b3d1663ef 100644 --- a/src/builtin_string.cpp +++ b/src/builtin_string.cpp @@ -12,9 +12,9 @@ #include #include #include -#include #include +#include #include #include #include diff --git a/src/builtin_string.h b/src/builtin_string.h index 22dcfb28e..ce139a6f0 100644 --- a/src/builtin_string.h +++ b/src/builtin_string.h @@ -2,9 +2,8 @@ #ifndef FISH_BUILTIN_STRING_H #define FISH_BUILTIN_STRING_H -#include - #include +#include class parser_t; diff --git a/src/builtin_test.cpp b/src/builtin_test.cpp index 1e0245f8b..db74fceae 100644 --- a/src/builtin_test.cpp +++ b/src/builtin_test.cpp @@ -3,22 +3,23 @@ // Implemented from scratch (yes, really) by way of IEEE 1003.1 as reference. #include "config.h" // IWYU pragma: keep +#include "builtin.h" + #include #include #include #include #include #include -#include -#include #include +#include +#include #include #include #include #include -#include "builtin.h" #include "common.h" #include "io.h" #include "parser.h" diff --git a/src/builtin_ulimit.h b/src/builtin_ulimit.h index 54de72642..19c9348e5 100644 --- a/src/builtin_ulimit.h +++ b/src/builtin_ulimit.h @@ -2,9 +2,8 @@ #ifndef FISH_BUILTIN_ULIMIT_H #define FISH_BUILTIN_ULIMIT_H -#include - #include +#include class parser_t; diff --git a/src/builtin_wait.cpp b/src/builtin_wait.cpp index beeafb1bc..a8b39b9ce 100644 --- a/src/builtin_wait.cpp +++ b/src/builtin_wait.cpp @@ -1,9 +1,12 @@ // Functions for waiting for processes completed. +#include "builtin_wait.h" + +#include + #include #include #include "builtin.h" -#include "builtin_wait.h" #include "common.h" #include "parser.h" #include "proc.h" @@ -11,8 +14,6 @@ #include "wgetopt.h" #include "wutil.h" -#include - /// Return the job id to which the process with pid belongs. /// If a specified process has already finished but the job hasn't, parser_t::job_get_from_pid() /// doesn't work properly, so use this function in wait command. diff --git a/src/builtin_wait.h b/src/builtin_wait.h index a57e7fb40..d0444c34b 100644 --- a/src/builtin_wait.h +++ b/src/builtin_wait.h @@ -3,6 +3,7 @@ #define FISH_BUILTIN_WAIT_H class parser_t; +struct io_streams_t; int builtin_wait(parser_t &parser, io_streams_t &streams, wchar_t **argv); #endif diff --git a/src/color.cpp b/src/color.cpp index e27545b92..30e1dfdfb 100644 --- a/src/color.cpp +++ b/src/color.cpp @@ -1,12 +1,14 @@ // Color class implementation. #include "config.h" // IWYU pragma: keep +#include "color.h" + #include #include #include + #include // IWYU pragma: keep -#include "color.h" #include "common.h" #include "fallback.h" // IWYU pragma: keep diff --git a/src/color.h b/src/color.h index 02d98e80a..a53d79bf2 100644 --- a/src/color.h +++ b/src/color.h @@ -3,7 +3,6 @@ #define FISH_COLOR_H #include - #include #include "common.h" diff --git a/src/common.cpp b/src/common.cpp index 85c8b2ce9..fbb81a7c0 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -19,6 +19,7 @@ #include #include #include + #include #include #ifdef HAVE_EXECINFO_H diff --git a/src/complete.cpp b/src/complete.cpp index ce95bb211..4d78260fc 100644 --- a/src/complete.cpp +++ b/src/complete.cpp @@ -5,15 +5,17 @@ /// #include "config.h" // IWYU pragma: keep +#include "complete.h" + #include #include #include #include -#include #include #include #include +#include #include #include #include @@ -29,7 +31,6 @@ #include "autoload.h" #include "builtin.h" #include "common.h" -#include "complete.h" #include "env.h" #include "exec.h" #include "expand.h" diff --git a/src/complete.h b/src/complete.h index 90ad580d4..cdf49240a 100644 --- a/src/complete.h +++ b/src/complete.h @@ -11,7 +11,6 @@ #include #include "common.h" - #include "enum_set.h" struct completion_mode_t { diff --git a/src/env.cpp b/src/env.cpp index 8f6b21b06..7bf5f3523 100644 --- a/src/env.cpp +++ b/src/env.cpp @@ -1,6 +1,8 @@ // Functions for setting and getting environment variables. #include "config.h" // IWYU pragma: keep +#include "env.h" + #include #include #include @@ -18,7 +20,6 @@ #include "builtin_bind.h" #include "common.h" -#include "env.h" #include "env_dispatch.h" #include "env_universal_common.h" #include "event.h" diff --git a/src/env_dispatch.cpp b/src/env_dispatch.cpp index 1fec8e7c8..424b44bad 100644 --- a/src/env_dispatch.cpp +++ b/src/env_dispatch.cpp @@ -8,6 +8,7 @@ #include #include #include + #include #include @@ -25,6 +26,7 @@ #endif #include + #include #include #include diff --git a/src/env_dispatch.h b/src/env_dispatch.h index 6105d1a8e..4ff5d1b3f 100644 --- a/src/env_dispatch.h +++ b/src/env_dispatch.h @@ -4,11 +4,11 @@ #include "config.h" // IWYU pragma: keep +#include + #include "common.h" #include "env_universal_common.h" -#include - /// Initialize variable dispatch. class environment_t; void env_dispatch_init(const environment_t &vars); diff --git a/src/env_universal_common.cpp b/src/env_universal_common.cpp index b9bdb20bf..122a0a16c 100644 --- a/src/env_universal_common.cpp +++ b/src/env_universal_common.cpp @@ -17,6 +17,7 @@ #include #include #include + #include #ifdef __CYGWIN__ #include @@ -28,9 +29,9 @@ #include // IWYU pragma: keep #include // IWYU pragma: keep #include -#include #include +#include #include #include #include diff --git a/src/event.cpp b/src/event.cpp index cda927517..5e760f139 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -1,6 +1,8 @@ // Functions for handling event triggers. #include "config.h" // IWYU pragma: keep +#include "event.h" + #include #include #include @@ -13,7 +15,6 @@ #include #include "common.h" -#include "event.h" #include "fallback.h" // IWYU pragma: keep #include "input_common.h" #include "io.h" diff --git a/src/exec.cpp b/src/exec.cpp index 48c39c7ea..2a9957e33 100644 --- a/src/exec.cpp +++ b/src/exec.cpp @@ -16,13 +16,13 @@ #include #include #include -#include -#include #include +#include #include #include #include +#include #include #include #include diff --git a/src/expand.cpp b/src/expand.cpp index 5f0b362c6..c363bcbba 100644 --- a/src/expand.cpp +++ b/src/expand.cpp @@ -9,6 +9,7 @@ #include #include #include + #include #include diff --git a/src/fallback.cpp b/src/fallback.cpp index 7eaaa90dd..fc5818884 100644 --- a/src/fallback.cpp +++ b/src/fallback.cpp @@ -18,6 +18,7 @@ #include // IWYU pragma: keep #include #include + #include #include #include @@ -37,7 +38,8 @@ #include #endif #include // IWYU pragma: keep -#include // IWYU pragma: keep + +#include // IWYU pragma: keep #include "common.h" // IWYU pragma: keep #include "fallback.h" // IWYU pragma: keep diff --git a/src/fallback.h b/src/fallback.h index c84987d61..855bf4616 100644 --- a/src/fallback.h +++ b/src/fallback.h @@ -92,8 +92,8 @@ wchar_t *wcsdup(const wchar_t *in); int wcscasecmp(const wchar_t *a, const wchar_t *b); int wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n); wchar_t *wcsndup(const wchar_t *in, size_t c); -#endif // clang::weak_import -#else // __APPLE__ +#endif // clang::weak_import +#else // __APPLE__ /// These functions are missing from Solaris 10, and only accessible from /// Solaris 11 in the std:: namespace. diff --git a/src/fish.cpp b/src/fish.cpp index 3db9d58f2..959ed36d7 100644 --- a/src/fish.cpp +++ b/src/fish.cpp @@ -30,9 +30,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA #include #include #include + #include #include - #include #include #include diff --git a/src/fish_indent.cpp b/src/fish_indent.cpp index 0d77e26ae..7e228807e 100644 --- a/src/fish_indent.cpp +++ b/src/fish_indent.cpp @@ -24,8 +24,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA #include #include #include -#include +#include #include #include #include diff --git a/src/fish_key_reader.cpp b/src/fish_key_reader.cpp index 02da91547..1b49de34c 100644 --- a/src/fish_key_reader.cpp +++ b/src/fish_key_reader.cpp @@ -16,9 +16,9 @@ #include #include #include + #include #include - #include #include #include diff --git a/src/fish_tests.cpp b/src/fish_tests.cpp index 6c7f0565c..e5837704e 100644 --- a/src/fish_tests.cpp +++ b/src/fish_tests.cpp @@ -24,18 +24,18 @@ #include #include #include -#include -#include -#include #include #include #include #include +#include +#include #include #include #include #include +#include #include #include diff --git a/src/flog.cpp b/src/flog.cpp index 89ef71bc0..ce25a1b7a 100644 --- a/src/flog.cpp +++ b/src/flog.cpp @@ -2,15 +2,15 @@ #include "config.h" #include "flog.h" -#include "global_safety.h" + +#include #include "common.h" #include "enum_set.h" +#include "global_safety.h" #include "parse_util.h" #include "wildcard.h" -#include - namespace flog_details { // Note we are relying on the order of global initialization within this file. diff --git a/src/flog.h b/src/flog.h index de334a388..4f417e3c5 100644 --- a/src/flog.h +++ b/src/flog.h @@ -4,13 +4,14 @@ #include "config.h" // IWYU pragma: keep -#include "global_safety.h" - #include + #include #include #include +#include "global_safety.h" + using wcstring = std::wstring; using wcstring_list_t = std::vector; diff --git a/src/function.cpp b/src/function.cpp index 60bb58e1f..0e220eee2 100644 --- a/src/function.cpp +++ b/src/function.cpp @@ -8,9 +8,9 @@ #include #include #include -#include #include +#include #include #include #include diff --git a/src/future_feature_flags.cpp b/src/future_feature_flags.cpp index b2831a30f..fd90cd5eb 100644 --- a/src/future_feature_flags.cpp +++ b/src/future_feature_flags.cpp @@ -1,8 +1,9 @@ #include "config.h" // IWYU pragma: keep -#include #include "future_feature_flags.h" +#include + /// The set of features applying to this instance. static features_t global_features; diff --git a/src/future_feature_flags.h b/src/future_feature_flags.h index 822c127ee..bfc393160 100644 --- a/src/future_feature_flags.h +++ b/src/future_feature_flags.h @@ -3,6 +3,7 @@ #define FISH_FUTURE_FEATURE_FLAGS_H #include + #include #include "common.h" diff --git a/src/global_safety.h b/src/global_safety.h index 4121d6190..b0a74320c 100644 --- a/src/global_safety.h +++ b/src/global_safety.h @@ -4,11 +4,11 @@ #include "config.h" // IWYU pragma: keep -#include "common.h" - #include #include +#include "common.h" + // fish is multithreaded. Global (which includes function and file-level statics) when used naively // may therefore lead to data races. Use the following types to characterize and enforce correct // access patterns. diff --git a/src/highlight.cpp b/src/highlight.cpp index dbb4bd293..73e7b424c 100644 --- a/src/highlight.cpp +++ b/src/highlight.cpp @@ -6,9 +6,9 @@ #include #include #include -#include #include +#include #include #include #include diff --git a/src/history.cpp b/src/history.cpp index ea2bb5c1c..766fce720 100644 --- a/src/history.cpp +++ b/src/history.cpp @@ -8,6 +8,7 @@ #include #include #include + #include #include // We need the sys/file.h for the flock() declaration on Linux but not OS X. diff --git a/src/history_file.cpp b/src/history_file.cpp index 5fcba1abb..43a7476bc 100644 --- a/src/history_file.cpp +++ b/src/history_file.cpp @@ -1,10 +1,11 @@ #include "config.h" -#include "history.h" #include "history_file.h" #include +#include "history.h" + // Some forward declarations. static history_item_t decode_item_fish_2_0(const char *base, size_t len); static history_item_t decode_item_fish_1_x(const char *begin, size_t length); diff --git a/src/history_file.h b/src/history_file.h index a86fecf97..8bd209180 100644 --- a/src/history_file.h +++ b/src/history_file.h @@ -3,12 +3,12 @@ #include "config.h" -#include "maybe.h" +#include #include #include -#include +#include "maybe.h" class history_item_t; diff --git a/src/input.cpp b/src/input.cpp index e4583980a..afacf24eb 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -3,6 +3,7 @@ #include #include + #include #if HAVE_TERM_H #include diff --git a/src/input_common.cpp b/src/input_common.cpp index b7bd37f10..2dc4c203e 100644 --- a/src/input_common.cpp +++ b/src/input_common.cpp @@ -3,6 +3,7 @@ #include #include + #include #ifdef HAVE_SYS_SELECT_H #include @@ -11,8 +12,8 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/input_common.h b/src/input_common.h index 72aca87c7..9d3ecd6ca 100644 --- a/src/input_common.h +++ b/src/input_common.h @@ -2,12 +2,13 @@ #ifndef INPUT_COMMON_H #define INPUT_COMMON_H +#include + +#include + #include "common.h" #include "maybe.h" -#include -#include - enum class readline_cmd_t { beginning_of_line, end_of_line, diff --git a/src/intern.cpp b/src/intern.cpp index 1073a6b07..e609dd3b6 100644 --- a/src/intern.cpp +++ b/src/intern.cpp @@ -1,16 +1,17 @@ // Library for pooling common strings. #include "config.h" // IWYU pragma: keep +#include "intern.h" + #include -#include #include +#include #include #include #include "common.h" #include "fallback.h" // IWYU pragma: keep -#include "intern.h" bool string_less_than_string(const wchar_t *a, const wchar_t *b) { return std::wcscmp(a, b) < 0; } diff --git a/src/io.cpp b/src/io.cpp index 54ead1392..129044239 100644 --- a/src/io.cpp +++ b/src/io.cpp @@ -1,17 +1,19 @@ // Utilities for io redirection. #include "config.h" // IWYU pragma: keep +#include "io.h" + #include #include #include #include + #include #include #include "common.h" #include "exec.h" #include "fallback.h" // IWYU pragma: keep -#include "io.h" #include "iothread.h" #include "redirection.h" #include "wutil.h" // IWYU pragma: keep diff --git a/src/iothread.cpp b/src/iothread.cpp index f2ed12d52..6d83e9897 100644 --- a/src/iothread.cpp +++ b/src/iothread.cpp @@ -1,5 +1,7 @@ #include "config.h" // IWYU pragma: keep +#include "iothread.h" + #include #include #include @@ -8,16 +10,15 @@ #include #include #include -#include -#include +#include #include +#include #include #include "common.h" #include "flog.h" #include "global_safety.h" -#include "iothread.h" #include "wutil.h" #ifdef _POSIX_THREAD_THREADS_MAX diff --git a/src/iothread.h b/src/iothread.h index 70a5a2c58..c64576d24 100644 --- a/src/iothread.h +++ b/src/iothread.h @@ -3,6 +3,7 @@ #define FISH_IOTHREAD_H #include + #include #include diff --git a/src/kill.cpp b/src/kill.cpp index 89fa8124c..e13626595 100644 --- a/src/kill.cpp +++ b/src/kill.cpp @@ -5,6 +5,7 @@ #include "config.h" // IWYU pragma: keep #include + #include #include #include diff --git a/src/lru.h b/src/lru.h index aa0237d68..68aa591ed 100644 --- a/src/lru.h +++ b/src/lru.h @@ -3,7 +3,6 @@ #define FISH_LRU_H #include - #include #include "common.h" diff --git a/src/output.cpp b/src/output.cpp index 2320a8ae6..63d40e972 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -3,6 +3,7 @@ #include #include + #include #if HAVE_CURSES_H #include @@ -17,8 +18,8 @@ #include #endif #include -#include +#include #include #include #include diff --git a/src/pager.cpp b/src/pager.cpp index c39a4a4a6..233730663 100644 --- a/src/pager.cpp +++ b/src/pager.cpp @@ -3,9 +3,9 @@ // IWYU pragma: no_include #include #include -#include #include +#include #include #include #include diff --git a/src/parse_constants.h b/src/parse_constants.h index b9145b2ce..af171a1ba 100644 --- a/src/parse_constants.h +++ b/src/parse_constants.h @@ -2,9 +2,10 @@ #ifndef FISH_PARSE_CONSTANTS_H #define FISH_PARSE_CONSTANTS_H -#include "common.h" #include "config.h" +#include "common.h" + #define PARSE_ASSERT(a) assert(a) #define PARSER_DIE() \ do { \ diff --git a/src/parse_execution.cpp b/src/parse_execution.cpp index d0df9a682..491df34b6 100644 --- a/src/parse_execution.cpp +++ b/src/parse_execution.cpp @@ -8,6 +8,8 @@ // for the execution to finish to see them. #include "config.h" // IWYU pragma: keep +#include "parse_execution.h" + #include #include #include @@ -15,9 +17,9 @@ #include #include #include -#include #include +#include #include #include #include @@ -36,7 +38,6 @@ #include "io.h" #include "maybe.h" #include "parse_constants.h" -#include "parse_execution.h" #include "parse_util.h" #include "parser.h" #include "path.h" @@ -488,7 +489,8 @@ parse_execution_result_t parse_execution_context_t::run_switch_statement( return result; } - const wcstring &switch_value_expanded = switch_values_expanded.size() == 1 ? switch_values_expanded.at(0).completion : L""; + const wcstring &switch_value_expanded = + switch_values_expanded.size() == 1 ? switch_values_expanded.at(0).completion : L""; block_t *sb = parser->push_block(block_t::switch_block()); diff --git a/src/parse_grammar.h b/src/parse_grammar.h index be5c23512..f760a4021 100644 --- a/src/parse_grammar.h +++ b/src/parse_grammar.h @@ -5,6 +5,7 @@ #include #include #include + #include "parse_constants.h" #include "tokenizer.h" diff --git a/src/parse_productions.cpp b/src/parse_productions.cpp index 84745ff10..36882a168 100644 --- a/src/parse_productions.cpp +++ b/src/parse_productions.cpp @@ -1,12 +1,13 @@ #include "config.h" // IWYU pragma: keep +#include "parse_productions.h" + #include #include "common.h" #include "flog.h" #include "parse_constants.h" #include "parse_grammar.h" -#include "parse_productions.h" #include "parse_tree.h" using namespace parse_productions; diff --git a/src/parse_tree.cpp b/src/parse_tree.cpp index b2f4eec6c..d4e261416 100644 --- a/src/parse_tree.cpp +++ b/src/parse_tree.cpp @@ -1,12 +1,14 @@ // Programmatic representation of fish code. #include "config.h" // IWYU pragma: keep +#include "parse_tree.h" + #include #include #include -#include #include +#include #include #include #include @@ -16,7 +18,6 @@ #include "flog.h" #include "parse_constants.h" #include "parse_productions.h" -#include "parse_tree.h" #include "proc.h" #include "tnode.h" #include "tokenizer.h" diff --git a/src/parse_util.cpp b/src/parse_util.cpp index e2d730717..388baae62 100644 --- a/src/parse_util.cpp +++ b/src/parse_util.cpp @@ -4,10 +4,12 @@ // that are somehow related to parsing the code. #include "config.h" // IWYU pragma: keep +#include "parse_util.h" + #include #include -#include +#include #include #include #include @@ -18,7 +20,6 @@ #include "fallback.h" // IWYU pragma: keep #include "future_feature_flags.h" #include "parse_constants.h" -#include "parse_util.h" #include "parser.h" #include "tnode.h" #include "tokenizer.h" diff --git a/src/parser.cpp b/src/parser.cpp index bfaf9a003..2c48686f1 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -1,11 +1,13 @@ // The fish parser. Contains functions for parsing and evaluating code. #include "config.h" // IWYU pragma: keep +#include "parser.h" + #include #include -#include #include +#include #include #include @@ -19,7 +21,6 @@ #include "parse_constants.h" #include "parse_execution.h" #include "parse_util.h" -#include "parser.h" #include "proc.h" #include "reader.h" #include "sanity.h" diff --git a/src/parser_keywords.cpp b/src/parser_keywords.cpp index 15c232461..80003be71 100644 --- a/src/parser_keywords.cpp +++ b/src/parser_keywords.cpp @@ -1,12 +1,13 @@ // Functions having to do with parser keywords, like testing if a function is a block command. #include "config.h" // IWYU pragma: keep +#include "parser_keywords.h" + #include #include #include "common.h" #include "fallback.h" // IWYU pragma: keep -#include "parser_keywords.h" typedef std::unordered_set string_set_t; diff --git a/src/path.cpp b/src/path.cpp index 7634fd246..802fccf80 100644 --- a/src/path.cpp +++ b/src/path.cpp @@ -3,12 +3,14 @@ // issues. #include "config.h" // IWYU pragma: keep +#include "path.h" + #include #include #include + #include #include - #include #include #include @@ -19,7 +21,6 @@ #include "expand.h" #include "fallback.h" // IWYU pragma: keep #include "flog.h" -#include "path.h" #include "wutil.h" // IWYU pragma: keep /// Unexpected error in path_get_path(). diff --git a/src/postfork.cpp b/src/postfork.cpp index 0d85275bc..0fe4458b1 100644 --- a/src/postfork.cpp +++ b/src/postfork.cpp @@ -6,6 +6,7 @@ #include #include #include + #include #include #if FISH_USE_POSIX_SPAWN diff --git a/src/print_help.cpp b/src/print_help.cpp index db8ed074b..0b2fa3c71 100644 --- a/src/print_help.cpp +++ b/src/print_help.cpp @@ -1,12 +1,14 @@ // Print help message for the specified command. #include "config.h" // IWYU pragma: keep +#include "print_help.h" + #include #include + #include #include "common.h" -#include "print_help.h" #define CMD_LEN 1024 diff --git a/src/proc.cpp b/src/proc.cpp index 7dafcefb4..d6f216c8b 100644 --- a/src/proc.cpp +++ b/src/proc.cpp @@ -11,6 +11,7 @@ #include #include #include + #include #include diff --git a/src/reader.cpp b/src/reader.cpp index 2cb60c977..5377e0647 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -23,6 +23,7 @@ #include #include #include + #include #ifdef HAVE_SYS_SELECT_H #include @@ -33,11 +34,11 @@ #include #include #include -#include #include #include #include +#include #include #include #include @@ -1201,8 +1202,9 @@ wcstring completion_apply_to_command_line(const wcstring &val, complete_flags_t // Find the last quote in the token to complete. By parsing only the string inside any // command substitution, we prevent the tokenizer from treating the entire command // substitution as one token. - parse_util_get_parameter_info(command_line.substr(cmdsub_offset, (cmdsub_end - cmdsub_begin)), - cursor_pos - cmdsub_offset, "e, NULL, NULL); + parse_util_get_parameter_info( + command_line.substr(cmdsub_offset, (cmdsub_end - cmdsub_begin)), + cursor_pos - cmdsub_offset, "e, NULL, NULL); // If the token is reported as unquoted, but ends with a (unescaped) quote, and we can // modify the command line, then delete the trailing quote so that we can insert within diff --git a/src/redirection.cpp b/src/redirection.cpp index d442aa2e8..6a09db081 100644 --- a/src/redirection.cpp +++ b/src/redirection.cpp @@ -1,10 +1,11 @@ #include "config.h" // IWYU pragma: keep #include "redirection.h" -#include "wutil.h" #include +#include "wutil.h" + #define NOCLOB_ERROR _(L"The file '%ls' already exists") #define FILE_ERROR _(L"An error occurred while redirecting file '%ls'") diff --git a/src/redirection.h b/src/redirection.h index 73748fc0a..9d5861f1d 100644 --- a/src/redirection.h +++ b/src/redirection.h @@ -1,12 +1,12 @@ #ifndef FISH_REDIRECTION_H #define FISH_REDIRECTION_H +#include + #include "common.h" #include "io.h" #include "maybe.h" -#include - /// This file supports "applying" redirections. /// A class representing a sequence of basic redirections. diff --git a/src/sanity.cpp b/src/sanity.cpp index f00dd143e..677214384 100644 --- a/src/sanity.cpp +++ b/src/sanity.cpp @@ -1,6 +1,8 @@ // Functions for performing sanity checks on the program state. #include "config.h" // IWYU pragma: keep +#include "sanity.h" + #include #include "common.h" @@ -11,7 +13,6 @@ #include "kill.h" #include "proc.h" #include "reader.h" -#include "sanity.h" /// Status from earlier sanity checks. static relaxed_atomic_bool_t insane{false}; diff --git a/src/screen.cpp b/src/screen.cpp index 0568d4956..b9968f653 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -13,6 +13,7 @@ #include #include #include + #include #include @@ -642,8 +643,7 @@ static void s_update(screen_t *scr, const wcstring &left_prompt, const wcstring // Determine how many lines have stuff on them; we need to clear lines with stuff that we don't // want. const size_t lines_with_stuff = std::max(actual_lines_before_reset, scr->actual.line_count()); - if (scr->desired.line_count() < lines_with_stuff) - need_clear_screen = true; + if (scr->desired.line_count() < lines_with_stuff) need_clear_screen = true; if (left_prompt != scr->actual_left_prompt) { s_move(scr, 0, 0); @@ -669,12 +669,11 @@ static void s_update(screen_t *scr, const wcstring &left_prompt, const wcstring const size_t shared_prefix = line_shared_prefix(o_line, s_line); size_t skip_prefix = shared_prefix; if (shared_prefix < o_line.indentation) { - if (o_line.indentation > s_line.indentation - && !has_cleared_screen && clr_eol && clr_eos) { + if (o_line.indentation > s_line.indentation && !has_cleared_screen && clr_eol && + clr_eos) { s_set_color(scr, vars, highlight_spec_t{}); s_move(scr, 0, (int)i); - s_write_mbs(scr, - should_clear_screen_this_line ? clr_eos : clr_eol); + s_write_mbs(scr, should_clear_screen_this_line ? clr_eos : clr_eol); has_cleared_screen = should_clear_screen_this_line; has_cleared_line = true; } @@ -685,8 +684,9 @@ static void s_update(screen_t *scr, const wcstring &left_prompt, const wcstring // over the shared prefix of what we want to output now, and what we output before, to // avoid repeatedly outputting it. if (skip_prefix > 0) { - size_t skip_width = shared_prefix < skip_prefix ? skip_prefix - : fish_wcswidth(&o_line.text.at(0), shared_prefix); + size_t skip_width = shared_prefix < skip_prefix + ? skip_prefix + : fish_wcswidth(&o_line.text.at(0), shared_prefix); if (skip_width > skip_remaining) skip_remaining = skip_width; } @@ -722,21 +722,20 @@ static void s_update(screen_t *scr, const wcstring &left_prompt, const wcstring } // Now actually output stuff. - for (; ; j++) { + for (;; j++) { bool done = j >= o_line.size(); // Clear the screen if we have not done so yet. // If we are about to output into the last column, clear the screen first. If we clear // the screen after we output into the last column, it can erase the last character due // to the sticky right cursor. If we clear the screen too early, we can defeat soft // wrapping. - if (should_clear_screen_this_line && !has_cleared_screen - && (done || j + 1 == (size_t)screen_width)) { + if (should_clear_screen_this_line && !has_cleared_screen && + (done || j + 1 == (size_t)screen_width)) { s_move(scr, current_width, (int)i); s_write_mbs(scr, clr_eos); has_cleared_screen = true; } - if (done) - break; + if (done) break; perform_any_impending_soft_wrap(scr, current_width, (int)i); s_move(scr, current_width, (int)i); diff --git a/src/screen.h b/src/screen.h index 907bc7924..b5c301e4d 100644 --- a/src/screen.h +++ b/src/screen.h @@ -12,10 +12,10 @@ #include #include -#include #include #include +#include #include #include #include diff --git a/src/tinyexpr.cpp b/src/tinyexpr.cpp index 884c30f6e..d9d1cea72 100644 --- a/src/tinyexpr.cpp +++ b/src/tinyexpr.cpp @@ -24,14 +24,15 @@ // This version has been altered and ported to C++ for inclusion in fish. #include "tinyexpr.h" + #include #include #include #include #include -#include #include +#include #include #include @@ -263,7 +264,7 @@ void next_token(state *s) { } } else { /* Look for an operator or special character. */ - switch (s->next++ [0]) { + switch (s->next++[0]) { // The "te_fun2" casts are necessary to pick the right overload. case '+': s->type = TOK_INFIX; diff --git a/src/tokenizer.cpp b/src/tokenizer.cpp index b33f0ba3d..14287bcf2 100644 --- a/src/tokenizer.cpp +++ b/src/tokenizer.cpp @@ -2,19 +2,20 @@ // extended to support marks, tokenizing multiple strings and disposing of unused string segments. #include "config.h" // IWYU pragma: keep +#include "tokenizer.h" + #include #include #include #include -#include +#include #include #include #include "common.h" #include "fallback.h" // IWYU pragma: keep #include "future_feature_flags.h" -#include "tokenizer.h" #include "wutil.h" // IWYU pragma: keep // _(s) is already wgettext(s).c_str(), so let's not convert back to wcstring diff --git a/src/topic_monitor.cpp b/src/topic_monitor.cpp index f1fe05a6c..7f5327735 100644 --- a/src/topic_monitor.cpp +++ b/src/topic_monitor.cpp @@ -1,13 +1,14 @@ #include "config.h" // IWYU pragma: keep -#include "flog.h" -#include "iothread.h" #include "topic_monitor.h" -#include "wutil.h" #include #include +#include "flog.h" +#include "iothread.h" +#include "wutil.h" + // Whoof. Thread Sanitizer swallows signals and replays them at its leisure, at the point where // instrumented code makes certain blocking calls. But tsan cannot interrupt a signal call, so // if we're blocked in read() (like the topic monitor wants to be!), we'll never receive SIGCHLD diff --git a/src/topic_monitor.h b/src/topic_monitor.h index 4bd86f7f0..c0673c712 100644 --- a/src/topic_monitor.h +++ b/src/topic_monitor.h @@ -1,10 +1,6 @@ #ifndef FISH_TOPIC_MONITOR_H #define FISH_TOPIC_MONITOR_H -#include "common.h" -#include "enum_set.h" -#include "io.h" - #include #include #include @@ -12,6 +8,10 @@ #include #include +#include "common.h" +#include "enum_set.h" +#include "io.h" + /** Topic monitoring support. Topics are conceptually "a thing that can happen." For example, delivery of a SIGINT, a child process exits, etc. It is possible to post to a topic, which means that that thing happened. diff --git a/src/utf8.cpp b/src/utf8.cpp index 94fe6b1cd..7bd9351ae 100644 --- a/src/utf8.cpp +++ b/src/utf8.cpp @@ -15,6 +15,8 @@ */ #include "config.h" // IWYU pragma: keep +#include "utf8.h" + #include // IWYU pragma: keep #include @@ -22,7 +24,6 @@ #include #include "common.h" -#include "utf8.h" #define _NXT 0x80 #define _SEQ2 0xc0 diff --git a/src/util.cpp b/src/util.cpp index 3503d7bab..74c03d5c8 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1,16 +1,18 @@ // Generic utilities library. #include "config.h" // IWYU pragma: keep +#include "util.h" + #include #include #include #include + #include #include "common.h" #include "fallback.h" // IWYU pragma: keep -#include "util.h" -#include "wutil.h" // IWYU pragma: keep +#include "wutil.h" // IWYU pragma: keep // Compare the strings to see if they begin with an integer that can be compared and return the // result of that comparison. diff --git a/src/wcstringutil.cpp b/src/wcstringutil.cpp index 3691f79e5..f081214f2 100644 --- a/src/wcstringutil.cpp +++ b/src/wcstringutil.cpp @@ -1,11 +1,12 @@ // Helper functions for working with wcstring. #include "config.h" // IWYU pragma: keep -#include "common.h" #include "wcstringutil.h" #include +#include "common.h" + typedef wcstring::size_type size_type; wcstring_range wcstring_tok(wcstring &str, const wcstring &needle, wcstring_range last) { diff --git a/src/wgetopt.cpp b/src/wgetopt.cpp index 332c210b1..df24fb64f 100644 --- a/src/wgetopt.cpp +++ b/src/wgetopt.cpp @@ -39,6 +39,7 @@ #include "config.h" // IWYU pragma: keep #include + #include #include diff --git a/src/wildcard.cpp b/src/wildcard.cpp index 53e222a8c..23ec03ff8 100644 --- a/src/wildcard.cpp +++ b/src/wildcard.cpp @@ -2,14 +2,16 @@ // provides recursive wildcards using **. #include "config.h" // IWYU pragma: keep +#include "wildcard.h" + #include #include #include #include #include #include -#include +#include #include #include #include @@ -21,7 +23,6 @@ #include "fallback.h" // IWYU pragma: keep #include "future_feature_flags.h" #include "reader.h" -#include "wildcard.h" #include "wutil.h" // IWYU pragma: keep /// Description for generic executable. diff --git a/src/wutil.cpp b/src/wutil.cpp index 1f448ba14..808d3f0d6 100644 --- a/src/wutil.cpp +++ b/src/wutil.cpp @@ -10,6 +10,7 @@ #include #include #include + #include #if defined(__linux__) #include @@ -19,9 +20,9 @@ #include #include #include -#include #include +#include #include #include diff --git a/src/wutil.h b/src/wutil.h index e3c1837ca..e31d90d30 100644 --- a/src/wutil.h +++ b/src/wutil.h @@ -9,6 +9,7 @@ #include #include #include + #include #ifdef HAVE_XLOCALE_H