diff --git a/src/builtin_eval.cpp b/src/builtin_eval.cpp index 6b0ad0f49..26621e321 100644 --- a/src/builtin_eval.cpp +++ b/src/builtin_eval.cpp @@ -19,7 +19,7 @@ int builtin_eval(parser_t &parser, io_streams_t &streams, wchar_t **argv) { int argc = builtin_count_args(argv); wcstring new_cmd; - for (size_t i = 1; i < argc; ++i) { + for (int i = 1; i < argc; ++i) { if (i > 1) new_cmd += L' '; new_cmd += argv[i]; } diff --git a/src/common.cpp b/src/common.cpp index d1f8662c1..71d546c60 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -1752,7 +1752,10 @@ void invalidate_termsize(bool invalidate_vars) { /// Handle SIGWINCH. This is also invoked when the shell regains control of the tty since it is /// possible the terminal size changed while an external command was running. -void common_handle_winch(int signal) { s_termsize_valid = false; } +void common_handle_winch(int signal) { + (void)signal; + s_termsize_valid = false; +} /// Validate the new terminal size. Fallback to the env vars if necessary. Ensure the values are /// sane and if not fallback to a default of 80x24. diff --git a/src/complete.cpp b/src/complete.cpp index fc9ecb11d..82256a123 100644 --- a/src/complete.cpp +++ b/src/complete.cpp @@ -72,8 +72,6 @@ static const wchar_t *C_(const wcstring &s) { static const wcstring &C_(const wcstring &s) { return s; } #endif -static void complete_load(const wcstring &name, bool reload); - /// Struct describing a completion option entry. /// /// If option is empty, the comp field must not be empty and contains a list of arguments to the @@ -858,7 +856,7 @@ static bool short_ok(const wcstring &arg, const complete_entry_opt_t *entry, } /// Load command-specific completions for the specified command. -static void complete_load(const wcstring &name, bool reload) { +static void complete_load(const wcstring &name) { // We have to load this as a function, since it may define a --wraps or signature. // See issue #2466. auto &parser = parser_t::principal_parser(); @@ -926,7 +924,7 @@ bool completer_t::complete_param(const wcstring &cmd_orig, const wcstring &popt, // and automatic completions ("gi" autosuggestion provider -> git) debug(4, "Skipping completions for non-existent head\n"); } else { - run_on_main_thread([&]() { complete_load(cmd, true); }); + run_on_main_thread([&]() { complete_load(cmd); }); } // Make a list of lists of all options that we care about. diff --git a/src/env.cpp b/src/env.cpp index 1f1602de4..bee66a820 100644 --- a/src/env.cpp +++ b/src/env.cpp @@ -549,10 +549,10 @@ class env_scoped_impl_t : public environment_t { // populated. A maybe_t> is a bridge too far. // These may populate result with none() if a variable is present which does not match the // query. - maybe_t try_get_computed(const wcstring &key, const query_t &query) const; - maybe_t try_get_local(const wcstring &key, const query_t &query) const; - maybe_t try_get_global(const wcstring &key, const query_t &query) const; - maybe_t try_get_universal(const wcstring &key, const query_t &query) const; + maybe_t try_get_computed(const wcstring &key) const; + maybe_t try_get_local(const wcstring &key) const; + maybe_t try_get_global(const wcstring &key) const; + maybe_t try_get_universal(const wcstring &key) const; /// \return a newly allocated export array. std::shared_ptr> create_export_array() const; @@ -625,8 +625,7 @@ std::shared_ptr> env_scoped_impl_t::export_a return export_array_; } -maybe_t env_scoped_impl_t::try_get_computed(const wcstring &key, - const query_t &query) const { +maybe_t env_scoped_impl_t::try_get_computed(const wcstring &key) const { const electric_var_t *ev = electric_var_t::for_name(key); if (!(ev && ev->computed())) { return none(); @@ -671,8 +670,7 @@ maybe_t env_scoped_impl_t::try_get_computed(const wcstring &key, DIE("unrecognized computed var name"); } -maybe_t env_scoped_impl_t::try_get_local(const wcstring &key, - const query_t &query) const { +maybe_t env_scoped_impl_t::try_get_local(const wcstring &key) const { auto cursor = locals_; while (cursor) { auto where = cursor->env.find(key); @@ -684,8 +682,7 @@ maybe_t env_scoped_impl_t::try_get_local(const wcstring &key, return none(); } -maybe_t env_scoped_impl_t::try_get_global(const wcstring &key, - const query_t &query) const { +maybe_t env_scoped_impl_t::try_get_global(const wcstring &key) const { auto where = globals_->env.find(key); if (where != globals_->env.end()) { return where->second; @@ -693,8 +690,7 @@ maybe_t env_scoped_impl_t::try_get_global(const wcstring &key, return none(); } -maybe_t env_scoped_impl_t::try_get_universal(const wcstring &key, - const query_t &query) const { +maybe_t env_scoped_impl_t::try_get_universal(const wcstring &key) const { if (!uvars()) return none(); auto var = uvars()->get(key); if (var) { @@ -706,15 +702,15 @@ maybe_t env_scoped_impl_t::try_get_universal(const wcstring &key, maybe_t env_scoped_impl_t::get(const wcstring &key, env_mode_flags_t mode) const { const query_t query(mode); - maybe_t result = try_get_computed(key, query); + maybe_t result = try_get_computed(key); if (!result && query.local) { - result = try_get_local(key, query); + result = try_get_local(key); } if (!result && query.global) { - result = try_get_global(key, query); + result = try_get_global(key); } if (!result && query.universal) { - result = try_get_universal(key, query); + result = try_get_universal(key); } // If the user requested only exported or unexported variables, enforce that here. if (result && !query.export_matches(*result)) { diff --git a/src/event.cpp b/src/event.cpp index 125ba9c2b..57975bb7f 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -131,6 +131,7 @@ static bool handler_matches(const event_handler_t &classv, const event_t &instan /// Test if specified event is blocked. static int event_is_blocked(const event_t &e) { + (void)e; const block_t *block; parser_t &parser = parser_t::principal_parser(); diff --git a/src/function.cpp b/src/function.cpp index a158027af..85c24ac0a 100644 --- a/src/function.cpp +++ b/src/function.cpp @@ -227,6 +227,7 @@ void function_load(const wcstring &cmd, parser_t &parser) { } int function_exists_no_autoload(const wcstring &cmd, const environment_t &vars) { + (void)vars; if (parser_keywords_is_reserved(cmd)) return 0; auto funcset = function_set.acquire(); diff --git a/src/proc.cpp b/src/proc.cpp index 4ffdc518b..c38f06898 100644 --- a/src/proc.cpp +++ b/src/proc.cpp @@ -504,10 +504,7 @@ static bool try_clean_process_in_job(process_t *p, job_t *j, std::vector &j, bool print_for_foreground_stops = true) { +static bool job_wants_message(const shared_ptr &j) { // Did we already print a status message? if (j->get_flag(job_flag_t::NOTIFIED)) return false; @@ -556,7 +553,7 @@ static bool process_clean_after_marking(parser_t &parser, bool allow_interactive } // If we are not interactive, skip cleaning jobs that want to print an interactive message. - if (!interactive && job_wants_message(j, false)) { + if (!interactive && job_wants_message(j)) { continue; } diff --git a/src/screen.cpp b/src/screen.cpp index 91ef3ed89..f653be3f8 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -519,6 +519,7 @@ static void s_move(screen_t *s, int new_x, int new_y) { /// Set the pen color for the terminal. static void s_set_color(screen_t *s, const environment_t &vars, highlight_spec_t c) { UNUSED(s); + UNUSED(vars); s->outp().set_color(highlight_get_color(c, false), highlight_get_color(c, true)); } @@ -824,8 +825,7 @@ static size_t truncation_offset_for_width(const std::vector &width_by_of static screen_layout_t compute_layout(screen_t *s, size_t screen_width, const wcstring &left_prompt_str, const wcstring &right_prompt_str, const wcstring &commandline, - const wcstring &autosuggestion_str, - const std::vector &indent) { + const wcstring &autosuggestion_str) { UNUSED(s); screen_layout_t result = {}; @@ -1003,7 +1003,7 @@ void s_write(screen_t *s, const wcstring &left_prompt, const wcstring &right_pro // Compute a layout. const screen_layout_t layout = compute_layout(s, screen_width, left_prompt, right_prompt, - explicit_command_line, autosuggestion, indent); + explicit_command_line, autosuggestion); // Determine whether, if we have an autosuggestion, it was truncated. s->autosuggestion_is_truncated =