mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 14:03:58 +00:00
clang-format all files
This commit is contained in:
parent
d1fc8d5f71
commit
fc99d6c7af
13 changed files with 30 additions and 28 deletions
|
@ -264,7 +264,8 @@ int builtin_complete(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
|
|||
}
|
||||
|
||||
if (result_mode.no_files && result_mode.force_files) {
|
||||
streams.err.append_format(BUILTIN_ERR_COMBO2, L"complete", L"'--no-files' and '--force-files'");
|
||||
streams.err.append_format(BUILTIN_ERR_COMBO2, L"complete",
|
||||
L"'--no-files' and '--force-files'");
|
||||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
|
||||
|
|
|
@ -2436,7 +2436,7 @@ void redirect_tty_output() {
|
|||
[[noreturn]] void __fish_assert(const char *msg, const char *file, size_t line, int error) {
|
||||
if (error) {
|
||||
FLOGF(error, L"%s:%zu: failed assertion: %s: errno %d (%s)", file, line, msg, error,
|
||||
std::strerror(error));
|
||||
std::strerror(error));
|
||||
} else {
|
||||
FLOGF(error, L"%s:%zu: failed assertion: %s", file, line, msg);
|
||||
}
|
||||
|
|
|
@ -1190,7 +1190,7 @@ void env_stack_t::set_pwd_from_getcwd() {
|
|||
wcstring cwd = wgetcwd();
|
||||
if (cwd.empty()) {
|
||||
FLOG(error,
|
||||
_(L"Could not determine current working directory. Is your locale set correctly?"));
|
||||
_(L"Could not determine current working directory. Is your locale set correctly?"));
|
||||
return;
|
||||
}
|
||||
set_one(L"PWD", ENV_EXPORT | ENV_GLOBAL, cwd);
|
||||
|
|
|
@ -248,7 +248,8 @@ static wcstring encode_serialized(const wcstring_list_t &vals) {
|
|||
return join_strings(vals, UVAR_ARRAY_SEP);
|
||||
}
|
||||
|
||||
env_universal_t::env_universal_t(wcstring path) : narrow_vars_path(wcs2string(path)), explicit_vars_path(std::move(path)) {}
|
||||
env_universal_t::env_universal_t(wcstring path)
|
||||
: narrow_vars_path(wcs2string(path)), explicit_vars_path(std::move(path)) {}
|
||||
|
||||
maybe_t<env_var_t> env_universal_t::get(const wcstring &name) const {
|
||||
var_table_t::const_iterator where = vars.find(name);
|
||||
|
@ -453,7 +454,7 @@ bool env_universal_t::write_to_fd(int fd, const wcstring &path) {
|
|||
if (write_loop(fd, contents.data(), contents.size()) < 0) {
|
||||
const char *error = std::strerror(errno);
|
||||
FLOGF(error, _(L"Unable to write to universal variables file '%ls': %s"), path.c_str(),
|
||||
error);
|
||||
error);
|
||||
success = false;
|
||||
}
|
||||
|
||||
|
@ -469,7 +470,7 @@ bool env_universal_t::move_new_vars_file_into_place(const wcstring &src, const w
|
|||
if (ret != 0) {
|
||||
const char *error = std::strerror(errno);
|
||||
FLOGF(error, _(L"Unable to rename file from '%ls' to '%ls': %s"), src.c_str(), dst.c_str(),
|
||||
error);
|
||||
error);
|
||||
}
|
||||
return ret == 0;
|
||||
}
|
||||
|
@ -599,7 +600,7 @@ bool env_universal_t::open_and_acquire_lock(const std::string &path, int *out_fd
|
|||
#endif
|
||||
const char *error = std::strerror(errno);
|
||||
FLOGF(error, _(L"Unable to open universal variable file '%ls': %s"), path.c_str(),
|
||||
error);
|
||||
error);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1084,7 +1085,7 @@ class universal_notifier_shmem_poller_t : public universal_notifier_t {
|
|||
if (fstat(fd, &buf) < 0) {
|
||||
const char *error = std::strerror(errno);
|
||||
FLOGF(error, _(L"Unable to fstat shared memory object with path '%s': %s"), path,
|
||||
error);
|
||||
error);
|
||||
errored = true;
|
||||
}
|
||||
size = buf.st_size;
|
||||
|
@ -1095,7 +1096,7 @@ class universal_notifier_shmem_poller_t : public universal_notifier_t {
|
|||
if (set_size && ftruncate(fd, sizeof(universal_notifier_shmem_t)) < 0) {
|
||||
const char *error = std::strerror(errno);
|
||||
FLOGF(error, _(L"Unable to truncate shared memory object with path '%s': %s"), path,
|
||||
error);
|
||||
error);
|
||||
errored = true;
|
||||
}
|
||||
|
||||
|
@ -1106,7 +1107,7 @@ class universal_notifier_shmem_poller_t : public universal_notifier_t {
|
|||
if (addr == MAP_FAILED) {
|
||||
const char *error = std::strerror(errno);
|
||||
FLOGF(error, _(L"Unable to memory map shared memory object with path '%s': %s"),
|
||||
path, error);
|
||||
path, error);
|
||||
this->region = NULL;
|
||||
} else {
|
||||
this->region = static_cast<universal_notifier_shmem_t *>(addr);
|
||||
|
|
|
@ -49,7 +49,6 @@ class env_universal_t {
|
|||
// Path that we save to. If empty, use the default.
|
||||
wcstring explicit_vars_path;
|
||||
|
||||
|
||||
// Whether it's OK to save. This may be set to false if we discover that a future version of
|
||||
// fish wrote the uvars contents.
|
||||
bool ok_to_save{true};
|
||||
|
|
|
@ -887,7 +887,7 @@ expand_result_t expander_t::stage_cmdsubst(wcstring input, std::vector<completio
|
|||
break;
|
||||
case 1:
|
||||
append_cmdsub_error(errors, start, L"Command substitutions not allowed");
|
||||
/* intentionally falls through */
|
||||
/* intentionally falls through */
|
||||
case -1:
|
||||
default:
|
||||
return expand_result_t::error;
|
||||
|
|
|
@ -1584,7 +1584,10 @@ struct pwd_environment_t : public environment_t {
|
|||
return {};
|
||||
}
|
||||
|
||||
wcstring_list_t get_names(int flags) const override { UNUSED(flags); return {L"PWD"}; }
|
||||
wcstring_list_t get_names(int flags) const override {
|
||||
UNUSED(flags);
|
||||
return {L"PWD"};
|
||||
}
|
||||
};
|
||||
|
||||
/// Perform parameter expansion and test if the output equals the zero-terminated parameter list
|
||||
|
|
|
@ -73,9 +73,7 @@ enum class readline_cmd_t {
|
|||
};
|
||||
|
||||
// The range of key codes for inputrc-style keyboard functions.
|
||||
enum {
|
||||
R_END_INPUT_FUNCTIONS = static_cast<int>(readline_cmd_t::reverse_repeat_jump) + 1
|
||||
};
|
||||
enum { R_END_INPUT_FUNCTIONS = static_cast<int>(readline_cmd_t::reverse_repeat_jump) + 1 };
|
||||
|
||||
/// Represents an event on the character input stream.
|
||||
enum class char_event_type_t : uint8_t {
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
#include "config.h"
|
||||
|
||||
#define PARSE_ASSERT(a) assert(a)
|
||||
#define PARSER_DIE() \
|
||||
do { \
|
||||
#define PARSER_DIE() \
|
||||
do { \
|
||||
FLOG(error, L"Parser dying!"); \
|
||||
exit_without_destructors(-1); \
|
||||
exit_without_destructors(-1); \
|
||||
} while (0)
|
||||
|
||||
// IMPORTANT: If the following enum table is modified you must also update token_enum_map below.
|
||||
|
|
|
@ -1079,7 +1079,7 @@ parse_execution_result_t parse_execution_context_t::populate_job_process(
|
|||
}
|
||||
default: {
|
||||
FLOGF(error, L"'%ls' not handled by new parser yet.",
|
||||
specific_statement.describe().c_str());
|
||||
specific_statement.describe().c_str());
|
||||
PARSER_DIE();
|
||||
break;
|
||||
}
|
||||
|
@ -1383,7 +1383,7 @@ parse_execution_result_t parse_execution_context_t::eval_node(tnode_t<g::stateme
|
|||
status = this->run_switch_statement(switchstat);
|
||||
} else {
|
||||
FLOGF(error, L"Unexpected node %ls found in %s", statement.node()->describe().c_str(),
|
||||
__FUNCTION__);
|
||||
__FUNCTION__);
|
||||
abort();
|
||||
}
|
||||
return status;
|
||||
|
|
|
@ -404,7 +404,7 @@ const production_element_t *parse_productions::production_for_token(parse_token_
|
|||
case parse_token_type_end:
|
||||
case parse_token_type_terminate: {
|
||||
FLOGF(error, L"Terminal token type %ls passed to %s", token_type_description(node_type),
|
||||
__FUNCTION__);
|
||||
__FUNCTION__);
|
||||
PARSER_DIE();
|
||||
break;
|
||||
}
|
||||
|
@ -412,7 +412,7 @@ const production_element_t *parse_productions::production_for_token(parse_token_
|
|||
case parse_special_type_tokenizer_error:
|
||||
case parse_special_type_comment: {
|
||||
FLOGF(error, L"Special type %ls passed to %s\n", token_type_description(node_type),
|
||||
__FUNCTION__);
|
||||
__FUNCTION__);
|
||||
PARSER_DIE();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -274,11 +274,11 @@ static void maybe_issue_path_warning(const wcstring &which_dir, const wcstring &
|
|||
if (path.empty()) {
|
||||
FLOGF(error, _(L"Unable to locate the %ls directory."), which_dir.c_str());
|
||||
FLOGF(error, _(L"Please set the %ls or HOME environment variable before starting fish."),
|
||||
xdg_var.c_str());
|
||||
xdg_var.c_str());
|
||||
} else {
|
||||
const wchar_t *env_var = using_xdg ? xdg_var.c_str() : L"HOME";
|
||||
FLOGF(error, _(L"Unable to locate %ls directory derived from $%ls: '%ls'."),
|
||||
which_dir.c_str(), env_var, path.c_str());
|
||||
which_dir.c_str(), env_var, path.c_str());
|
||||
FLOGF(error, _(L"The error was '%s'."), std::strerror(saved_errno));
|
||||
FLOGF(error, _(L"Please set $%ls to a directory where you have write access."), env_var);
|
||||
}
|
||||
|
|
|
@ -924,7 +924,7 @@ void proc_sanity_check(const parser_t &parser) {
|
|||
if (j->is_foreground() && !(j->is_stopped() || j->is_completed())) {
|
||||
if (fg_job) {
|
||||
FLOGF(error, _(L"More than one job in foreground: job 1: '%ls' job 2: '%ls'"),
|
||||
fg_job->command_wcstr(), j->command_wcstr());
|
||||
fg_job->command_wcstr(), j->command_wcstr());
|
||||
sanity_lose();
|
||||
}
|
||||
fg_job = j.get();
|
||||
|
@ -938,13 +938,13 @@ void proc_sanity_check(const parser_t &parser) {
|
|||
|
||||
if ((p->stopped & (~0x00000001)) != 0) {
|
||||
FLOGF(error, _(L"Job '%ls', process '%ls' has inconsistent state \'stopped\'=%d"),
|
||||
j->command_wcstr(), p->argv0(), p->stopped);
|
||||
j->command_wcstr(), p->argv0(), p->stopped);
|
||||
sanity_lose();
|
||||
}
|
||||
|
||||
if ((p->completed & (~0x00000001)) != 0) {
|
||||
FLOGF(error, _(L"Job '%ls', process '%ls' has inconsistent state \'completed\'=%d"),
|
||||
j->command_wcstr(), p->argv0(), p->completed);
|
||||
j->command_wcstr(), p->argv0(), p->completed);
|
||||
sanity_lose();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue