diff --git a/src/common.cpp b/src/common.cpp index bd4fa8e3c..825f84bfc 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -2435,10 +2435,10 @@ void redirect_tty_output() { /// Display a failed assertion message, dump a stack trace if possible, then die. [[noreturn]] void __fish_assert(const char *msg, const char *file, size_t line, int error) { if (error) { - FLOG(error, L"%s:%zu: failed assertion: %s: errno %d (%s)", file, line, msg, error, + FLOGF(error, L"%s:%zu: failed assertion: %s: errno %d (%s)", file, line, msg, error, std::strerror(error)); } else { - FLOG(error, L"%s:%zu: failed assertion: %s", file, line, msg); + FLOGF(error, L"%s:%zu: failed assertion: %s", file, line, msg); } show_stackframe(L'E', 99, 1); abort(); diff --git a/src/complete.cpp b/src/complete.cpp index 750d9dbc6..78b2e88bf 100644 --- a/src/complete.cpp +++ b/src/complete.cpp @@ -906,7 +906,7 @@ bool completer_t::complete_param(const wcstring &cmd_orig, const wcstring &popt, } }; - // FLOG(error, L"\nThinking about looking up completions for %ls\n", cmd.c_str()); + // FLOGF(error, L"\nThinking about looking up completions for %ls\n", cmd.c_str()); bool head_exists = builtin_exists(cmd); // Only reload environment variables if builtin_exists returned false, as an optimization if (head_exists == false) { diff --git a/src/env.cpp b/src/env.cpp index 12ab94fb8..5ab4fdb4b 100644 --- a/src/env.cpp +++ b/src/env.cpp @@ -140,7 +140,7 @@ void fix_colon_delimited_var(const wcstring &var_name, env_stack_t &vars) { std::replace(newstrs.begin(), newstrs.end(), empty, wcstring(L".")); int retval = vars.set(var_name, ENV_DEFAULT | ENV_USER, std::move(newstrs)); if (retval != ENV_OK) { - FLOG(error, L"fix_colon_delimited_var failed unexpectedly with retval %d", retval); + FLOGF(error, L"fix_colon_delimited_var failed unexpectedly with retval %d", retval); } } } @@ -1353,7 +1353,7 @@ wcstring env_get_runtime_path() { if (!uname || check_runtime_path(tmpdir.c_str()) != 0) { FLOG(error, L"Runtime path not available."); - FLOG(error, L"Try deleting the directory %s and restarting fish.", tmpdir.c_str()); + FLOGF(error, L"Try deleting the directory %s and restarting fish.", tmpdir.c_str()); return result; } diff --git a/src/env_universal_common.cpp b/src/env_universal_common.cpp index 81b6185d8..1790a990b 100644 --- a/src/env_universal_common.cpp +++ b/src/env_universal_common.cpp @@ -196,11 +196,11 @@ static bool append_file_entry(env_var_t::env_var_flags_t flags, const wcstring & // Append variable name like "fish_color_cwd". if (!valid_var_name(key_in)) { - FLOG(error, L"Illegal variable name: '%ls'", key_in.c_str()); + FLOGF(error, L"Illegal variable name: '%ls'", key_in.c_str()); success = false; } if (success && !append_utf8(key_in, result, storage)) { - FLOG(error, L"Could not convert %ls to narrow character string", key_in.c_str()); + FLOGF(error, L"Could not convert %ls to narrow character string", key_in.c_str()); success = false; } @@ -211,7 +211,7 @@ static bool append_file_entry(env_var_t::env_var_flags_t flags, const wcstring & // Append value. if (success && !append_utf8(full_escape(val_in), result, storage)) { - FLOG(error, L"Could not convert %ls to narrow character string", val_in.c_str()); + FLOGF(error, L"Could not convert %ls to narrow character string", val_in.c_str()); success = false; } @@ -448,7 +448,7 @@ bool env_universal_t::write_to_fd(int fd, const wcstring &path) { std::string contents = serialize_with_vars(vars); if (write_loop(fd, contents.data(), contents.size()) < 0) { const char *error = std::strerror(errno); - FLOG(error, _(L"Unable to write to universal variables file '%ls': %s"), path.c_str(), + FLOGF(error, _(L"Unable to write to universal variables file '%ls': %s"), path.c_str(), error); success = false; } @@ -464,7 +464,7 @@ bool env_universal_t::move_new_vars_file_into_place(const wcstring &src, const w int ret = wrename(src, dst); if (ret != 0) { const char *error = std::strerror(errno); - FLOG(error, _(L"Unable to rename file from '%ls' to '%ls': %s"), src.c_str(), dst.c_str(), + FLOGF(error, _(L"Unable to rename file from '%ls' to '%ls': %s"), src.c_str(), dst.c_str(), error); } return ret == 0; @@ -527,7 +527,7 @@ bool env_universal_t::open_temporary_file(const wcstring &directory, wcstring *o if (!success) { const char *error = std::strerror(saved_errno); - FLOG(error, _(L"Unable to open temporary file '%ls': %s"), out_path->c_str(), error); + FLOGF(error, _(L"Unable to open temporary file '%ls': %s"), out_path->c_str(), error); } return success; } @@ -589,7 +589,7 @@ bool env_universal_t::open_and_acquire_lock(const wcstring &path, int *out_fd) { } #endif const char *error = std::strerror(errno); - FLOG(error, _(L"Unable to open universal variable file '%ls': %s"), path.c_str(), + FLOGF(error, _(L"Unable to open universal variable file '%ls': %s"), path.c_str(), error); break; } @@ -1061,7 +1061,7 @@ class universal_notifier_shmem_poller_t : public universal_notifier_t { int fd = shm_open(path, O_RDWR | O_CREAT, 0600); if (fd < 0) { const char *error = std::strerror(errno); - FLOG(error, _(L"Unable to open shared memory with path '%s': %s"), path, error); + FLOGF(error, _(L"Unable to open shared memory with path '%s': %s"), path, error); errored = true; } @@ -1071,7 +1071,7 @@ class universal_notifier_shmem_poller_t : public universal_notifier_t { struct stat buf = {}; if (fstat(fd, &buf) < 0) { const char *error = std::strerror(errno); - FLOG(error, _(L"Unable to fstat shared memory object with path '%s': %s"), path, + FLOGF(error, _(L"Unable to fstat shared memory object with path '%s': %s"), path, error); errored = true; } @@ -1082,7 +1082,7 @@ class universal_notifier_shmem_poller_t : public universal_notifier_t { bool set_size = !errored && size < (off_t)sizeof(universal_notifier_shmem_t); if (set_size && ftruncate(fd, sizeof(universal_notifier_shmem_t)) < 0) { const char *error = std::strerror(errno); - FLOG(error, _(L"Unable to truncate shared memory object with path '%s': %s"), path, + FLOGF(error, _(L"Unable to truncate shared memory object with path '%s': %s"), path, error); errored = true; } @@ -1093,7 +1093,7 @@ class universal_notifier_shmem_poller_t : public universal_notifier_t { MAP_SHARED, fd, 0); if (addr == MAP_FAILED) { const char *error = std::strerror(errno); - FLOG(error, _(L"Unable to memory map shared memory object with path '%s': %s"), + FLOGF(error, _(L"Unable to memory map shared memory object with path '%s': %s"), path, error); this->region = NULL; } else { diff --git a/src/exec.cpp b/src/exec.cpp index a43b24829..614850745 100644 --- a/src/exec.cpp +++ b/src/exec.cpp @@ -792,7 +792,7 @@ static bool exec_block_or_func_process(parser_t &parser, std::shared_ptr const wcstring func_name = p->argv0(); auto props = function_get_properties(func_name); if (!props) { - FLOG(error, _(L"Unknown function '%ls'"), p->argv0()); + FLOGF(error, _(L"Unknown function '%ls'"), p->argv0()); return false; } diff --git a/src/expand.cpp b/src/expand.cpp index 7b4e63076..cf206abbd 100644 --- a/src/expand.cpp +++ b/src/expand.cpp @@ -224,7 +224,7 @@ static size_t parse_slice(const wchar_t *in, wchar_t **end_ptr, std::vector 0) { - // FLOG(error, L"Item is deleted : %s\n", old_item.str().c_str()); + // FLOGF(error, L"Item is deleted : %s\n", old_item.str().c_str()); continue; } // Add this old item. diff --git a/src/iothread.cpp b/src/iothread.cpp index 43854dcc8..960e04a20 100644 --- a/src/iothread.cpp +++ b/src/iothread.cpp @@ -202,7 +202,7 @@ void iothread_service_completion() { } else if (wakeup_byte == IO_SERVICE_RESULT_QUEUE) { iothread_service_result_queue(); } else { - FLOG(error, "Unknown wakeup byte %02x in %s", wakeup_byte, __FUNCTION__); + FLOGF(error, "Unknown wakeup byte %02x in %s", wakeup_byte, __FUNCTION__); } } diff --git a/src/parse_execution.cpp b/src/parse_execution.cpp index e4e4921b7..c35ae9006 100644 --- a/src/parse_execution.cpp +++ b/src/parse_execution.cpp @@ -360,7 +360,7 @@ parse_execution_result_t parse_execution_context_t::run_block_statement( } else if (auto header = bheader.try_get_child()) { ret = run_begin_statement(contents); } else { - FLOG(error, L"Unexpected block header: %ls\n", bheader.node()->describe().c_str()); + FLOGF(error, L"Unexpected block header: %ls\n", bheader.node()->describe().c_str()); PARSER_DIE(); } return ret; @@ -1078,7 +1078,7 @@ parse_execution_result_t parse_execution_context_t::populate_job_process( break; } default: { - FLOG(error, L"'%ls' not handled by new parser yet.", + FLOGF(error, L"'%ls' not handled by new parser yet.", specific_statement.describe().c_str()); PARSER_DIE(); break; @@ -1382,7 +1382,7 @@ parse_execution_result_t parse_execution_context_t::eval_node(tnode_t()) { status = this->run_switch_statement(switchstat); } else { - FLOG(error, "Unexpected node %ls found in %s", statement.node()->describe().c_str(), + FLOGF(error, "Unexpected node %ls found in %s", statement.node()->describe().c_str(), __FUNCTION__); abort(); } diff --git a/src/parse_productions.cpp b/src/parse_productions.cpp index 5dc43aea1..91f3a9001 100644 --- a/src/parse_productions.cpp +++ b/src/parse_productions.cpp @@ -403,7 +403,7 @@ const production_element_t *parse_productions::production_for_token(parse_token_ case parse_token_type_oror: case parse_token_type_end: case parse_token_type_terminate: { - FLOG(error, "Terminal token type %ls passed to %s", token_type_description(node_type), + FLOGF(error, "Terminal token type %ls passed to %s", token_type_description(node_type), __FUNCTION__); PARSER_DIE(); break; @@ -411,13 +411,13 @@ const production_element_t *parse_productions::production_for_token(parse_token_ case parse_special_type_parse_error: case parse_special_type_tokenizer_error: case parse_special_type_comment: { - FLOG(error, "Special type %ls passed to %s\n", token_type_description(node_type), + FLOGF(error, "Special type %ls passed to %s\n", token_type_description(node_type), __FUNCTION__); PARSER_DIE(); break; } case token_type_invalid: { - FLOG(error, "token_type_invalid passed to %s", __FUNCTION__); + FLOGF(error, "token_type_invalid passed to %s", __FUNCTION__); PARSER_DIE(); break; } diff --git a/src/parse_tree.cpp b/src/parse_tree.cpp index 08aedba62..e05a9b9c2 100644 --- a/src/parse_tree.cpp +++ b/src/parse_tree.cpp @@ -257,7 +257,7 @@ static inline parse_token_type_t parse_token_type_from_tokenizer_token( case TOK_COMMENT: return parse_special_type_comment; } - FLOG(error, "Bad token type %d passed to %s", (int)tokenizer_token_type, __FUNCTION__); + FLOGF(error, "Bad token type %d passed to %s", (int)tokenizer_token_type, __FUNCTION__); DIE("bad token type"); return token_type_invalid; } diff --git a/src/path.cpp b/src/path.cpp index 7e1f9ff16..6aa81b8b8 100644 --- a/src/path.cpp +++ b/src/path.cpp @@ -270,15 +270,15 @@ static void maybe_issue_path_warning(const wcstring &which_dir, const wcstring & FLOG(error, custom_error_msg.c_str()); if (path.empty()) { - FLOG(error, _(L"Unable to locate the %ls directory."), which_dir.c_str()); - FLOG(error, _(L"Please set the %ls or HOME environment variable before starting fish."), + 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()); } else { const wchar_t *env_var = using_xdg ? xdg_var.c_str() : L"HOME"; - FLOG(error, _(L"Unable to locate %ls directory derived from $%ls: '%ls'."), + FLOGF(error, _(L"Unable to locate %ls directory derived from $%ls: '%ls'."), which_dir.c_str(), env_var, path.c_str()); - FLOG(error, _(L"The error was '%s'."), std::strerror(saved_errno)); - FLOG(error, _(L"Please set $%ls to a directory where you have write access."), env_var); + 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); } ignore_result(write(STDERR_FILENO, "\n", 1)); } diff --git a/src/postfork.cpp b/src/postfork.cpp index c8a4b2add..fd7205950 100644 --- a/src/postfork.cpp +++ b/src/postfork.cpp @@ -374,7 +374,7 @@ void safe_report_exec_error(int err, const char *actual_cmd, const char *const * const char *err = safe_strerror(errno); debug_safe(0, "exec: %s", err); - // FLOG(error, L"The file '%ls' is marked as an executable but could not be run by the + // FLOGF(error, L"The file '%ls' is marked as an executable but could not be run by the // operating system.", p->actual_cmd); break; } diff --git a/src/proc.cpp b/src/proc.cpp index b41c3247f..80ca11705 100644 --- a/src/proc.cpp +++ b/src/proc.cpp @@ -923,7 +923,7 @@ void proc_sanity_check(const parser_t &parser) { // More than one foreground job? if (j->is_foreground() && !(j->is_stopped() || j->is_completed())) { if (fg_job) { - FLOG(error, _(L"More than one job in foreground: job 1: '%ls' job 2: '%ls'"), + FLOGF(error, _(L"More than one job in foreground: job 1: '%ls' job 2: '%ls'"), fg_job->command_wcstr(), j->command_wcstr()); sanity_lose(); } @@ -937,13 +937,13 @@ void proc_sanity_check(const parser_t &parser) { validate_pointer(p->argv0(), _(L"Process name"), null_ok); if ((p->stopped & (~0x00000001)) != 0) { - FLOG(error, _(L"Job '%ls', process '%ls' has inconsistent state \'stopped\'=%d"), + FLOGF(error, _(L"Job '%ls', process '%ls' has inconsistent state \'stopped\'=%d"), j->command_wcstr(), p->argv0(), p->stopped); sanity_lose(); } if ((p->completed & (~0x00000001)) != 0) { - FLOG(error, _(L"Job '%ls', process '%ls' has inconsistent state \'completed\'=%d"), + FLOGF(error, _(L"Job '%ls', process '%ls' has inconsistent state \'completed\'=%d"), j->command_wcstr(), p->argv0(), p->completed); sanity_lose(); } diff --git a/src/sanity.cpp b/src/sanity.cpp index 4bc6b540c..f00dd143e 100644 --- a/src/sanity.cpp +++ b/src/sanity.cpp @@ -24,12 +24,12 @@ void sanity_lose() { void validate_pointer(const void *ptr, const wchar_t *err, int null_ok) { // Test if the pointer data crosses a segment boundary. if ((0x00000003l & (intptr_t)ptr) != 0) { - FLOG(error, _(L"The pointer '%ls' is invalid"), err); + FLOGF(error, _(L"The pointer '%ls' is invalid"), err); sanity_lose(); } if ((!null_ok) && (ptr == 0)) { - FLOG(error, _(L"The pointer '%ls' is null"), err); + FLOGF(error, _(L"The pointer '%ls' is null"), err); sanity_lose(); } } diff --git a/src/tokenizer.cpp b/src/tokenizer.cpp index 0308d8f53..b33f0ba3d 100644 --- a/src/tokenizer.cpp +++ b/src/tokenizer.cpp @@ -243,7 +243,7 @@ tok_t tokenizer_t::read_string() { } else { msg.push_back(L'\n'); } - FLOG(error, msg.c_str(), c, c, int(mode_begin), int(mode)); + FLOGF(error, msg.c_str(), c, c, int(mode_begin), int(mode)); #endif this->buff++; diff --git a/src/wutil.cpp b/src/wutil.cpp index 4e8d2762f..90a731e65 100644 --- a/src/wutil.cpp +++ b/src/wutil.cpp @@ -131,7 +131,7 @@ const wcstring wgetcwd() { return str2wcstring(res); } - FLOG(error, _(L"getcwd() failed with errno %d/%s"), errno, std::strerror(errno)); + FLOGF(error, _(L"getcwd() failed with errno %d/%s"), errno, std::strerror(errno)); return wcstring(); }