diff --git a/src/builtin_complete.cpp b/src/builtin_complete.cpp index e17f1e34e..1ea9b06ae 100644 --- a/src/builtin_complete.cpp +++ b/src/builtin_complete.cpp @@ -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; } diff --git a/src/common.cpp b/src/common.cpp index 69cfb9638..1a7c7aa89 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -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); } diff --git a/src/env.cpp b/src/env.cpp index 5ffbac829..90d0a5839 100644 --- a/src/env.cpp +++ b/src/env.cpp @@ -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); diff --git a/src/env_universal_common.cpp b/src/env_universal_common.cpp index 0d4788bd4..15721e327 100644 --- a/src/env_universal_common.cpp +++ b/src/env_universal_common.cpp @@ -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_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(addr); diff --git a/src/env_universal_common.h b/src/env_universal_common.h index 61d85aa7e..471c7dbba 100644 --- a/src/env_universal_common.h +++ b/src/env_universal_common.h @@ -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}; diff --git a/src/expand.cpp b/src/expand.cpp index cf206abbd..fbdc8c8d0 100644 --- a/src/expand.cpp +++ b/src/expand.cpp @@ -887,7 +887,7 @@ expand_result_t expander_t::stage_cmdsubst(wcstring input, std::vector(readline_cmd_t::reverse_repeat_jump) + 1 -}; +enum { R_END_INPUT_FUNCTIONS = static_cast(readline_cmd_t::reverse_repeat_jump) + 1 }; /// Represents an event on the character input stream. enum class char_event_type_t : uint8_t { diff --git a/src/parse_constants.h b/src/parse_constants.h index 724e69f77..5c234c505 100644 --- a/src/parse_constants.h +++ b/src/parse_constants.h @@ -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. diff --git a/src/parse_execution.cpp b/src/parse_execution.cpp index 46bb1d104..8a34895ef 100644 --- a/src/parse_execution.cpp +++ b/src/parse_execution.cpp @@ -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_trun_switch_statement(switchstat); } else { FLOGF(error, L"Unexpected node %ls found in %s", statement.node()->describe().c_str(), - __FUNCTION__); + __FUNCTION__); abort(); } return status; diff --git a/src/parse_productions.cpp b/src/parse_productions.cpp index 962ddc4a6..4163d74a9 100644 --- a/src/parse_productions.cpp +++ b/src/parse_productions.cpp @@ -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; } diff --git a/src/path.cpp b/src/path.cpp index 51b3ae7d7..7634fd246 100644 --- a/src/path.cpp +++ b/src/path.cpp @@ -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); } diff --git a/src/proc.cpp b/src/proc.cpp index 3e316aba4..16f50910b 100644 --- a/src/proc.cpp +++ b/src/proc.cpp @@ -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(); } }