Remove some unused variables

This commit is contained in:
ridiculousfish 2019-05-12 18:23:00 -07:00
parent 1719d6f136
commit 234c97e6d2
8 changed files with 26 additions and 30 deletions

View file

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

View file

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

View file

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

View file

@ -549,10 +549,10 @@ class env_scoped_impl_t : public environment_t {
// populated. A maybe_t<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<env_var_t> try_get_computed(const wcstring &key, const query_t &query) const;
maybe_t<env_var_t> try_get_local(const wcstring &key, const query_t &query) const;
maybe_t<env_var_t> try_get_global(const wcstring &key, const query_t &query) const;
maybe_t<env_var_t> try_get_universal(const wcstring &key, const query_t &query) const;
maybe_t<env_var_t> try_get_computed(const wcstring &key) const;
maybe_t<env_var_t> try_get_local(const wcstring &key) const;
maybe_t<env_var_t> try_get_global(const wcstring &key) const;
maybe_t<env_var_t> try_get_universal(const wcstring &key) const;
/// \return a newly allocated export array.
std::shared_ptr<const null_terminated_array_t<char>> create_export_array() const;
@ -625,8 +625,7 @@ std::shared_ptr<const null_terminated_array_t<char>> env_scoped_impl_t::export_a
return export_array_;
}
maybe_t<env_var_t> env_scoped_impl_t::try_get_computed(const wcstring &key,
const query_t &query) const {
maybe_t<env_var_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_var_t> env_scoped_impl_t::try_get_computed(const wcstring &key,
DIE("unrecognized computed var name");
}
maybe_t<env_var_t> env_scoped_impl_t::try_get_local(const wcstring &key,
const query_t &query) const {
maybe_t<env_var_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_var_t> env_scoped_impl_t::try_get_local(const wcstring &key,
return none();
}
maybe_t<env_var_t> env_scoped_impl_t::try_get_global(const wcstring &key,
const query_t &query) const {
maybe_t<env_var_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_var_t> env_scoped_impl_t::try_get_global(const wcstring &key,
return none();
}
maybe_t<env_var_t> env_scoped_impl_t::try_get_universal(const wcstring &key,
const query_t &query) const {
maybe_t<env_var_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_var_t> env_scoped_impl_t::try_get_universal(const wcstring &key,
maybe_t<env_var_t> env_scoped_impl_t::get(const wcstring &key, env_mode_flags_t mode) const {
const query_t query(mode);
maybe_t<env_var_t> result = try_get_computed(key, query);
maybe_t<env_var_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)) {

View file

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

View file

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

View file

@ -504,10 +504,7 @@ static bool try_clean_process_in_job(process_t *p, job_t *j, std::vector<event_t
}
/// \return whether this job wants a status message printed when it stops or completes.
/// If \p print_stopped_foregrounds is set, then treat stopped foreground jobs as wanting a message.
/// This should conceptually always be true and we only sometimes leave it as false to allow job IDs
/// to be more aggressively reclaimed. TODO: rationalize this!
static bool job_wants_message(const shared_ptr<job_t> &j, bool print_for_foreground_stops = true) {
static bool job_wants_message(const shared_ptr<job_t> &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;
}

View file

@ -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<size_t> &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<int> &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 =