mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-10 23:24:39 +00:00
lint: unused parameter
This commit is contained in:
parent
19e12e3747
commit
e73226d7e8
7 changed files with 21 additions and 13 deletions
|
@ -3299,13 +3299,11 @@ static bool builtin_handles_help(const wchar_t *cmd) {
|
|||
|
||||
/// Execute a builtin command
|
||||
int builtin_run(parser_t &parser, const wchar_t *const *argv, io_streams_t &streams) {
|
||||
int (*cmd)(parser_t & parser, io_streams_t & streams, const wchar_t *const *argv) = NULL;
|
||||
UNUSED(parser);
|
||||
UNUSED(streams);
|
||||
if (argv == NULL || argv[0] == NULL) return STATUS_BUILTIN_ERROR;
|
||||
|
||||
const builtin_data_t *data = builtin_lookup(argv[0]);
|
||||
cmd = (int (*)(parser_t & parser, io_streams_t & streams, const wchar_t *const *))(
|
||||
data ? data->func : NULL);
|
||||
|
||||
if (argv[1] != NULL && !builtin_handles_help(argv[0]) && argv[2] == NULL &&
|
||||
parse_util_argument_is_help(argv[1], 0)) {
|
||||
builtin_print_help(parser, streams, argv[0], streams.out);
|
||||
|
@ -3313,7 +3311,13 @@ int builtin_run(parser_t &parser, const wchar_t *const *argv, io_streams_t &stre
|
|||
}
|
||||
|
||||
if (data != NULL) {
|
||||
return cmd(parser, streams, argv);
|
||||
// Warning: layering violation and naughty cast. The code originally had a much more
|
||||
// complicated solution to achieve exactly the same result: lie about the constness of argv.
|
||||
// Some of the builtins we call do mutate the array via their calls to wgetopt() which could
|
||||
// result in the pointers being reordered. This is harmless because we only get called once
|
||||
// with a given argv array and nothing else will look at the contents of the array after we
|
||||
// return.
|
||||
return data->func(parser, streams, (wchar_t **)argv);
|
||||
}
|
||||
|
||||
debug(0, UNKNOWN_BUILTIN_ERR_MSG, argv[0]);
|
||||
|
|
|
@ -1159,7 +1159,8 @@ static int string_trim(parser_t &parser, io_streams_t &streams, int argc, wchar_
|
|||
|
||||
static const struct string_subcommand {
|
||||
const wchar_t *name;
|
||||
int (*handler)(parser_t &, io_streams_t &, int argc, wchar_t **argv);
|
||||
int (*handler)(parser_t &, io_streams_t &, int argc, //!OCLINT(unused param)
|
||||
wchar_t **argv); //!OCLINT(unused param)
|
||||
}
|
||||
|
||||
string_subcommands[] = {
|
||||
|
|
|
@ -1302,8 +1302,10 @@ static void remove_internal_separator(wcstring *str, bool conv) {
|
|||
/// A stage in string expansion is represented as a function that takes an input and returns a list
|
||||
/// of output (by reference). We get flags and errors. It may return an error; if so expansion
|
||||
/// halts.
|
||||
typedef expand_error_t (*expand_stage_t)(const wcstring &input, std::vector<completion_t> *out,
|
||||
expand_flags_t flags, parse_error_list_t *errors);
|
||||
typedef expand_error_t (*expand_stage_t)(const wcstring &input, //!OCLINT(unused param)
|
||||
std::vector<completion_t> *out, //!OCLINT(unused param)
|
||||
expand_flags_t flags, //!OCLINT(unused param)
|
||||
parse_error_list_t *errors); //!OCLINT(unused param)
|
||||
|
||||
static expand_error_t expand_stage_cmdsubst(const wcstring &input, std::vector<completion_t> *out,
|
||||
expand_flags_t flags, parse_error_list_t *errors) {
|
||||
|
|
|
@ -769,7 +769,7 @@ void history_t::save_internal_unless_disabled() {
|
|||
}
|
||||
|
||||
// This might be a good candidate for moving to a background thread.
|
||||
time_profiler_t profiler(vacuum ? "save_internal vacuum"
|
||||
time_profiler_t profiler(vacuum ? "save_internal vacuum" //!OCLINT(unused var)
|
||||
: "save_internal no vacuum"); //!OCLINT(side-effect)
|
||||
this->save_internal(vacuum);
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
static int writeb_internal(char c);
|
||||
|
||||
/// The function used for output.
|
||||
static int (*out)(char c) = writeb_internal;
|
||||
static int (*out)(char c) = writeb_internal; //!OCLINT(unused param)
|
||||
|
||||
/// Whether term256 and term24bit are supported.
|
||||
static color_support_t color_support = 0;
|
||||
|
|
|
@ -428,6 +428,7 @@ RESOLVE_ONLY(end_command) = {KEYWORD(parse_keyword_end)};
|
|||
case (symbol_##sym): \
|
||||
resolver = resolve_##sym; \
|
||||
break;
|
||||
|
||||
const production_t *parse_productions::production_for_token(parse_token_type_t node_type,
|
||||
const parse_token_t &input1,
|
||||
const parse_token_t &input2,
|
||||
|
@ -436,8 +437,9 @@ const production_t *parse_productions::production_for_token(parse_token_type_t n
|
|||
token_type_description(node_type), input1.describe().c_str());
|
||||
|
||||
// Fetch the function to resolve the list of productions.
|
||||
const production_t *(*resolver)(const parse_token_t &input1, const parse_token_t &input2,
|
||||
parse_node_tag_t *out_tag) = NULL;
|
||||
const production_t *(*resolver)(const parse_token_t &input1, //!OCLINT(unused param)
|
||||
const parse_token_t &input2, //!OCLINT(unused param)
|
||||
parse_node_tag_t *out_tag) = NULL; //!OCLINT(unused param)
|
||||
switch (node_type) {
|
||||
TEST(job_list)
|
||||
TEST(job)
|
||||
|
|
|
@ -846,7 +846,6 @@ void wildcard_expander_t::expand(const wcstring &base_dir, const wchar_t *wc,
|
|||
} else {
|
||||
// Not the last segment, nonempty wildcard.
|
||||
assert(next_slash != NULL);
|
||||
wcstring child_effective_prefix = effective_prefix + wc_segment;
|
||||
this->expand_intermediate_segment(base_dir, dir, wc_segment, wc_remainder,
|
||||
effective_prefix + wc_segment + L'/');
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue