mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
eliminate many "unused parameter" warnings
Partially addresses issue #3430.
This commit is contained in:
parent
851e449347
commit
c07c98ac05
28 changed files with 125 additions and 35 deletions
|
@ -22,7 +22,7 @@ function __fish_unexpected_hist_args --no-scope-shadowing
|
|||
return 0
|
||||
end
|
||||
if set -q argv[1]
|
||||
printf (_ "%ls: %ls command expected %d args, got %d\n") $cmd $hist_cmd 0 (count $argv) >&2
|
||||
printf (_ "%ls: %ls expected %d args, got %d\n") $cmd $hist_cmd 0 (count $argv) >&2
|
||||
return 0
|
||||
end
|
||||
return 1
|
||||
|
|
|
@ -82,7 +82,7 @@ class autoload_t : private lru_cache_t<autoload_function_t> {
|
|||
|
||||
protected:
|
||||
/// Overridable callback for when a command is removed.
|
||||
virtual void command_removed(const wcstring &cmd) {}
|
||||
virtual void command_removed(const wcstring &cmd) { UNUSED(cmd); }
|
||||
|
||||
public:
|
||||
/// Create an autoload_t for the given environment variable name.
|
||||
|
|
|
@ -123,6 +123,7 @@ static int count_char(const wchar_t *str, wchar_t c) {
|
|||
/// A wcstring with a formatted manpage.
|
||||
///
|
||||
wcstring builtin_help_get(parser_t &parser, io_streams_t &streams, const wchar_t *name) {
|
||||
UNUSED(parser);
|
||||
// This won't ever work if no_exec is set.
|
||||
if (no_exec) return wcstring();
|
||||
|
||||
|
@ -1294,6 +1295,7 @@ static bool builtin_echo_parse_numeric_sequence(const wchar_t *str, size_t *cons
|
|||
/// Bash only respects -n if it's the first argument. We'll do the same. We also support a new
|
||||
/// option -s to mean "no spaces"
|
||||
static int builtin_echo(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
|
||||
UNUSED(parser);
|
||||
// Skip first arg
|
||||
if (!*argv++) return STATUS_BUILTIN_ERROR;
|
||||
|
||||
|
@ -1446,6 +1448,12 @@ static int builtin_echo(parser_t &parser, io_streams_t &streams, wchar_t **argv)
|
|||
/// The pwd builtin. We don't respect -P to resolve symbolic links because we
|
||||
/// try to always resolve them.
|
||||
static int builtin_pwd(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
|
||||
UNUSED(parser);
|
||||
if (argv[1] != NULL) {
|
||||
streams.err.append_format(BUILTIN_ERR_ARG_COUNT1, argv[0], 0, builtin_count_args(argv));
|
||||
return STATUS_BUILTIN_ERROR;
|
||||
}
|
||||
|
||||
wcstring res = wgetcwd();
|
||||
if (res.empty()) {
|
||||
return STATUS_BUILTIN_ERROR;
|
||||
|
@ -2402,6 +2410,7 @@ static int builtin_cd(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
|
|||
|
||||
/// Implementation of the builtin count command, used to count the number of arguments sent to it.
|
||||
static int builtin_count(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
|
||||
UNUSED(parser);
|
||||
int argc;
|
||||
argc = builtin_count_args(argv);
|
||||
streams.out.append_format(L"%d\n", argc - 1);
|
||||
|
@ -2726,6 +2735,11 @@ static int builtin_break_continue(parser_t &parser, io_streams_t &streams, wchar
|
|||
|
||||
/// Implementation of the builtin breakpoint command, used to launch the interactive debugger.
|
||||
static int builtin_breakpoint(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
|
||||
if (argv[1] != NULL) {
|
||||
streams.err.append_format(BUILTIN_ERR_ARG_COUNT1, argv[0], 0, builtin_count_args(argv));
|
||||
return STATUS_BUILTIN_ERROR;
|
||||
}
|
||||
|
||||
parser.push_block(new breakpoint_block_t());
|
||||
|
||||
reader_read(STDIN_FILENO, streams.io_chain ? *streams.io_chain : io_chain_t());
|
||||
|
@ -2846,7 +2860,7 @@ static bool set_hist_cmd(wchar_t *const cmd, hist_cmd_t *hist_cmd, hist_cmd_t su
|
|||
break; \
|
||||
} \
|
||||
if (args.size() != 0) { \
|
||||
streams.err.append_format(BUILTIN_ERR_ARG_COUNT, cmd, \
|
||||
streams.err.append_format(BUILTIN_ERR_ARG_COUNT2, cmd, \
|
||||
hist_cmd_to_string(hist_cmd).c_str(), 0, args.size()); \
|
||||
status = STATUS_BUILTIN_ERROR; \
|
||||
break; \
|
||||
|
@ -3094,10 +3108,22 @@ int builtin_parse(parser_t &parser, io_streams_t &streams, wchar_t **argv)
|
|||
#endif
|
||||
|
||||
int builtin_true(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
|
||||
UNUSED(parser);
|
||||
UNUSED(streams);
|
||||
if (argv[1] != NULL) {
|
||||
streams.err.append_format(BUILTIN_ERR_ARG_COUNT1, argv[0], 0, builtin_count_args(argv));
|
||||
return STATUS_BUILTIN_ERROR;
|
||||
}
|
||||
return STATUS_BUILTIN_OK;
|
||||
}
|
||||
|
||||
int builtin_false(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
|
||||
UNUSED(parser);
|
||||
UNUSED(streams);
|
||||
if (argv[1] != NULL) {
|
||||
streams.err.append_format(BUILTIN_ERR_ARG_COUNT1, argv[0], 0, builtin_count_args(argv));
|
||||
return STATUS_BUILTIN_ERROR;
|
||||
}
|
||||
return STATUS_BUILTIN_ERROR;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,8 @@ enum { COMMAND_NOT_BUILTIN, BUILTIN_REGULAR, BUILTIN_FUNCTION };
|
|||
#define BUILTIN_ERR_UNKNOWN _(L"%ls: Unknown option '%ls'\n")
|
||||
|
||||
/// Error message for unexpected args.
|
||||
#define BUILTIN_ERR_ARG_COUNT _(L"%ls: %ls command expected %d args, got %d\n")
|
||||
#define BUILTIN_ERR_ARG_COUNT1 _(L"%ls: expected %d args, got %d\n")
|
||||
#define BUILTIN_ERR_ARG_COUNT2 _(L"%ls: %ls expected %d args, got %d\n")
|
||||
|
||||
/// Error message for invalid character in variable name.
|
||||
#define BUILTIN_ERR_VARCHAR \
|
||||
|
|
|
@ -695,6 +695,7 @@ int builtin_printf_state_t::print_formatted(const wchar_t *format, int argc, wch
|
|||
|
||||
/// The printf builtin.
|
||||
int builtin_printf(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
|
||||
UNUSED(parser);
|
||||
builtin_printf_state_t state(streams);
|
||||
|
||||
wchar_t *format;
|
||||
|
|
|
@ -771,6 +771,7 @@ static bool unary_primary_evaluate(test_expressions::token_t token, const wcstri
|
|||
///
|
||||
/// Return status is the final shell status, i.e. 0 for true, 1 for false and 2 for error.
|
||||
int builtin_test(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
|
||||
UNUSED(parser);
|
||||
using namespace test_expressions;
|
||||
|
||||
// The first argument should be the name of the command ('test').
|
||||
|
|
|
@ -1340,6 +1340,7 @@ bool unescape_string(const wcstring &input, wcstring *output, unescape_flags_t e
|
|||
|
||||
void common_handle_winch(int signal) {
|
||||
// Don't run ioctl() here, it's not safe to use in signals.
|
||||
UNUSED(signal);
|
||||
termsize_valid = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -766,4 +766,10 @@ __attribute__((noinline)) void debug_thread_error(void);
|
|||
/// specified base, return -1.
|
||||
long convert_digit(wchar_t d, int base);
|
||||
|
||||
/// This is a macro that can be used to silence "unused parameter" warnings from the compiler for
|
||||
/// functions which need to accept parameters they do not use because they need to be compatible
|
||||
/// with an interface. It's similar to the Python idiom of doing `_ = expr` at the top of a
|
||||
/// function in the same situation.
|
||||
#define UNUSED(expr) do { (void)(expr); } while (0)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -267,7 +267,7 @@ static void react_to_variable_change(const wcstring &key) {
|
|||
|
||||
/// Universal variable callback function. This function makes sure the proper events are triggered
|
||||
/// when an event occurs.
|
||||
static void universal_callback(fish_message_type_t type, const wchar_t *name, const wchar_t *val) {
|
||||
static void universal_callback(fish_message_type_t type, const wchar_t *name) {
|
||||
const wchar_t *str = NULL;
|
||||
|
||||
switch (type) {
|
||||
|
@ -1102,7 +1102,7 @@ void env_universal_barrier() {
|
|||
// Post callbacks.
|
||||
for (size_t i = 0; i < changes.size(); i++) {
|
||||
const callback_data_t &data = changes.at(i);
|
||||
universal_callback(data.type, data.key.c_str(), data.val.c_str());
|
||||
universal_callback(data.type, data.key.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1299,6 +1299,7 @@ class universal_notifier_named_pipe_t : public universal_notifier_t {
|
|||
// select() on our fd for a while, and sync periodically until the fd is no longer readable.
|
||||
// However, if we are the one who posted the notification, we don't sync (until we clean
|
||||
// up!)
|
||||
UNUSED(fd);
|
||||
bool should_sync = false;
|
||||
if (readback_time_usec == 0) {
|
||||
polling_due_to_readable_fd = true;
|
||||
|
@ -1494,4 +1495,7 @@ bool universal_notifier_t::poll() { return false; }
|
|||
|
||||
unsigned long universal_notifier_t::usec_delay_between_polls() const { return 0; }
|
||||
|
||||
bool universal_notifier_t::notification_fd_became_readable(int fd) { return false; }
|
||||
bool universal_notifier_t::notification_fd_became_readable(int fd) {
|
||||
UNUSED(fd);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -159,6 +159,7 @@ char *get_interpreter(const char *command, char *interpreter, size_t buff_size)
|
|||
/// specified in \c p. It never returns. Called in a forked child! Do not allocate memory, etc.
|
||||
static void safe_launch_process(process_t *p, const char *actual_cmd, const char *const *cargv,
|
||||
const char *const *cenvv) {
|
||||
UNUSED(p);
|
||||
int err;
|
||||
// debug( 1, L"exec '%ls'", p->argv[0] );
|
||||
|
||||
|
|
|
@ -212,7 +212,7 @@ static int iswnumeric(const wchar_t *n) {
|
|||
}
|
||||
|
||||
/// See if the process described by \c proc matches the commandline \c cmd.
|
||||
static bool match_pid(const wcstring &cmd, const wchar_t *proc, int flags, size_t *offset) {
|
||||
static bool match_pid(const wcstring &cmd, const wchar_t *proc, size_t *offset) {
|
||||
// Test for a direct match. If the proc string is empty (e.g. the user tries to complete against
|
||||
// %), then return an offset pointing at the base command. That ensures that you don't see a
|
||||
// bunch of dumb paths when completing against all processes.
|
||||
|
@ -507,7 +507,7 @@ static int find_job(const struct find_job_data_t *info) {
|
|||
if (j->command_is_empty()) continue;
|
||||
|
||||
size_t offset;
|
||||
if (match_pid(j->command(), proc, flags, &offset)) {
|
||||
if (match_pid(j->command(), proc, &offset)) {
|
||||
if (flags & EXPAND_FOR_COMPLETIONS) {
|
||||
append_completion(&completions, j->command_wcstr() + offset + wcslen(proc),
|
||||
COMPLETE_JOB_DESC, 0);
|
||||
|
@ -527,7 +527,7 @@ static int find_job(const struct find_job_data_t *info) {
|
|||
if (p->actual_cmd.empty()) continue;
|
||||
|
||||
size_t offset;
|
||||
if (match_pid(p->actual_cmd, proc, flags, &offset)) {
|
||||
if (match_pid(p->actual_cmd, proc, &offset)) {
|
||||
if (flags & EXPAND_FOR_COMPLETIONS) {
|
||||
append_completion(&completions,
|
||||
wcstring(p->actual_cmd, offset + wcslen(proc)),
|
||||
|
@ -570,7 +570,7 @@ static void find_process(const wchar_t *proc, expand_flags_t flags,
|
|||
process_iterator_t iterator;
|
||||
while (iterator.next_process(&process_name, &process_pid)) {
|
||||
size_t offset;
|
||||
if (match_pid(process_name, proc, flags, &offset)) {
|
||||
if (match_pid(process_name, proc, &offset)) {
|
||||
if (flags & EXPAND_FOR_COMPLETIONS) {
|
||||
append_completion(out, process_name.c_str() + offset + wcslen(proc),
|
||||
COMPLETE_PROCESS_DESC, 0);
|
||||
|
@ -1381,6 +1381,7 @@ static expand_error_t expand_stage_home_and_pid(const wcstring &input,
|
|||
|
||||
static expand_error_t expand_stage_wildcards(const wcstring &input, std::vector<completion_t> *out,
|
||||
expand_flags_t flags, parse_error_list_t *errors) {
|
||||
UNUSED(errors);
|
||||
expand_error_t result = EXPAND_OK;
|
||||
wcstring path_to_expand = input;
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <signal.h> // IWYU pragma: keep
|
||||
#include <wchar.h> // IWYU pragma: keep
|
||||
|
||||
#include "common.h" // IWYU pragma: keep
|
||||
#include "fallback.h" // IWYU pragma: keep
|
||||
#include "util.h" // IWYU pragma: keep
|
||||
|
||||
|
@ -244,8 +245,15 @@ char *fish_bindtextdomain(const char *domainname, const char *dirname) {
|
|||
char *fish_textdomain(const char *domainname) { return textdomain(domainname); }
|
||||
#else
|
||||
char *fish_gettext(const char *msgid) { return (char *)msgid; }
|
||||
char *fish_bindtextdomain(const char *domainname, const char *dirname) { return NULL; }
|
||||
char *fish_textdomain(const char *domainname) { return NULL; }
|
||||
char *fish_bindtextdomain(const char *domainname, const char *dirname) {
|
||||
UNUSED(domainname);
|
||||
UNUSED(dirname);
|
||||
return NULL;
|
||||
}
|
||||
char *fish_textdomain(const char *domainname) {
|
||||
UNUSED(domainname);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_KILLPG
|
||||
|
|
|
@ -158,6 +158,7 @@ function_info_t::function_info_t(const function_info_t &data, const wchar_t *fil
|
|||
shadow_scope(data.shadow_scope) {}
|
||||
|
||||
void function_add(const function_data_t &data, const parser_t &parser, int definition_line_offset) {
|
||||
UNUSED(parser);
|
||||
ASSERT_IS_MAIN_THREAD();
|
||||
|
||||
CHECK(!data.name.empty(), );
|
||||
|
|
|
@ -1186,6 +1186,7 @@ const highlighter_t::color_array_t &highlighter_t::highlight() {
|
|||
|
||||
void highlight_shell(const wcstring &buff, std::vector<highlight_spec_t> &color, size_t pos,
|
||||
wcstring_list_t *error, const env_vars_snapshot_t &vars) {
|
||||
UNUSED(error);
|
||||
// Do something sucky and get the current working directory on this background thread. This
|
||||
// should really be passed in.
|
||||
const wcstring working_directory = env_get_pwd_slash();
|
||||
|
@ -1197,6 +1198,7 @@ void highlight_shell(const wcstring &buff, std::vector<highlight_spec_t> &color,
|
|||
|
||||
void highlight_shell_no_io(const wcstring &buff, std::vector<highlight_spec_t> &color, size_t pos,
|
||||
wcstring_list_t *error, const env_vars_snapshot_t &vars) {
|
||||
UNUSED(error);
|
||||
// Do something sucky and get the current working directory on this background thread. This
|
||||
// should really be passed in.
|
||||
const wcstring working_directory = env_get_pwd_slash();
|
||||
|
@ -1291,6 +1293,8 @@ static void highlight_universal_internal(const wcstring &buffstr,
|
|||
|
||||
void highlight_universal(const wcstring &buff, std::vector<highlight_spec_t> &color, size_t pos,
|
||||
wcstring_list_t *error, const env_vars_snapshot_t &vars) {
|
||||
UNUSED(error);
|
||||
UNUSED(vars);
|
||||
assert(buff.size() == color.size());
|
||||
std::fill(color.begin(), color.end(), 0);
|
||||
highlight_universal_internal(buff, color, pos);
|
||||
|
|
|
@ -1662,7 +1662,8 @@ static int threaded_perform_file_detection(file_detection_context_t *ctx) {
|
|||
}
|
||||
|
||||
static void perform_file_detection_done(file_detection_context_t *ctx,
|
||||
int success) { //!OCLINT(success is ignored)
|
||||
int success) {
|
||||
UNUSED(success);
|
||||
ASSERT_IS_MAIN_THREAD();
|
||||
|
||||
// Now that file detection is done, update the history item with the valid file paths.
|
||||
|
|
|
@ -116,6 +116,7 @@ static void *this_thread() { return (void *)(intptr_t)pthread_self(); }
|
|||
|
||||
/// The function that does thread work.
|
||||
static void *iothread_worker(void *unused) {
|
||||
UNUSED(unused);
|
||||
scoped_lock locker(s_spawn_queue_lock);
|
||||
struct SpawnRequest_t *req;
|
||||
while ((req = dequeue_spawn_request()) != NULL) {
|
||||
|
|
|
@ -93,7 +93,7 @@ class lru_cache_t {
|
|||
lru_node_t mouth;
|
||||
|
||||
/// Overridable callback for when a node is evicted.
|
||||
virtual void node_was_evicted(node_type_t *node) {}
|
||||
virtual void node_was_evicted(node_type_t *node) { UNUSED(node); }
|
||||
|
||||
public:
|
||||
/// Constructor
|
||||
|
@ -185,7 +185,8 @@ class lru_cache_t {
|
|||
public:
|
||||
explicit iterator(lru_node_t *val) : node(val) {}
|
||||
void operator++() { node = lru_cache_t::get_previous(node); }
|
||||
void operator++(int x) { node = lru_cache_t::get_previous(node); }
|
||||
//WTF
|
||||
//void operator++(int x) { node = lru_cache_t::get_previous(node); }
|
||||
bool operator==(const iterator &other) { return node == other.node; }
|
||||
bool operator!=(const iterator &other) { return !(*this == other); }
|
||||
node_type_t *operator*() { return static_cast<node_type_t *>(node); }
|
||||
|
|
|
@ -86,6 +86,9 @@ static int print_max(const wcstring &str, highlight_spec_t color, int max, bool
|
|||
line_t pager_t::completion_print_item(const wcstring &prefix, const comp_t *c, size_t row,
|
||||
size_t column, size_t width, bool secondary, bool selected,
|
||||
page_rendering_t *rendering) const {
|
||||
UNUSED(column);
|
||||
UNUSED(row);
|
||||
UNUSED(rendering);
|
||||
size_t comp_width = 0, desc_width = 0;
|
||||
size_t written = 0;
|
||||
line_t line_data;
|
||||
|
@ -254,8 +257,7 @@ static void join_completions(comp_info_list_t *comps) {
|
|||
}
|
||||
|
||||
/// Generate a list of comp_t structures from a list of completions.
|
||||
static comp_info_list_t process_completions_into_infos(const completion_list_t &lst,
|
||||
const wcstring &prefix) {
|
||||
static comp_info_list_t process_completions_into_infos(const completion_list_t &lst) {
|
||||
const size_t lst_size = lst.size();
|
||||
|
||||
// Make the list of the correct size up-front.
|
||||
|
@ -340,7 +342,7 @@ void pager_t::refilter_completions() {
|
|||
|
||||
void pager_t::set_completions(const completion_list_t &raw_completions) {
|
||||
// Get completion infos out of it.
|
||||
unfiltered_completion_infos = process_completions_into_infos(raw_completions, prefix);
|
||||
unfiltered_completion_infos = process_completions_into_infos(raw_completions);
|
||||
|
||||
// Maybe join them.
|
||||
if (prefix == L"-") join_completions(&unfiltered_completion_infos);
|
||||
|
|
|
@ -1076,6 +1076,7 @@ parse_execution_result_t parse_execution_context_t::populate_block_process(
|
|||
job_t *job, process_t *proc, const parse_node_t &statement_node) {
|
||||
// We handle block statements by creating INTERNAL_BLOCK_NODE, that will bounce back to us when
|
||||
// it's time to execute them.
|
||||
UNUSED(job);
|
||||
assert(statement_node.type == symbol_block_statement ||
|
||||
statement_node.type == symbol_if_statement ||
|
||||
statement_node.type == symbol_switch_statement);
|
||||
|
@ -1133,6 +1134,7 @@ parse_execution_result_t parse_execution_context_t::populate_job_process(
|
|||
|
||||
parse_execution_result_t parse_execution_context_t::populate_job_from_job_node(
|
||||
job_t *j, const parse_node_t &job_node, const block_t *associated_block) {
|
||||
UNUSED(associated_block);
|
||||
assert(job_node.type == symbol_job);
|
||||
|
||||
// Tell the job what its command is.
|
||||
|
|
|
@ -80,6 +80,7 @@ RESOLVE(job_list) {
|
|||
RESOLVE_ONLY(job) = {symbol_statement, symbol_job_continuation, symbol_optional_background};
|
||||
|
||||
RESOLVE(job_continuation) {
|
||||
UNUSED(out_tag);
|
||||
P empty = {};
|
||||
P piped = {parse_token_type_pipe, symbol_statement, symbol_job_continuation};
|
||||
switch (token1.type) {
|
||||
|
@ -94,6 +95,7 @@ RESOLVE(job_continuation) {
|
|||
|
||||
// A statement is a normal command, or an if / while / and etc.
|
||||
RESOLVE(statement) {
|
||||
UNUSED(out_tag);
|
||||
P boolean = {symbol_boolean_statement};
|
||||
P block = {symbol_block_statement};
|
||||
P ifs = {symbol_if_statement};
|
||||
|
|
|
@ -285,6 +285,7 @@ pid_t execute_fork(bool wait_for_threads_to_die) {
|
|||
bool fork_actions_make_spawn_properties(posix_spawnattr_t *attr,
|
||||
posix_spawn_file_actions_t *actions, job_t *j, process_t *p,
|
||||
const io_chain_t &io_chain) {
|
||||
UNUSED(p);
|
||||
// Initialize the output.
|
||||
if (posix_spawnattr_init(attr) != 0) {
|
||||
return false;
|
||||
|
|
14
src/proc.cpp
14
src/proc.cpp
|
@ -254,12 +254,12 @@ int job_signal(job_t *j, int signal) {
|
|||
int res = 0;
|
||||
|
||||
if (j->pgid != my_pid) {
|
||||
res = killpg(j->pgid, SIGHUP);
|
||||
res = killpg(j->pgid, signal);
|
||||
} else {
|
||||
for (process_t *p = j->first_process; p; p = p->next) {
|
||||
if (!p->completed) {
|
||||
if (p->pid) {
|
||||
if (kill(p->pid, SIGHUP)) {
|
||||
if (kill(p->pid, signal)) {
|
||||
res = -1;
|
||||
break;
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ int job_signal(job_t *j, int signal) {
|
|||
}
|
||||
|
||||
/// Store the status of the process pid that was returned by waitpid.
|
||||
static void mark_process_status(const job_t *j, process_t *p, int status) {
|
||||
static void mark_process_status(process_t *p, int status) {
|
||||
// debug( 0, L"Process %ls %ls", p->argv[0], WIFSTOPPED (status)?L"stopped":(WIFEXITED( status
|
||||
// )?L"exited":(WIFSIGNALED( status )?L"signaled to exit":L"BLARGH")) );
|
||||
p->status = status;
|
||||
|
@ -291,6 +291,7 @@ static void mark_process_status(const job_t *j, process_t *p, int status) {
|
|||
void job_mark_process_as_failed(const job_t *job, process_t *p) {
|
||||
// The given process failed to even lift off (e.g. posix_spawn failed) and so doesn't have a
|
||||
// valid pid. Mark it as dead.
|
||||
UNUSED(job);
|
||||
for (process_t *cursor = p; cursor != NULL; cursor = cursor->next) {
|
||||
cursor->completed = 1;
|
||||
}
|
||||
|
@ -310,7 +311,7 @@ static void handle_child_status(pid_t pid, int status) {
|
|||
process_t *prev = 0;
|
||||
for (p = j->first_process; p; p = p->next) {
|
||||
if (pid == p->pid) {
|
||||
mark_process_status(j, p, status);
|
||||
mark_process_status(p, status);
|
||||
if (p->completed && prev != 0) {
|
||||
if (!prev->completed && prev->pid) {
|
||||
kill(prev->pid, SIGPIPE);
|
||||
|
@ -455,7 +456,10 @@ static int process_mark_finished_children(bool wants_await) {
|
|||
}
|
||||
|
||||
/// This is called from a signal handler. The signal is always SIGCHLD.
|
||||
void job_handle_signal(int signal, siginfo_t *info, void *con) {
|
||||
void job_handle_signal(int signal, siginfo_t *info, void *context) {
|
||||
UNUSED(signal);
|
||||
UNUSED(info);
|
||||
UNUSED(context);
|
||||
// This is the only place that this generation count is modified. It's OK if it overflows.
|
||||
s_sigchld_generation_count += 1;
|
||||
}
|
||||
|
|
|
@ -468,7 +468,7 @@ static void reader_kill(editable_line_t *el, size_t begin_idx, size_t length, in
|
|||
}
|
||||
|
||||
// This is called from a signal handler!
|
||||
void reader_handle_int(int sig) {
|
||||
void reader_handle_sigint() {
|
||||
if (!is_interactive_read) {
|
||||
parser_t::skip_all_blocks();
|
||||
}
|
||||
|
@ -846,7 +846,10 @@ void reader_repaint_if_needed() {
|
|||
}
|
||||
}
|
||||
|
||||
static void reader_repaint_if_needed_one_arg(void *unused) { reader_repaint_if_needed(); }
|
||||
static void reader_repaint_if_needed_one_arg(void *unused) {
|
||||
UNUSED(unused);
|
||||
reader_repaint_if_needed();
|
||||
}
|
||||
|
||||
void reader_react_to_color_change() {
|
||||
if (!data) return;
|
||||
|
@ -2003,7 +2006,13 @@ parser_test_error_bits_t reader_shell_test(const wchar_t *b) {
|
|||
|
||||
/// Test if the given string contains error. Since this is the error detection for general purpose,
|
||||
/// there are no invalid strings, so this function always returns false.
|
||||
static parser_test_error_bits_t default_test(const wchar_t *b) { return 0; }
|
||||
///
|
||||
/// TODO: Possibly remove this. It is called from only only one place: reader_push().Since it always
|
||||
/// returns a static result it's not clear why it's needed.
|
||||
static parser_test_error_bits_t default_test(const wchar_t *b) {
|
||||
UNUSED(b);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void reader_push(const wchar_t *name) {
|
||||
reader_data_t *n = new reader_data_t();
|
||||
|
@ -2149,6 +2158,7 @@ static void highlight_search(void) {
|
|||
}
|
||||
|
||||
static void highlight_complete(background_highlight_context_t *ctx, int result) {
|
||||
UNUSED(result); // ignored because of the indirect invocation via iothread_perform()
|
||||
ASSERT_IS_MAIN_THREAD();
|
||||
if (ctx->string_to_highlight == data->command_line.text) {
|
||||
// The data hasn't changed, so swap in our colors. The colors may not have changed, so do
|
||||
|
|
|
@ -192,7 +192,7 @@ void reader_set_exit_on_interrupt(bool flag);
|
|||
bool shell_is_exiting();
|
||||
|
||||
/// The readers interrupt signal handler. Cancels all currently running blocks.
|
||||
void reader_handle_int(int signal);
|
||||
void reader_handle_sigint();
|
||||
|
||||
/// This function returns true if fish is exiting by force, i.e. because stdin died.
|
||||
int reader_exit_forced();
|
||||
|
|
|
@ -528,6 +528,7 @@ static void s_move(screen_t *s, data_buffer_t *b, int new_x, int new_y) {
|
|||
|
||||
/// Set the pen color for the terminal.
|
||||
static void s_set_color(screen_t *s, data_buffer_t *b, highlight_spec_t c) {
|
||||
UNUSED(s);
|
||||
scoped_buffer_t scoped_buffer(b);
|
||||
|
||||
unsigned int uc = (unsigned int)c;
|
||||
|
@ -893,6 +894,7 @@ 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 int *indent) {
|
||||
UNUSED(s);
|
||||
screen_layout_t result = {};
|
||||
|
||||
// Start by ensuring that the prompts themselves can fit.
|
||||
|
|
|
@ -192,6 +192,8 @@ const wchar_t *signal_get_desc(int sig) {
|
|||
|
||||
/// Standard signal handler.
|
||||
static void default_handler(int signal, siginfo_t *info, void *context) {
|
||||
UNUSED(info);
|
||||
UNUSED(context);
|
||||
if (event_is_signal_observed(signal)) {
|
||||
event_fire_signal(signal);
|
||||
}
|
||||
|
@ -200,6 +202,8 @@ static void default_handler(int signal, siginfo_t *info, void *context) {
|
|||
#ifdef SIGWINCH
|
||||
/// Respond to a winch signal by checking the terminal size.
|
||||
static void handle_winch(int sig, siginfo_t *info, void *context) {
|
||||
UNUSED(info);
|
||||
UNUSED(context);
|
||||
common_handle_winch(sig);
|
||||
default_handler(sig, 0, 0);
|
||||
}
|
||||
|
@ -208,6 +212,8 @@ static void handle_winch(int sig, siginfo_t *info, void *context) {
|
|||
/// Respond to a hup signal by exiting, unless it is caught by a shellscript function, in which case
|
||||
/// we do nothing.
|
||||
static void handle_hup(int sig, siginfo_t *info, void *context) {
|
||||
UNUSED(info);
|
||||
UNUSED(context);
|
||||
if (event_is_signal_observed(SIGHUP)) {
|
||||
default_handler(sig, 0, 0);
|
||||
} else {
|
||||
|
@ -217,6 +223,9 @@ static void handle_hup(int sig, siginfo_t *info, void *context) {
|
|||
|
||||
/// Handle sigterm. The only thing we do is restore the front process ID, then die.
|
||||
static void handle_term(int sig, siginfo_t *info, void *context) {
|
||||
UNUSED(sig);
|
||||
UNUSED(info);
|
||||
UNUSED(context);
|
||||
restore_term_foreground_process_group();
|
||||
signal(SIGTERM, SIG_DFL);
|
||||
raise(SIGTERM);
|
||||
|
@ -225,7 +234,7 @@ static void handle_term(int sig, siginfo_t *info, void *context) {
|
|||
/// Interactive mode ^C handler. Respond to int signal by setting interrupted-flag and stopping all
|
||||
/// loops and conditionals.
|
||||
static void handle_int(int sig, siginfo_t *info, void *context) {
|
||||
reader_handle_int(sig);
|
||||
reader_handle_sigint();
|
||||
default_handler(sig, info, context);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,15 +2,15 @@ history: Invalid combination of options,
|
|||
you cannot do both 'search' and 'merge' in the same invocation
|
||||
history: you cannot use any options with the clear command
|
||||
history: you cannot use any options with the merge command
|
||||
history: save command expected 0 args, got 1
|
||||
history: save expected 0 args, got 1
|
||||
history: you cannot use any options with the save command
|
||||
history: you cannot use any options with the clear command
|
||||
history: merge command expected 0 args, got 1
|
||||
history: clear command expected 0 args, got 2
|
||||
history: merge expected 0 args, got 1
|
||||
history: clear expected 0 args, got 2
|
||||
|
||||
history: you cannot use any options with the clear command
|
||||
history: you cannot use any options with the merge command
|
||||
history: save command expected 0 args, got 1
|
||||
history: save expected 0 args, got 1
|
||||
history: you cannot use any options with the clear command
|
||||
history: you cannot use any options with the merge command
|
||||
|
||||
|
@ -18,7 +18,7 @@ history: Invalid combination of options,
|
|||
you cannot do both 'search' and 'merge' in the same invocation
|
||||
history: you cannot use any options with the save command
|
||||
history: you cannot use any options with the clear command
|
||||
history: merge command expected 0 args, got 1
|
||||
history: clear command expected 0 args, got 2
|
||||
history: merge expected 0 args, got 1
|
||||
history: clear expected 0 args, got 2
|
||||
history: you cannot use any options with the save command
|
||||
history: you cannot use any options with the merge command
|
||||
|
|
Loading…
Reference in a new issue