From 69d0bb7c0d81556f4e78370f79233329d1486f00 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Tue, 19 Nov 2019 22:17:30 -0800 Subject: [PATCH] io.h: Add missing override Found with clang's -Winconsistent-missing-destructor-override Signed-off-by: Rosen Penev --- src/common.cpp | 4 ++-- src/common.h | 4 ++-- src/complete.cpp | 2 +- src/env.cpp | 2 +- src/fallback.cpp | 1 - src/fish_key_reader.cpp | 1 - src/history.cpp | 2 +- src/io.h | 4 ++-- src/parse_tree.cpp | 2 +- src/proc.h | 2 +- src/reader.cpp | 2 +- 11 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/common.cpp b/src/common.cpp index ef6a6a0ea..634afe81f 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -412,7 +412,7 @@ std::string wcs2string(const wcstring &input) { for (auto wc : input) { if (wc == INTERNAL_SEPARATOR) { - ; // do nothing + // do nothing } else if (wc >= ENCODE_DIRECT_BASE && wc < ENCODE_DIRECT_BASE + 256) { result.push_back(wc - ENCODE_DIRECT_BASE); } else if (MB_CUR_MAX == 1) { // single-byte locale (C/POSIX/ISO-8859) @@ -450,7 +450,7 @@ static char *wcs2str_internal(const wchar_t *in, char *out) { while (in[in_pos]) { if (in[in_pos] == INTERNAL_SEPARATOR) { - ; // do nothing + // do nothing } else if (in[in_pos] >= ENCODE_DIRECT_BASE && in[in_pos] < ENCODE_DIRECT_BASE + 256) { out[out_pos++] = in[in_pos] - ENCODE_DIRECT_BASE; } else if (MB_CUR_MAX == 1) // single-byte locale (C/POSIX/ISO-8859) diff --git a/src/common.h b/src/common.h index 9a9acf6df..67b788405 100644 --- a/src/common.h +++ b/src/common.h @@ -208,12 +208,12 @@ extern const bool has_working_tty_timestamps; // `__attribute__((noreturn))` on the exit_without_destructors() function. // TODO: we use C++11 [[noreturn]] now, does that change things? #define FATAL_EXIT() \ - { \ + do { \ char exit_read_buff; \ show_stackframe(L'E'); \ ignore_result(read(0, &exit_read_buff, 1)); \ exit_without_destructors(1); \ - } + } while (0) /// Exit the program at once after emitting an error message and stack trace if possible. /// We use our own private implementation of `assert()` for two reasons. First, some implementations diff --git a/src/complete.cpp b/src/complete.cpp index dfb242619..f6429faa8 100644 --- a/src/complete.cpp +++ b/src/complete.cpp @@ -1483,7 +1483,7 @@ void completer_t::perform() { }) != std::end(prefix_cmds); if (!is_subcommand) break; tokens.erase(tokens.begin()); - }; + } } // Empty process (cursor is after one of ;, &, |, \n, &&, || modulo whitespace). if (tokens.empty()) { diff --git a/src/env.cpp b/src/env.cpp index 7cfe7c0bb..831c42c4a 100644 --- a/src/env.cpp +++ b/src/env.cpp @@ -506,7 +506,7 @@ class env_scoped_impl_t : public environment_t { std::shared_ptr snapshot() const; - virtual ~env_scoped_impl_t() = default; + ~env_scoped_impl_t() override = default; std::shared_ptr> export_array(); diff --git a/src/fallback.cpp b/src/fallback.cpp index c612625a4..d52e0ec7c 100644 --- a/src/fallback.cpp +++ b/src/fallback.cpp @@ -221,7 +221,6 @@ int futimes(int fd, const struct timeval *times) { #if HAVE_GETTEXT char *fish_gettext(const char *msgid) { return gettext(msgid); - ; } char *fish_bindtextdomain(const char *domainname, const char *dirname) { diff --git a/src/fish_key_reader.cpp b/src/fish_key_reader.cpp index 2f127a81b..ef556df71 100644 --- a/src/fish_key_reader.cpp +++ b/src/fish_key_reader.cpp @@ -91,7 +91,6 @@ static maybe_t sequence_name(wchar_t wc) { } } return none(); - ; } /// Return true if the character must be escaped when used in the sequence of chars to be bound in diff --git a/src/history.cpp b/src/history.cpp index c4dd8a02c..faa9fb860 100644 --- a/src/history.cpp +++ b/src/history.cpp @@ -1202,7 +1202,7 @@ wcstring history_session_id(const environment_t &vars) { if (session_id.empty()) { result.clear(); } else if (session_id == L"default") { - ; // using the default value + // using the default value } else if (valid_var_name(session_id)) { result = session_id; } else { diff --git a/src/io.h b/src/io.h index 0e01b1282..2c9c79deb 100644 --- a/src/io.h +++ b/src/io.h @@ -219,7 +219,7 @@ class io_pipe_t : public io_data_t { io_pipe_t(int fd, bool is_input, autoclose_fd_t pipe_fd) : io_data_t(io_mode_t::pipe, fd), pipe_fd_(std::move(pipe_fd)), is_input_(is_input) {} - ~io_pipe_t(); + ~io_pipe_t() override; int pipe_fd() const { return pipe_fd_.fd(); } }; @@ -246,7 +246,7 @@ class io_bufferfill_t : public io_data_t { write_fd_(std::move(write_fd)), buffer_(std::move(buffer)) {} - ~io_bufferfill_t(); + ~io_bufferfill_t() override; std::shared_ptr buffer() const { return buffer_; } diff --git a/src/parse_tree.cpp b/src/parse_tree.cpp index ef2747c76..4454fbc74 100644 --- a/src/parse_tree.cpp +++ b/src/parse_tree.cpp @@ -857,7 +857,7 @@ bool parse_ll_t::top_node_handle_terminal_types(const parse_token_t &token) { } else if (stack_top.keyword == parse_keyword_end && token.type == parse_token_type_terminate && this->report_error_for_unclosed_block()) { - ; // handled by report_error_for_unclosed_block + // handled by report_error_for_unclosed_block } else { const wcstring expected = stack_top.user_presentable_description(); this->parse_error_unexpected_token(expected.c_str(), token); diff --git a/src/proc.h b/src/proc.h index 6a627b26c..9b5ae8226 100644 --- a/src/proc.h +++ b/src/proc.h @@ -420,7 +420,7 @@ class job_t { /// The job is OK to be externally visible, e.g. to the user via `jobs` bool is_visible() const { return !is_completed() && is_constructed() && !flags().disown_requested; - }; + } bool skip_notification() const { return properties.skip_notification; } bool from_event_handler() const { return properties.from_event_handler; } diff --git a/src/reader.cpp b/src/reader.cpp index ebfe0c1ba..8a2ffb2ef 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -2082,7 +2082,7 @@ void reader_data_t::super_highlight_me_plenty(int match_highlight_pos_adjust, bo const wcstring &cmd = el->text, &suggest = autosuggestion; if (can_autosuggest() && !suggest.empty() && string_prefixes_string_case_insensitive(cmd, suggest)) { - ; // the autosuggestion is still reasonable, so do nothing + // the autosuggestion is still reasonable, so do nothing } else { update_autosuggestion(); }