clang-format all C++ files

This mostly re-sorts headers that got desorted after the IWYU
application in 14d2a6d8ff.
This commit is contained in:
ridiculousfish 2022-08-21 14:51:33 -07:00
parent c260c1259e
commit 3eae0a9b6a
62 changed files with 134 additions and 132 deletions

View File

@ -2,8 +2,8 @@
#include "ast.h"
#include <array>
#include <algorithm>
#include <array>
#include <cstdarg>
#include <cstdlib>
#include <string>
@ -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 {

View File

@ -3,18 +3,19 @@
#include "bg.h"
#include <sys/types.h>
#include <cerrno>
#include <deque>
#include <memory>
#include <sys/types.h>
#include <vector>
#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

View File

@ -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 {

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -10,7 +10,7 @@ class parser_t;
struct io_streams_t;
namespace ast {
struct block_statement_t;
struct block_statement_t;
}
maybe_t<int> builtin_function(parser_t &parser, io_streams_t &streams,

View File

@ -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"

View File

@ -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"

View File

@ -3,15 +3,15 @@
#include "path.h"
#include <stdint.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <algorithm>
#include <climits>
#include <ctime>
#include <cstdarg>
#include <ctime>
#include <cwchar>
#include <map>
#include <string>

View File

@ -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);

View File

@ -8,7 +8,7 @@
#include <cstdlib>
#if HAVE_CURSES_H
#include <curses.h> // IWYU pragma: keep
#include <curses.h> // IWYU pragma: keep
#elif HAVE_NCURSES_H
#include <ncurses.h>
#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"

View File

@ -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"

View File

@ -4,10 +4,10 @@
#include "color.h"
#include <algorithm>
#include <iterator>
#include <cstdint>
#include <cstdlib>
#include <cwchar> // IWYU pragma: keep
#include <iterator>
#include "common.h"
#include "fallback.h" // IWYU pragma: keep

View File

@ -2,9 +2,9 @@
#ifndef FISH_COLOR_H
#define FISH_COLOR_H
#include <cstdint>
#include <cstring>
#include <string>
#include <cstdint>
#include "common.h"

View File

@ -27,8 +27,8 @@
#include <algorithm>
#include <csignal>
#include <cstring>
#include <cstdlib>
#include <cstring>
#include <cwchar>
#include <memory>
@ -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 <sys/sysctl.h> // IWYU pragma: keep
#include <sys/sysctl.h> // IWYU pragma: keep
#endif
#if defined(__APPLE__)
#include <mach-o/dyld.h> // IWYU pragma: keep
#include <mach-o/dyld.h> // IWYU pragma: keep
#endif
struct termios shell_modes;

View File

@ -11,7 +11,6 @@
#include <wctype.h>
#include <algorithm>
#include <cstddef>
#include <cwchar>
#include <forward_list>

View File

@ -7,8 +7,8 @@
#include "config.h" // IWYU pragma: keep
#include <cstdint>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <utility>
#include <vector>

View File

@ -9,8 +9,8 @@
#include <memory>
#include <string>
#include <unordered_map>
#include <vector>
#include <utility>
#include <vector>
#include "common.h"
#include "maybe.h"

View File

@ -12,11 +12,11 @@
#include <cwchar>
#if HAVE_CURSES_H
#include <curses.h> // IWYU pragma: keep
#include <curses.h> // IWYU pragma: keep
#elif HAVE_NCURSES_H
#include <ncurses.h> // IWYU pragma: keep
#include <ncurses.h> // IWYU pragma: keep
#elif HAVE_NCURSES_CURSES_H
#include <ncurses/curses.h> // IWYU pragma: keep
#include <ncurses/curses.h> // IWYU pragma: keep
#endif
#if HAVE_TERM_H
#include <term.h>
@ -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<const var_dispatch_table_t> 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);

View File

@ -25,8 +25,8 @@
#include <sys/types.h> // IWYU pragma: keep
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cstring>
#include <cwchar>
#include <functional>
#include <string>

View File

@ -15,16 +15,16 @@
#include <unistd.h>
#include <algorithm>
#include <cstring>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <initializer_list>
#include <map>
#include <memory>
#include <string>
#include <vector>
#include <utility>
#include <vector>
#include "ast.h"
#include "builtin.h"

View File

@ -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 <errno.h>
#include <pwd.h>
@ -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;

View File

@ -20,11 +20,11 @@
#endif
#if defined(TPARM_SOLARIS_KLUDGE)
#if HAVE_CURSES_H
#include <curses.h> // IWYU pragma: keep
#include <curses.h> // IWYU pragma: keep
#elif HAVE_NCURSES_H
#include <ncurses.h> // IWYU pragma: keep
#elif HAVE_NCURSES_CURSES_H
#include <ncurses/curses.h> // IWYU pragma: keep
#include <ncurses/curses.h> // IWYU pragma: keep
#endif
#if HAVE_TERM_H
#include <term.h> // IWYU pragma: keep

View File

@ -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 <poll.h> // IWYU pragma: keep
#include <sys/select.h> // IWYU pragma: keep
#include <poll.h> // IWYU pragma: keep
#include <sys/select.h> // IWYU pragma: keep
#include <sys/types.h>
#include <cstdint>

View File

@ -27,8 +27,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#include <algorithm>
#include <cstdint>
#include <cstring>
#include <cwctype>
#include <cwchar>
#include <cwctype>
#include <memory>
#include <string>
#include <type_traits>

View File

@ -19,8 +19,8 @@
#include <algorithm>
#include <array>
#include <atomic>
#include <chrono>
#include <cerrno>
#include <chrono>
#include <clocale>
#include <cmath>
#include <cstring>
@ -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"

View File

@ -1,10 +1,10 @@
/// fish logging
#include "config.h" // IWYU pragma: keep
#include "config.h" // IWYU pragma: keep
#include "flog.h"
#include <unistd.h>
#include <stdarg.h>
#include <unistd.h>
#include <algorithm>
#include <cstring>

View File

@ -4,8 +4,9 @@
//
#include "config.h" // IWYU pragma: keep
#include <algorithm>
#include "function.h"
#include <algorithm>
#include <cstdint>
#include <cwchar>
#include <map>
@ -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"

View File

@ -1,6 +1,8 @@
// Functions for syntax highlighting.
#include "config.h" // IWYU pragma: keep
#include "highlight.h"
#include <dirent.h>
#include <errno.h>
#include <sys/stat.h>
@ -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"

View File

@ -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"

View File

@ -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 <unistd.h>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cwchar>
#include <utility>

View File

@ -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 <sys/mman.h>

View File

@ -4,7 +4,7 @@
#include <errno.h>
#if HAVE_TERM_H
#include <curses.h> // IWYU pragma: keep
#include <curses.h> // IWYU pragma: keep
#include <term.h>
#elif HAVE_NCURSES_TERM_H
#include <ncurses/term.h>

View File

@ -11,8 +11,8 @@
#include <algorithm>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <cstring>
#include <cwchar>
#include <deque>
#include <utility>

View File

@ -7,12 +7,12 @@
#include <stdio.h>
#include <atomic>
#include <condition_variable> // IWYU pragma: keep
#include <chrono>
#include <condition_variable> // IWYU pragma: keep
#include <functional>
#include <mutex>
#include <vector>
#include <queue>
#include <vector>
#include "common.h"
#include "fallback.h"

View File

@ -1,4 +1,4 @@
#include "config.h" // IWYU pragma: keep
#include "config.h" // IWYU pragma: keep
#include "job_group.h"

View File

@ -4,7 +4,6 @@
#include <termios.h>
#include <memory>
#include "common.h"

View File

@ -1,9 +1,10 @@
// Utilities for io redirection.
#include "config.h" // IWYU pragma: keep
#include "operation_context.h"
#include <utility>
#include "operation_context.h"
#include "env.h"
bool no_cancel() { return false; }

View File

@ -1,10 +1,11 @@
#include "config.h" // IWYU pragma: keep
#include "pager.h"
#include <stddef.h>
#include <wctype.h>
#include <algorithm>
#include <cstdlib>
#include <cwchar>
#include <functional>
@ -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<size_t>(PAGER_UNDISCLOSED_MAX_ROWS))
);
term_height =
std::min(term_height,
std::max(term_height / 2, static_cast<size_t>(PAGER_UNDISCLOSED_MAX_ROWS)));
}
size_t row_count = divide_round_up(lst.size(), cols);

