Remove explicit 'void' parameters.

This commit is contained in:
ridiculousfish 2018-02-18 18:33:04 -08:00
parent 50541544f2
commit 74e6a82849
16 changed files with 79 additions and 79 deletions

View file

@ -527,7 +527,7 @@ int builtin_run(parser_t &parser, const wchar_t *const *argv, io_streams_t &stre
}
/// Returns a list of all builtin names.
wcstring_list_t builtin_get_names(void) {
wcstring_list_t builtin_get_names() {
wcstring_list_t result;
result.reserve(BUILTIN_COUNT);
for (size_t i = 0; i < BUILTIN_COUNT; i++) {

View file

@ -166,7 +166,7 @@ static const named_color_t named_colors[] = {
{L"brcyan", 14, {0x00, 0xFF, 0xFF}, false}, {L"brwhite", 15, {0xFF, 0xFF, 0xFF}, false},
};
wcstring_list_t rgb_color_t::named_color_names(void) {
wcstring_list_t rgb_color_t::named_color_names() {
size_t count = sizeof named_colors / sizeof *named_colors;
wcstring_list_t result;
result.reserve(1 + count);

View file

@ -1922,9 +1922,9 @@ __attribute__((noinline)) void debug_thread_error(void) {
void set_main_thread() { main_thread_id = pthread_self(); }
void configure_thread_assertions_for_testing(void) { thread_asserts_cfg_for_testing = true; }
void configure_thread_assertions_for_testing() { thread_asserts_cfg_for_testing = true; }
bool is_forked_child(void) {
bool is_forked_child() {
// Just bail if nobody's called setup_fork_guards, e.g. some of our tools.
if (!initial_pid) return false;
@ -1936,16 +1936,16 @@ bool is_forked_child(void) {
return is_child_of_fork;
}
void setup_fork_guards(void) {
void setup_fork_guards() {
// Notice when we fork by stashing our pid. This seems simpler than pthread_atfork().
initial_pid = getpid();
}
void save_term_foreground_process_group(void) {
void save_term_foreground_process_group() {
initial_fg_process_group = tcgetpgrp(STDIN_FILENO);
}
void restore_term_foreground_process_group(void) {
void restore_term_foreground_process_group() {
if (initial_fg_process_group == -1) return;
// This is called during shutdown and from a signal handler. We don't bother to complain on
// failure because doing so is unlikely to be noticed.

View file

@ -75,7 +75,7 @@ void complete_set_variable_names(const wcstring_list_t *names) {
s_override_variable_names = names;
}
static inline wcstring_list_t complete_get_variable_names(void) {
static inline wcstring_list_t complete_get_variable_names() {
if (s_override_variable_names != NULL) {
return *s_override_variable_names;
}
@ -313,7 +313,7 @@ class completer_t {
completer_t(const wcstring &c, completion_request_flags_t f) : flags(f), initial_cmd(c) {}
bool empty() const { return completions.empty(); }
const std::vector<completion_t> &get_completions(void) { return completions; }
const std::vector<completion_t> &get_completions() { return completions; }
bool try_complete_variable(const wcstring &str);
bool try_complete_user(const wcstring &str);

View file

@ -703,7 +703,7 @@ void env_set_read_limit() {
}
}
wcstring env_get_pwd_slash(void) {
wcstring env_get_pwd_slash() {
auto pwd_var = env_get(L"PWD");
if (pwd_var.missing_or_empty()) {
return L"";
@ -1298,7 +1298,7 @@ const wcstring_list_t &env_var_t::as_list() const { return vals; }
/// Return a string representation of the var. At the present time this uses the legacy 2.x
/// encoding.
wcstring env_var_t::as_string(void) const {
wcstring env_var_t::as_string() const {
if (this->vals.empty()) return wcstring(ENV_NULL);
wchar_t sep = (flags & flag_colon_delimit) ? L':' : ARRAY_SEP;

View file

@ -374,9 +374,9 @@ class process_iterator_t {
bool next_process(wcstring *out_str, pid_t *out_pid);
};
process_iterator_t::process_iterator_t(void) { dir = opendir("/proc"); }
process_iterator_t::process_iterator_t() { dir = opendir("/proc"); }
process_iterator_t::~process_iterator_t(void) {
process_iterator_t::~process_iterator_t() {
if (dir) closedir(dir);
}

View file

@ -390,7 +390,7 @@ static void test_escape_quotes() {
do_test(parse_util_escape_string_with_quote(L"foo\\\\bar", L'"') == L"foo\\\\\\\\bar");
}
static void test_format(void) {
static void test_format() {
say(L"Testing formatting functions");
struct {
unsigned long long val;
@ -478,7 +478,7 @@ static void test_convert() {
}
/// Verify correct behavior with embedded nulls.
static void test_convert_nulls(void) {
static void test_convert_nulls() {
say(L"Testing convert_nulls");
const wchar_t in[] = L"AAA\0BBB";
const size_t in_len = (sizeof in / sizeof *in) - 1;
@ -603,7 +603,7 @@ static int test_iothread_thread_call(std::atomic<int> *addr) {
return after;
}
static void test_iothread(void) {
static void test_iothread() {
say(L"Testing iothreads");
std::unique_ptr<std::atomic<int>> int_ptr = make_unique<std::atomic<int>>(0);
int iterations = 50000;
@ -1284,7 +1284,7 @@ static void test_utf8() {
#endif
}
static void test_escape_sequences(void) {
static void test_escape_sequences() {
say(L"Testing escape_sequences");
if (escape_code_length(L"") != 0) err(L"test_escape_sequences failed on line %d\n", __LINE__);
if (escape_code_length(L"abcd") != 0)
@ -1339,7 +1339,7 @@ class test_lru_t : public lru_cache_t<test_lru_t, int> {
}
};
static void test_lru(void) {
static void test_lru() {
say(L"Testing LRU cache");
test_lru_t cache;
@ -1601,7 +1601,7 @@ static void test_expand() {
popd();
}
static void test_fuzzy_match(void) {
static void test_fuzzy_match() {
say(L"Testing fuzzy string matching");
if (string_fuzzy_match_string(L"", L"").type != fuzzy_match_exact)
@ -1622,7 +1622,7 @@ static void test_fuzzy_match(void) {
err(L"test_fuzzy_match failed on line %ld", __LINE__);
}
static void test_abbreviations(void) {
static void test_abbreviations() {
say(L"Testing abbreviations");
env_push(true);
@ -2155,7 +2155,7 @@ static void test_colors() {
do_test(rgb_color_t(L"mooganta").is_none());
}
static void test_complete(void) {
static void test_complete() {
say(L"Testing complete");
const wchar_t *name_strs[] = {L"Foo1", L"Foo2", L"Foo3", L"Bar1", L"Bar2", L"Bar3"};
@ -2869,15 +2869,15 @@ static void test_universal_notifiers() {
class history_tests_t {
public:
static void test_history(void);
static void test_history_merge(void);
static void test_history_formats(void);
static void test_history();
static void test_history_merge();
static void test_history_formats();
// static void test_history_speed(void);
static void test_history_races(void);
static void test_history_races();
static void test_history_races_pound_on_history(size_t item_count);
};
static wcstring random_string(void) {
static wcstring random_string() {
wcstring result;
size_t max = 1 + rand() % 32;
while (max--) {
@ -2887,7 +2887,7 @@ static wcstring random_string(void) {
return result;
}
void history_tests_t::test_history(void) {
void history_tests_t::test_history() {
history_search_t searcher;
say(L"Testing history");
@ -2992,7 +2992,7 @@ void history_tests_t::test_history(void) {
}
// Wait until the next second.
static void time_barrier(void) {
static void time_barrier() {
time_t start = time(NULL);
do {
usleep(1000);
@ -3019,7 +3019,7 @@ void history_tests_t::test_history_races_pound_on_history(size_t item_count) {
}
}
void history_tests_t::test_history_races(void) {
void history_tests_t::test_history_races() {
say(L"Testing history race conditions");
// Test concurrent history writing.
@ -3114,7 +3114,7 @@ void history_tests_t::test_history_races(void) {
hist.clear();
}
void history_tests_t::test_history_merge(void) {
void history_tests_t::test_history_merge() {
// In a single fish process, only one history is allowed to exist with the given name But it's
// common to have multiple history instances with the same name active in different processes,
// e.g. when you have multiple shells open. We try to get that right and merge all their history
@ -3258,7 +3258,7 @@ static bool history_equals(history_t &hist, const wchar_t *const *strings) {
return true;
}
void history_tests_t::test_history_formats(void) {
void history_tests_t::test_history_formats() {
const wchar_t *name;
// Test inferring and reading legacy and bash history formats.
@ -3361,7 +3361,7 @@ void history_tests_t::test_history_speed(void)
}
#endif
static void test_new_parser_correctness(void) {
static void test_new_parser_correctness() {
say(L"Testing new parser!");
const struct parser_test_t {
const wchar_t *src;
@ -3416,7 +3416,7 @@ static inline bool string_for_permutation(const wcstring *fuzzes, size_t fuzz_co
return remaining_permutation == 0;
}
static void test_new_parser_fuzzing(void) {
static void test_new_parser_fuzzing() {
say(L"Fuzzing parser (node size: %lu)", sizeof(parse_node_t));
const wcstring fuzzes[] = {
L"if", L"else", L"for", L"in", L"while", L"begin", L"function",
@ -3509,7 +3509,7 @@ static void check_function_help(const wchar_t *src) {
// command handling. In particular, 'command foo' should be a decorated statement 'foo' but 'command
// -help' should be an undecorated statement 'command' with argument '--help', and NOT attempt to
// run a command called '--help'.
static void test_new_parser_ll2(void) {
static void test_new_parser_ll2() {
say(L"Testing parser two-token lookahead");
const struct {
@ -3576,7 +3576,7 @@ static void test_new_parser_ad_hoc() {
}
}
static void test_new_parser_errors(void) {
static void test_new_parser_errors() {
say(L"Testing new parser error reporting");
const struct {
const wchar_t *src;
@ -3728,7 +3728,7 @@ static void test_error_messages() {
}
}
static void test_highlighting(void) {
static void test_highlighting() {
say(L"Testing syntax highlighting");
if (system("mkdir -p test/fish_highlight_test/")) err(L"mkdir failed");
if (system("touch test/fish_highlight_test/foo")) err(L"touch failed");
@ -3931,7 +3931,7 @@ static void test_highlighting(void) {
}
}
static void test_wcstring_tok(void) {
static void test_wcstring_tok() {
say(L"Testing wcstring_tok");
wcstring buff = L"hello world";
wcstring needle = L" \t\n";
@ -3980,7 +3980,7 @@ static void run_one_string_test(const wchar_t **argv, int expected_rc,
}
}
static void test_string(void) {
static void test_string() {
static struct string_test {
const wchar_t *argv[15];
int expected_rc;
@ -4301,7 +4301,7 @@ long return_timezone_hour(time_t tstamp, const wchar_t *timezone) {
}
/// Verify that setting special env vars have the expected effect on the current shell process.
static void test_timezone_env_vars(void) {
static void test_timezone_env_vars() {
// Confirm changing the timezone affects fish's idea of the local time.
time_t tstamp = time(NULL);
@ -4314,12 +4314,12 @@ static void test_timezone_env_vars(void) {
}
/// Verify that setting special env vars have the expected effect on the current shell process.
static void test_env_vars(void) {
static void test_env_vars() {
test_timezone_env_vars();
// TODO: Add tests for the locale and ncurses vars.
}
static void test_illegal_command_exit_code(void) {
static void test_illegal_command_exit_code() {
say(L"Testing illegal command exit code");
// We need to be in an empty directory so that none of the wildcards match a file that might be

View file

@ -942,7 +942,7 @@ std::unordered_map<long, wcstring> history_t::items_at_indexes(const std::vector
return result;
}
void history_t::populate_from_mmap(void) {
void history_t::populate_from_mmap() {
mmap_type = infer_file_type(mmap_start, mmap_length);
size_t cursor = 0;
for (;;) {
@ -1011,7 +1011,7 @@ bool history_t::map_file(const wcstring &name, const char **out_map_start, size_
return result;
}
bool history_t::load_old_if_needed(void) {
bool history_t::load_old_if_needed() {
if (loaded_old) return true;
loaded_old = true;
@ -1078,13 +1078,13 @@ bool history_search_t::go_backwards() {
}
/// Goes to the end (forwards).
void history_search_t::go_to_end(void) { prev_matches.clear(); }
void history_search_t::go_to_end() { prev_matches.clear(); }
/// Returns if we are at the end, which is where we start.
bool history_search_t::is_at_end(void) const { return prev_matches.empty(); }
bool history_search_t::is_at_end() const { return prev_matches.empty(); }
/// Goes to the beginning (backwards).
void history_search_t::go_to_beginning(void) {
void history_search_t::go_to_beginning() {
// Go backwards as far as we can.
while (go_backwards()) { //!OCLINT(empty while statement)
// Do nothing.
@ -1547,7 +1547,7 @@ void history_t::save_internal(bool vacuum) {
}
}
void history_t::save(void) {
void history_t::save() {
scoped_lock locker(lock);
this->save_internal(false);
}
@ -1667,7 +1667,7 @@ void history_t::enable_automatic_saving() {
save_internal_unless_disabled();
}
void history_t::clear(void) {
void history_t::clear() {
scoped_lock locker(lock);
new_items.clear();
deleted_items.clear();
@ -1678,7 +1678,7 @@ void history_t::clear(void) {
this->clear_file_state();
}
bool history_t::is_empty(void) {
bool history_t::is_empty() {
scoped_lock locker(lock);
// If we have new items, we're not empty.

View file

@ -39,11 +39,11 @@ static std::deque<wchar_t> lookahead_list;
// Queue of pairs of (function pointer, argument) to be invoked. Expected to be mostly empty.
typedef std::list<std::function<void(void)>> callback_queue_t;
static callback_queue_t callback_queue;
static void input_flush_callbacks(void);
static void input_flush_callbacks();
static bool has_lookahead(void) { return !lookahead_list.empty(); }
static bool has_lookahead() { return !lookahead_list.empty(); }
static wint_t lookahead_pop(void) {
static wint_t lookahead_pop() {
wint_t result = lookahead_list.front();
lookahead_list.pop_front();
return result;
@ -53,7 +53,7 @@ static void lookahead_push_back(wint_t c) { lookahead_list.push_back(c); }
static void lookahead_push_front(wint_t c) { lookahead_list.push_front(c); }
static wint_t lookahead_front(void) { return lookahead_list.front(); }
static wint_t lookahead_front() { return lookahead_list.front(); }
/// Callback function for handling interrupts on reading.
static int (*interrupt_handler)();
@ -238,7 +238,7 @@ void input_common_add_callback(std::function<void(void)> callback) {
callback_queue.push_back(std::move(callback));
}
static void input_flush_callbacks(void) {
static void input_flush_callbacks() {
// We move the queue into a local variable, so that events queued up during a callback don't get
// fired until next round.
ASSERT_IS_MAIN_THREAD();

View file

@ -30,7 +30,7 @@
#define IO_SERVICE_MAIN_THREAD_REQUEST_QUEUE 99
#define IO_SERVICE_RESULT_QUEUE 100
static void iothread_service_main_thread_requests(void);
static void iothread_service_main_thread_requests();
static void iothread_service_result_queue();
typedef std::function<void(void)> void_function_t;
@ -80,7 +80,7 @@ static std::queue<main_thread_request_t *> s_main_thread_request_queue;
// Notifying pipes.
static int s_read_pipe, s_write_pipe;
static void iothread_init(void) {
static void iothread_init() {
static bool inited = false;
if (!inited) {
inited = true;
@ -197,12 +197,12 @@ int iothread_perform_impl(void_function_t &&func, void_function_t &&completion)
return local_thread_count;
}
int iothread_port(void) {
int iothread_port() {
iothread_init();
return s_read_pipe;
}
void iothread_service_completion(void) {
void iothread_service_completion() {
ASSERT_IS_MAIN_THREAD();
char wakeup_byte;
@ -238,7 +238,7 @@ static bool iothread_wait_for_pending_completions(long timeout_usec) {
/// At the moment, this function is only used in the test suite and in a
/// drain-all-threads-before-fork compatibility mode that no architecture requires, so it's OK that
/// it's terrible.
void iothread_drain_all(void) {
void iothread_drain_all() {
ASSERT_IS_MAIN_THREAD();
ASSERT_IS_NOT_FORKED_CHILD();
@ -262,7 +262,7 @@ void iothread_drain_all(void) {
}
/// "Do on main thread" support.
static void iothread_service_main_thread_requests(void) {
static void iothread_service_main_thread_requests() {
ASSERT_IS_MAIN_THREAD();
// Move the queue to a local variable.

View file

@ -52,7 +52,7 @@ int (*output_get_writer())(char) { return out; }
/// Returns true if we think tparm can handle outputting a color index
static bool term_supports_color_natively(unsigned int c) { return (unsigned)max_colors >= c + 1; }
color_support_t output_get_color_support(void) { return color_support; }
color_support_t output_get_color_support() { return color_support; }
void output_set_color_support(color_support_t val) { color_support = val; }

View file

@ -344,7 +344,7 @@ struct parse_stack_element_t {
explicit parse_stack_element_t(production_element_t e, node_offset_t idx)
: type(production_element_type(e)), keyword(production_element_keyword(e)), node_idx(idx) {}
wcstring describe(void) const {
wcstring describe() const {
wcstring result = token_type_description(type);
if (keyword != parse_keyword_none) {
append_format(result, L" <%ls>", keyword_description(keyword));
@ -353,7 +353,7 @@ struct parse_stack_element_t {
}
/// Returns a name that we can show to the user, e.g. "a command".
wcstring user_presentable_description(void) const {
wcstring user_presentable_description() const {
return token_type_user_presentable_description(type, keyword);
}
};
@ -480,7 +480,7 @@ class parse_ll_t {
void report_tokenizer_error(const tok_t &tok);
/// Indicate if we hit a fatal error.
bool has_fatal_error(void) const { return this->fatal_errored; }
bool has_fatal_error() const { return this->fatal_errored; }
/// Indicate whether we want to generate error messages.
void set_should_generate_error_messages(bool flag) {
@ -534,7 +534,7 @@ void parse_ll_t::dump_stack(void) const {
// nodes an empty source range (but with a valid offset). We do this by walking forward. If a child
// of a node has an invalid source range, we set it equal to the end of the source range of its
// previous child.
void parse_ll_t::determine_node_ranges(void) {
void parse_ll_t::determine_node_ranges() {
size_t idx = nodes.size();
while (idx--) {
parse_node_t *parent = &nodes[idx];

View file

@ -106,7 +106,7 @@ parser_t::~parser_t() {}
static parser_t s_principal_parser;
parser_t &parser_t::principal_parser(void) {
parser_t &parser_t::principal_parser() {
ASSERT_IS_NOT_FORKED_CHILD();
ASSERT_IS_MAIN_THREAD();
return s_principal_parser;
@ -116,7 +116,7 @@ void parser_t::set_is_within_fish_initialization(bool flag) {
is_within_fish_initialization = flag;
}
void parser_t::skip_all_blocks(void) {
void parser_t::skip_all_blocks() {
// Tell all blocks to skip.
// This may be called from a signal handler!
s_principal_parser.cancellation_requested = true;

View file

@ -54,7 +54,7 @@
/// Status of last process to exit.
static int last_status = 0;
bool job_list_is_empty(void) {
bool job_list_is_empty() {
ASSERT_IS_MAIN_THREAD();
return parser_t::principal_parser().job_list().empty();
}
@ -103,7 +103,7 @@ static int is_interactive = -1;
static bool proc_had_barrier = false;
bool shell_is_interactive(void) {
bool shell_is_interactive() {
ASSERT_IS_MAIN_THREAD();
// is_interactive is statically initialized to -1. Ensure it has been dynamically set
// before we're called.
@ -161,7 +161,7 @@ int proc_get_last_status() { return last_status; }
// corresponding to that slot is in use. The job ID corresponding to slot 0 is 1.
static owning_lock<std::vector<bool>> locked_consumed_job_ids;
job_id_t acquire_job_id(void) {
job_id_t acquire_job_id() {
auto &&locker = locked_consumed_job_ids.acquire();
std::vector<bool> &consumed_job_ids = locker.value;

View file

@ -1191,7 +1191,7 @@ static std::function<autosuggestion_result_t(void)> get_autosuggestion_performer
};
}
static bool can_autosuggest(void) {
static bool can_autosuggest() {
// We autosuggest if suppress_autosuggestion is not set, if we're not doing a history search,
// and our command line contains a non-whitespace character.
const editable_line_t *el = data->active_edit_line();
@ -1212,7 +1212,7 @@ static void autosuggest_completed(autosuggestion_result_t result) {
}
}
static void update_autosuggestion(void) {
static void update_autosuggestion() {
// Updates autosuggestion. We look for an autosuggestion if the command line is non-empty and if
// we're not doing a history search.
data->autosuggestion.clear();
@ -1817,12 +1817,12 @@ static void move_word(editable_line_t *el, bool move_right, bool erase,
}
}
const wchar_t *reader_get_buffer(void) {
const wchar_t *reader_get_buffer() {
ASSERT_IS_MAIN_THREAD();
return data ? data->command_line.text.c_str() : NULL;
}
history_t *reader_get_history(void) {
history_t *reader_get_history() {
ASSERT_IS_MAIN_THREAD();
return data ? data->history : NULL;
}
@ -2022,7 +2022,7 @@ void reader_set_exit_on_interrupt(bool i) { data->exit_on_interrupt = i; }
void reader_set_silent_status(bool flag) { data->silent = flag; }
void reader_import_history_if_necessary(void) {
void reader_import_history_if_necessary() {
// Import history from older location (config path) if our current history is empty.
if (data->history && data->history->is_empty()) {
data->history->populate_from_config_path();
@ -2045,7 +2045,7 @@ void reader_import_history_if_necessary(void) {
}
/// Called to set the highlight flag for search results.
static void highlight_search(void) {
static void highlight_search() {
if (!data->search_buff.empty() && !data->history_search.is_at_end()) {
const editable_line_t *el = &data->command_line;
const wcstring &needle = data->search_buff;
@ -2216,7 +2216,7 @@ static bool selection_is_at_top() {
}
/// Read interactively. Read input from stdin while providing editing facilities.
static int read_i(void) {
static int read_i() {
reader_push(history_session_id().c_str());
reader_set_complete_function(&complete);
reader_set_highlight_function(&highlight_shell);

View file

@ -105,7 +105,7 @@ static int fish_wcwidth_min_0(wchar_t widechar) { return maxi(0, fish_wcwidth(wi
/// Whether we permit soft wrapping. If so, in some cases we don't explicitly move to the second
/// physical line on a wrapped logical line; instead we just output it.
static bool allow_soft_wrap(void) {
static bool allow_soft_wrap() {
// Should we be looking at eat_newline_glitch as well?
return auto_right_margin;
}
@ -810,7 +810,7 @@ static void s_update(screen_t *scr, const wcstring &left_prompt, const wcstring
}
/// Returns true if we are using a dumb terminal.
static bool is_dumb(void) {
static bool is_dumb() {
if (!cur_term) return true;
return !cursor_up || !cursor_down || !cursor_left || !cursor_right;
}