mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-21 07:58:15 +08:00
Mark overriding virtual functions as override instead of virtual
This commit is contained in:
parent
51c9ad1359
commit
5c44d897ea
@ -50,10 +50,10 @@ namespace mu {
|
||||
public:
|
||||
Parser();
|
||||
|
||||
virtual void InitCharSets();
|
||||
virtual void InitFun();
|
||||
virtual void InitConst();
|
||||
virtual void InitOprt();
|
||||
void InitCharSets() override;
|
||||
void InitFun() override;
|
||||
void InitConst() override;
|
||||
void InitOprt() override;
|
||||
|
||||
protected:
|
||||
// Trigonometric functions
|
||||
|
@ -171,11 +171,11 @@ class ParserBase {
|
||||
m_cThousandsSep(cThousandsSep) {}
|
||||
|
||||
protected:
|
||||
virtual char_type do_decimal_point() const { return m_cDecPoint; }
|
||||
char_type do_decimal_point() const override { return m_cDecPoint; }
|
||||
|
||||
virtual char_type do_thousands_sep() const { return m_cThousandsSep; }
|
||||
char_type do_thousands_sep() const override { return m_cThousandsSep; }
|
||||
|
||||
virtual std::string do_grouping() const {
|
||||
std::string do_grouping() const override {
|
||||
// fix for issue 4: https://code.google.com/p/muparser/issues/detail?id=4
|
||||
// courtesy of Jens Bartsch
|
||||
// original code:
|
||||
|
@ -113,10 +113,10 @@ class ParserInt : public ParserBase {
|
||||
public:
|
||||
ParserInt();
|
||||
|
||||
virtual void InitFun();
|
||||
virtual void InitOprt();
|
||||
virtual void InitConst();
|
||||
virtual void InitCharSets();
|
||||
void InitFun() override;
|
||||
void InitOprt() override;
|
||||
void InitConst() override;
|
||||
void InitCharSets() override;
|
||||
};
|
||||
|
||||
} // namespace mu
|
||||
|
@ -709,9 +709,9 @@ class wildcard_matcher_t : public string_matcher_t {
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~wildcard_matcher_t() = default;
|
||||
~wildcard_matcher_t() override = default;
|
||||
|
||||
bool report_matches(const wchar_t *arg) {
|
||||
bool report_matches(const wchar_t *arg) override {
|
||||
// Note: --all is a no-op for glob matching since the pattern is always matched
|
||||
// against the entire argument.
|
||||
bool match;
|
||||
@ -849,9 +849,9 @@ class pcre2_matcher_t : public string_matcher_t {
|
||||
argv0(argv0_),
|
||||
regex(argv0_, pattern, opts.ignore_case, streams) {}
|
||||
|
||||
virtual ~pcre2_matcher_t() = default;
|
||||
~pcre2_matcher_t() override = default;
|
||||
|
||||
bool report_matches(const wchar_t *arg) {
|
||||
bool report_matches(const wchar_t *arg) override {
|
||||
// A return value of true means all is well (even if no matches were found), false indicates
|
||||
// an unrecoverable error.
|
||||
if (regex.code == 0) {
|
||||
@ -977,8 +977,8 @@ class literal_replacer_t : public string_replacer_t {
|
||||
replacement(replacement_),
|
||||
patlen(wcslen(pattern)) {}
|
||||
|
||||
virtual ~literal_replacer_t() = default;
|
||||
bool replace_matches(const wchar_t *arg);
|
||||
~literal_replacer_t() override = default;
|
||||
bool replace_matches(const wchar_t *arg) override;
|
||||
};
|
||||
|
||||
static wcstring interpret_escapes(const wchar_t *orig) {
|
||||
@ -1007,7 +1007,7 @@ class regex_replacer_t : public string_replacer_t {
|
||||
regex(argv0, pattern, opts.ignore_case, streams),
|
||||
replacement(interpret_escapes(replacement_)) {}
|
||||
|
||||
bool replace_matches(const wchar_t *arg);
|
||||
bool replace_matches(const wchar_t *arg) override;
|
||||
};
|
||||
|
||||
/// A return value of true means all is well (even if no replacements were performed), false
|
||||
|
@ -202,7 +202,7 @@ class unary_primary : public expression {
|
||||
wcstring arg;
|
||||
unary_primary(token_t tok, range_t where, wcstring what)
|
||||
: expression(tok, where), arg(std::move(what)) {}
|
||||
bool evaluate(wcstring_list_t &errors);
|
||||
bool evaluate(wcstring_list_t &errors) override;
|
||||
};
|
||||
|
||||
/// Two argument primary like foo != bar.
|
||||
@ -213,7 +213,7 @@ class binary_primary : public expression {
|
||||
|
||||
binary_primary(token_t tok, range_t where, wcstring left, wcstring right)
|
||||
: expression(tok, where), arg_left(std::move(left)), arg_right(std::move(right)) {}
|
||||
bool evaluate(wcstring_list_t &errors);
|
||||
bool evaluate(wcstring_list_t &errors) override;
|
||||
};
|
||||
|
||||
/// Unary operator like bang.
|
||||
@ -222,7 +222,7 @@ class unary_operator : public expression {
|
||||
unique_ptr<expression> subject;
|
||||
unary_operator(token_t tok, range_t where, unique_ptr<expression> exp)
|
||||
: expression(tok, where), subject(move(exp)) {}
|
||||
bool evaluate(wcstring_list_t &errors);
|
||||
bool evaluate(wcstring_list_t &errors) override;
|
||||
};
|
||||
|
||||
/// Combining expression. Contains a list of AND or OR expressions. It takes more than two so that
|
||||
@ -239,9 +239,9 @@ class combining_expression : public expression {
|
||||
assert(subjects.size() == combiners.size() + 1);
|
||||
}
|
||||
|
||||
virtual ~combining_expression() = default;
|
||||
~combining_expression() override = default;
|
||||
|
||||
bool evaluate(wcstring_list_t &errors);
|
||||
bool evaluate(wcstring_list_t &errors) override;
|
||||
};
|
||||
|
||||
/// Parenthetical expression.
|
||||
@ -251,7 +251,7 @@ class parenthetical_expression : public expression {
|
||||
parenthetical_expression(token_t tok, range_t where, unique_ptr<expression> expr)
|
||||
: expression(tok, where), contents(move(expr)) {}
|
||||
|
||||
virtual bool evaluate(wcstring_list_t &errors);
|
||||
bool evaluate(wcstring_list_t &errors) override;
|
||||
};
|
||||
|
||||
void test_parser::add_error(const wchar_t *fmt, ...) {
|
||||
|
@ -1207,13 +1207,13 @@ class universal_notifier_named_pipe_t : public universal_notifier_t {
|
||||
make_pipe(test_path);
|
||||
}
|
||||
|
||||
~universal_notifier_named_pipe_t() {
|
||||
~universal_notifier_named_pipe_t() override {
|
||||
if (pipe_fd >= 0) {
|
||||
close(pipe_fd);
|
||||
}
|
||||
}
|
||||
|
||||
int notification_fd() {
|
||||
int notification_fd() override {
|
||||
if (polling_due_to_readable_fd) {
|
||||
// We are in polling mode because we think our fd is readable. This means that, if we
|
||||
// return it to be select()'d on, we'll be called back immediately. So don't return it.
|
||||
@ -1223,7 +1223,7 @@ class universal_notifier_named_pipe_t : public universal_notifier_t {
|
||||
return pipe_fd;
|
||||
}
|
||||
|
||||
bool notification_fd_became_readable(int fd) {
|
||||
bool notification_fd_became_readable(int fd) override {
|
||||
// Our fd is readable. We deliberately do not read anything out of it: if we did, other
|
||||
// sessions may miss the notification. Instead, we go into "polling mode:" we do not
|
||||
// select() on our fd for a while, and sync periodically until the fd is no longer readable.
|
||||
@ -1240,7 +1240,7 @@ class universal_notifier_named_pipe_t : public universal_notifier_t {
|
||||
return should_sync;
|
||||
}
|
||||
|
||||
void post_notification() {
|
||||
void post_notification() override {
|
||||
if (pipe_fd >= 0) {
|
||||
// We need to write some data (any data) to the pipe, then wait for a while, then read
|
||||
// it back. Nobody is expected to read it except us.
|
||||
@ -1257,7 +1257,7 @@ class universal_notifier_named_pipe_t : public universal_notifier_t {
|
||||
}
|
||||
}
|
||||
|
||||
unsigned long usec_delay_between_polls() const {
|
||||
unsigned long usec_delay_between_polls() const override {
|
||||
unsigned long readback_delay = ULONG_MAX;
|
||||
if (this->readback_time_usec > 0) {
|
||||
// How long until the readback?
|
||||
@ -1285,7 +1285,7 @@ class universal_notifier_named_pipe_t : public universal_notifier_t {
|
||||
return result;
|
||||
}
|
||||
|
||||
bool poll() {
|
||||
bool poll() override {
|
||||
// Check if we are past the readback time.
|
||||
if (this->readback_time_usec > 0 && get_time() >= this->readback_time_usec) {
|
||||
// Read back what we wrote. We do nothing with the value.
|
||||
|
14
src/io.h
14
src/io.h
@ -49,7 +49,7 @@ class io_close_t : public io_data_t {
|
||||
public:
|
||||
explicit io_close_t(int f) : io_data_t(IO_CLOSE, f) {}
|
||||
|
||||
virtual void print() const;
|
||||
void print() const override;
|
||||
};
|
||||
|
||||
class io_fd_t : public io_data_t {
|
||||
@ -62,7 +62,7 @@ class io_fd_t : public io_data_t {
|
||||
/// would not.
|
||||
const bool user_supplied;
|
||||
|
||||
virtual void print() const;
|
||||
void print() const override;
|
||||
|
||||
io_fd_t(int f, int old, bool us) : io_data_t(IO_FD, f), old_fd(old), user_supplied(us) {}
|
||||
};
|
||||
@ -74,12 +74,12 @@ class io_file_t : public io_data_t {
|
||||
/// file creation flags to send to open.
|
||||
const int flags;
|
||||
|
||||
virtual void print() const;
|
||||
void print() const override;
|
||||
|
||||
io_file_t(int f, const wcstring &fname, int fl = 0)
|
||||
: io_data_t(IO_FILE, f), filename_cstr(wcs2str(fname)), flags(fl) {}
|
||||
|
||||
virtual ~io_file_t() { free((void *)filename_cstr); }
|
||||
~io_file_t() override { free((void *)filename_cstr); }
|
||||
};
|
||||
|
||||
class io_pipe_t : public io_data_t {
|
||||
@ -92,7 +92,7 @@ class io_pipe_t : public io_data_t {
|
||||
int pipe_fd[2];
|
||||
const bool is_input;
|
||||
|
||||
virtual void print() const;
|
||||
void print() const override;
|
||||
|
||||
io_pipe_t(int f, bool i) : io_data_t(IO_PIPE, f), is_input(i) { pipe_fd[0] = pipe_fd[1] = -1; }
|
||||
};
|
||||
@ -114,9 +114,9 @@ class io_buffer_t : public io_pipe_t {
|
||||
out_buffer() {}
|
||||
|
||||
public:
|
||||
virtual void print() const;
|
||||
void print() const override;
|
||||
|
||||
virtual ~io_buffer_t();
|
||||
~io_buffer_t() override;
|
||||
|
||||
/// Function to append to the buffer.
|
||||
void out_buffer_append(const char *ptr, size_t count) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user