View File

@ -6,7 +6,7 @@
#include <vector>
#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;

View File

@ -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();

View File

@ -809,8 +809,8 @@ std::vector<int> 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;
}

View File

@ -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]

View File

@ -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"

View File

@ -14,7 +14,7 @@
#include <cwchar>
#if HAVE_TERM_H
#include <curses.h> // IWYU pragma: keep
#include <curses.h> // IWYU pragma: keep
#include <term.h>
#elif HAVE_NCURSES_TERM_H
#include <ncurses/term.h>
@ -27,17 +27,17 @@
#include <sys/wait.h>
#include <algorithm> // IWYU pragma: keep
#include <cstring>
#include <cstdio>
#include <cstring>
#include <memory>
#include <utility>
#include <vector>
#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"

View File

@ -1,10 +1,10 @@
#include "config.h" // IWYU pragma: keep
#include "re.h"
#include <algorithm>
#include <cstdint>
#include "re.h"
#include "flog.h"
#define PCRE2_CODE_UNIT_WIDTH WCHAR_T_BITS

View File

@ -20,23 +20,22 @@
#include <siginfo.h>
#endif
#include <stdio.h>
#include <time.h>
#include <cstring>
#include <sys/stat.h>
#include <sys/types.h>
#include <termios.h>
#include <time.h>
#include <unistd.h>
#include <wctype.h>
#include <algorithm>
#include <atomic>
#include <chrono>
#include <cctype>
#include <chrono>
#include <cmath>
#include <csignal>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <cwchar>
#include <deque>
#include <functional>
@ -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

View File

@ -7,10 +7,10 @@
#include <stddef.h>
#include <stdint.h>
#include <string>
#include <memory>
#include <vector>
#include <string>
#include <utility>
#include <vector>
#include "common.h"
#include "complete.h"

View File

@ -4,6 +4,7 @@
#include <errno.h>
#include <fcntl.h>
#include <memory>
#include "io.h"

View File

@ -17,7 +17,7 @@
#include <cwchar>
#if HAVE_CURSES_H
#include <curses.h> // IWYU pragma: keep
#include <curses.h> // IWYU pragma: keep
#elif HAVE_NCURSES_H
#include <ncurses.h>
#elif HAVE_NCURSES_CURSES_H

View File

@ -4,6 +4,9 @@
#include <unistd.h>
#include <cerrno>
#include <climits>
#include "env.h"
#include "flog.h"
#include "maybe.h"
@ -11,9 +14,6 @@
#include "wcstringutil.h"
#include "wutil.h"
#include <cerrno>
#include <climits>
#ifdef HAVE_WINSIZE
#include <sys/ioctl.h>
#include <termios.h>

View File

@ -7,8 +7,8 @@
#include <stdint.h>
#include "common.h"
#include "maybe.h"
#include "global_safety.h"
#include "maybe.h"
class environment_t;
class parser_t;

View File

@ -3,9 +3,9 @@
#include "timer.h"
#include <string.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <chrono>
@ -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

View File

@ -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<size_t> token_length, size_t error_len) {
const wchar_t *error_loc, maybe_t<size_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<tok_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<tok_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;

View File

@ -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<size_t> token_length = {}, size_t error_len = 0);
const wchar_t *error_loc, maybe_t<size_t> token_length = {},
size_t error_len = 0);
tok_t read_string();
public:

View File

@ -5,7 +5,7 @@
#include <array>
#include <atomic>
#include <condition_variable> // IWYU pragma: keep
#include <condition_variable> // IWYU pragma: keep
#include <cstdint>
#include <limits>
#include <mutex>

View File

@ -1,4 +1,4 @@
#include "config.h" // IWYU pragma: keep
#include "config.h" // IWYU pragma: keep
#include "trace.h"

View File

@ -1,4 +1,4 @@
#include "config.h" // IWYU pragma: keep
#include "config.h" // IWYU pragma: keep
#include "wait_handle.h"

View File

@ -10,7 +10,7 @@
#include <utility>
#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) {

View File

@ -38,8 +38,8 @@
// Ave, Cambridge, MA 02139, USA.
#include "config.h" // IWYU pragma: keep
#include <stdio.h>
#include <stddef.h>
#include <stdio.h>
#include <cwchar>

View File

@ -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 <dirent.h>
#include <stddef.h>