Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundant uses of virtual keyword #2069

Merged
merged 6 commits into from
Aug 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stl/inc/any
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ _STD_BEGIN
// CLASS bad_any_cast
class bad_any_cast : public bad_cast { // thrown by failed any_cast
public:
_NODISCARD virtual const char* __CLR_OR_THIS_CALL what() const noexcept override {
_NODISCARD const char* __CLR_OR_THIS_CALL what() const noexcept override {
return "Bad any_cast";
}
};
Expand Down
60 changes: 30 additions & 30 deletions stl/inc/codecvt
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ public:

explicit codecvt_utf8(size_t _Refs = 0) : _Mybase(_Refs) {}

virtual __CLR_OR_THIS_CALL ~codecvt_utf8() noexcept {}
__CLR_OR_THIS_CALL ~codecvt_utf8() noexcept override {}

protected:
virtual result __CLR_OR_THIS_CALL do_in(_Statype& _State, const _Byte* _First1, const _Byte* _Last1,
const _Byte*& _Mid1, _Elem* _First2, _Elem* _Last2, _Elem*& _Mid2) const override {
result __CLR_OR_THIS_CALL do_in(_Statype& _State, const _Byte* _First1, const _Byte* _Last1, const _Byte*& _Mid1,
_Elem* _First2, _Elem* _Last2, _Elem*& _Mid2) const override {
// convert bytes [_First1, _Last1) to [_First2, _Last2)
char* _Pstate = reinterpret_cast<char*>(&_State);
_Mid1 = _First1;
Expand Down Expand Up @@ -120,8 +120,8 @@ protected:
return _First1 == _Mid1 ? _Mybase::partial : _Mybase::ok;
}

virtual result __CLR_OR_THIS_CALL do_out(_Statype& _State, const _Elem* _First1, const _Elem* _Last1,
const _Elem*& _Mid1, _Byte* _First2, _Byte* _Last2, _Byte*& _Mid2) const override {
result __CLR_OR_THIS_CALL do_out(_Statype& _State, const _Elem* _First1, const _Elem* _Last1, const _Elem*& _Mid1,
_Byte* _First2, _Byte* _Last2, _Byte*& _Mid2) const override {
// convert [_First1, _Last1) to bytes [_First2, _Last2)
char* _Pstate = reinterpret_cast<char*>(&_State);
_Mid1 = _First1;
Expand Down Expand Up @@ -184,30 +184,30 @@ protected:
return _First1 == _Mid1 ? _Mybase::partial : _Mybase::ok;
}

virtual result __CLR_OR_THIS_CALL do_unshift(_Statype&, _Byte* _First2, _Byte*, _Byte*& _Mid2) const override {
result __CLR_OR_THIS_CALL do_unshift(_Statype&, _Byte* _First2, _Byte*, _Byte*& _Mid2) const override {
// generate bytes to return to default shift state
_Mid2 = _First2;
return _Mybase::noconv;
}

friend int _Codecvt_do_length<>(const codecvt_utf8&, _Statype&, const _Byte*, const _Byte*, size_t);

virtual int __CLR_OR_THIS_CALL do_length(
int __CLR_OR_THIS_CALL do_length(
_Statype& _State, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const noexcept override {
return _Codecvt_do_length(*this, _State, _First1, _Last1, _Count);
}

virtual bool __CLR_OR_THIS_CALL do_always_noconv() const noexcept override {
bool __CLR_OR_THIS_CALL do_always_noconv() const noexcept override {
// return true if conversions never change input
return false;
}

virtual int __CLR_OR_THIS_CALL do_max_length() const noexcept override {
int __CLR_OR_THIS_CALL do_max_length() const noexcept override {
// return maximum length required for a conversion
return (_Mymode & (consume_header | generate_header)) != 0 ? 9 : 6;
}

virtual int __CLR_OR_THIS_CALL do_encoding() const noexcept override {
int __CLR_OR_THIS_CALL do_encoding() const noexcept override {
// return length of code sequence (from codecvt)
return (_Mymode & (consume_header | generate_header)) != 0 ? -1
: 0; // -1 => state dependent, 0 => varying length
Expand All @@ -230,11 +230,11 @@ public:

explicit codecvt_utf16(size_t _Refs = 0) : _Mybase(_Refs) {}

virtual __CLR_OR_THIS_CALL ~codecvt_utf16() noexcept {}
__CLR_OR_THIS_CALL ~codecvt_utf16() noexcept override {}

protected:
virtual result __CLR_OR_THIS_CALL do_in(_Statype& _State, const _Byte* _First1, const _Byte* _Last1,
const _Byte*& _Mid1, _Elem* _First2, _Elem* _Last2, _Elem*& _Mid2) const override {
result __CLR_OR_THIS_CALL do_in(_Statype& _State, const _Byte* _First1, const _Byte* _Last1, const _Byte*& _Mid1,
_Elem* _First2, _Elem* _Last2, _Elem*& _Mid2) const override {
// convert bytes [_First1, _Last1) to [_First2, _Last2)
char* _Pstate = reinterpret_cast<char*>(&_State);
_Mid1 = _First1;
Expand Down Expand Up @@ -311,8 +311,8 @@ protected:
return _First1 == _Mid1 ? _Mybase::partial : _Mybase::ok;
}

virtual result __CLR_OR_THIS_CALL do_out(_Statype& _State, const _Elem* _First1, const _Elem* _Last1,
const _Elem*& _Mid1, _Byte* _First2, _Byte* _Last2, _Byte*& _Mid2) const override {
result __CLR_OR_THIS_CALL do_out(_Statype& _State, const _Elem* _First1, const _Elem* _Last1, const _Elem*& _Mid1,
_Byte* _First2, _Byte* _Last2, _Byte*& _Mid2) const override {
// convert [_First1, _Last1) to bytes [_First2, _Last2)
char* _Pstate = reinterpret_cast<char*>(&_State);
_Mid1 = _First1;
Expand Down Expand Up @@ -389,30 +389,30 @@ protected:
return _First1 == _Mid1 ? _Mybase::partial : _Mybase::ok;
}

virtual result __CLR_OR_THIS_CALL do_unshift(_Statype&, _Byte* _First2, _Byte*, _Byte*& _Mid2) const override {
result __CLR_OR_THIS_CALL do_unshift(_Statype&, _Byte* _First2, _Byte*, _Byte*& _Mid2) const override {
// generate bytes to return to default shift state
_Mid2 = _First2;
return _Mybase::noconv;
}

friend int _Codecvt_do_length<>(const codecvt_utf16&, _Statype&, const _Byte*, const _Byte*, size_t);

virtual int __CLR_OR_THIS_CALL do_length(
int __CLR_OR_THIS_CALL do_length(
_Statype& _State, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const noexcept override {
return _Codecvt_do_length(*this, _State, _First1, _Last1, _Count);
}

virtual bool __CLR_OR_THIS_CALL do_always_noconv() const noexcept override {
bool __CLR_OR_THIS_CALL do_always_noconv() const noexcept override {
// return true if conversions never change input
return false;
}

virtual int __CLR_OR_THIS_CALL do_max_length() const noexcept override {
int __CLR_OR_THIS_CALL do_max_length() const noexcept override {
// return maximum length required for a conversion
return (_Mymode & (consume_header | generate_header)) != 0 ? 3 * _Bytes_per_word : 6 * _Bytes_per_word;
}

virtual int __CLR_OR_THIS_CALL do_encoding() const noexcept override {
int __CLR_OR_THIS_CALL do_encoding() const noexcept override {
// return length of code sequence (from codecvt)
if ((_Mymode & (consume_header | generate_header)) != 0) {
return -1; // -1 => state dependent
Expand All @@ -438,11 +438,11 @@ public:

explicit codecvt_utf8_utf16(size_t _Refs = 0) : _Mybase(_Refs) {}

virtual __CLR_OR_THIS_CALL ~codecvt_utf8_utf16() noexcept {}
__CLR_OR_THIS_CALL ~codecvt_utf8_utf16() noexcept override {}

protected:
virtual result __CLR_OR_THIS_CALL do_in(_Statype& _State, const _Byte* _First1, const _Byte* _Last1,
const _Byte*& _Mid1, _Elem* _First2, _Elem* _Last2, _Elem*& _Mid2) const override {
result __CLR_OR_THIS_CALL do_in(_Statype& _State, const _Byte* _First1, const _Byte* _Last1, const _Byte*& _Mid1,
_Elem* _First2, _Elem* _Last2, _Elem*& _Mid2) const override {
// convert bytes [_First1, _Last1) to [_First2, _Last2)
unsigned short* _Pstate = reinterpret_cast<unsigned short*>(&_State);
_Mid1 = _First1;
Expand Down Expand Up @@ -556,8 +556,8 @@ protected:
return _First1 == _Mid1 ? _Mybase::partial : _Mybase::ok;
}

virtual result __CLR_OR_THIS_CALL do_out(_Statype& _State, const _Elem* _First1, const _Elem* _Last1,
const _Elem*& _Mid1, _Byte* _First2, _Byte* _Last2, _Byte*& _Mid2) const override {
result __CLR_OR_THIS_CALL do_out(_Statype& _State, const _Elem* _First1, const _Elem* _Last1, const _Elem*& _Mid1,
_Byte* _First2, _Byte* _Last2, _Byte*& _Mid2) const override {
// convert [_First1, _Last1) to bytes [_First2, _Last2)
unsigned short* _Pstate = reinterpret_cast<unsigned short*>(&_State);
_Mid1 = _First1;
Expand Down Expand Up @@ -631,25 +631,25 @@ protected:
return _First1 == _Mid1 ? _Mybase::partial : _Mybase::ok;
}

virtual result __CLR_OR_THIS_CALL do_unshift(_Statype&, _Byte* _First2, _Byte*, _Byte*& _Mid2) const override {
result __CLR_OR_THIS_CALL do_unshift(_Statype&, _Byte* _First2, _Byte*, _Byte*& _Mid2) const override {
// generate bytes to return to default shift state
_Mid2 = _First2;
return _Mybase::noconv;
}

friend int _Codecvt_do_length<>(const codecvt_utf8_utf16&, _Statype&, const _Byte*, const _Byte*, size_t);

virtual int __CLR_OR_THIS_CALL do_length(
int __CLR_OR_THIS_CALL do_length(
_Statype& _State, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const noexcept override {
return _Codecvt_do_length(*this, _State, _First1, _Last1, _Count);
}

virtual bool __CLR_OR_THIS_CALL do_always_noconv() const noexcept override {
bool __CLR_OR_THIS_CALL do_always_noconv() const noexcept override {
// return true if conversions never change input
return false;
}

virtual int __CLR_OR_THIS_CALL do_max_length() const noexcept override {
int __CLR_OR_THIS_CALL do_max_length() const noexcept override {
// return maximum length required for a conversion
if ((_Mymode & consume_header) != 0) {
return 9; // header + max input
Expand All @@ -662,7 +662,7 @@ protected:
return 6; // 6-byte max input sequence, no 3-byte header
}

virtual int __CLR_OR_THIS_CALL do_encoding() const noexcept override {
int __CLR_OR_THIS_CALL do_encoding() const noexcept override {
// return length of code sequence (from codecvt)
return 0; // 0 => varying length
}
Expand Down
21 changes: 10 additions & 11 deletions stl/inc/cvt/ebcdic
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ namespace stdext {

explicit codecvt_ebcdic(size_t _Refs = 0) : _Mybase(_Refs) {}

virtual ~codecvt_ebcdic() noexcept {}
~codecvt_ebcdic() noexcept override {}

protected:
virtual result do_in(_Statype&, const _Byte* _First1, const _Byte* _Last1, const _Byte*& _Mid1,
_Elem* _First2, _Elem* _Last2, _Elem*& _Mid2) const override {
result do_in(_Statype&, const _Byte* _First1, const _Byte* _Last1, const _Byte*& _Mid1, _Elem* _First2,
_Elem* _Last2, _Elem*& _Mid2) const override {
// convert bytes [_First1, _Last1) to [_First2, _Last)
_Mid1 = _First1;
_Mid2 = _First2;
Expand All @@ -61,8 +61,8 @@ namespace stdext {
return _First1 == _Mid1 ? _Mybase::partial : _Mybase::ok;
}

virtual result do_out(_Statype&, const _Elem* _First1, const _Elem* _Last1, const _Elem*& _Mid1,
_Byte* _First2, _Byte* _Last2, _Byte*& _Mid2) const override {
result do_out(_Statype&, const _Elem* _First1, const _Elem* _Last1, const _Elem*& _Mid1, _Byte* _First2,
_Byte* _Last2, _Byte*& _Mid2) const override {
// convert [_First1, _Last1) to bytes [_First2, _Last)
_Mid1 = _First1;
_Mid2 = _First2;
Expand All @@ -79,29 +79,28 @@ namespace stdext {
return _First1 == _Mid1 ? _Mybase::partial : _Mybase::ok;
}

virtual result do_unshift(_Statype&, _Byte* _First2, _Byte*, _Byte*& _Mid2) const override {
result do_unshift(_Statype&, _Byte* _First2, _Byte*, _Byte*& _Mid2) const override {
// generate bytes to return to default shift state
_Mid2 = _First2;
return _Mybase::ok;
}

virtual int do_length(
_Statype&, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const noexcept override {
int do_length(_Statype&, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const noexcept override {
// return min(_Count, converted length of bytes [_First1, _Last1))
const auto _Wchars = static_cast<size_t>(_Last1 - _First1);

return static_cast<int>(_Count < _Wchars ? _Count : _Wchars);
}

virtual bool do_always_noconv() const noexcept override { // return true if conversions never change input
bool do_always_noconv() const noexcept override { // return true if conversions never change input
return false;
}

virtual int do_max_length() const noexcept override { // return maximum length required for a conversion
int do_max_length() const noexcept override { // return maximum length required for a conversion
return 1;
}

virtual int do_encoding() const noexcept override { // return length of code sequence (from codecvt)
int do_encoding() const noexcept override { // return length of code sequence (from codecvt)
return 1;
}
};
Expand Down
20 changes: 10 additions & 10 deletions stl/inc/cvt/euc_0208
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ namespace stdext {

explicit codecvt_euc_0208(size_t _Refs = 0) : _Mybase(_Refs) {}

virtual ~codecvt_euc_0208() noexcept {}
~codecvt_euc_0208() noexcept override {}

protected:
virtual result do_in(_Statype&, const _Byte* _First1, const _Byte* _Last1, const _Byte*& _Mid1,
_Elem* _First2, _Elem* _Last2, _Elem*& _Mid2) const override {
result do_in(_Statype&, const _Byte* _First1, const _Byte* _Last1, const _Byte*& _Mid1, _Elem* _First2,
_Elem* _Last2, _Elem*& _Mid2) const override {
// convert bytes [_First1, _Last1) to [_First2, _Last)
_Mid1 = _First1;
_Mid2 = _First2;
Expand Down Expand Up @@ -84,8 +84,8 @@ namespace stdext {
return _First1 == _Mid1 ? _Mybase::partial : _Mybase::ok;
}

virtual result do_out(_Statype&, const _Elem* _First1, const _Elem* _Last1, const _Elem*& _Mid1,
_Byte* _First2, _Byte* _Last2, _Byte*& _Mid2) const override {
result do_out(_Statype&, const _Elem* _First1, const _Elem* _Last1, const _Elem*& _Mid1, _Byte* _First2,
_Byte* _Last2, _Byte*& _Mid2) const override {
// convert [_First1, _Last1) to bytes [_First2, _Last)
_Mid1 = _First1;
_Mid2 = _First2;
Expand Down Expand Up @@ -137,14 +137,14 @@ namespace stdext {
return _First1 == _Mid1 ? _Mybase::partial : _Mybase::ok;
}

virtual result do_unshift(_Statype&, _Byte* _First2, _Byte*, _Byte*& _Mid2) const override {
result do_unshift(_Statype&, _Byte* _First2, _Byte*, _Byte*& _Mid2) const override {
// generate bytes to return to default shift state
_Mid2 = _First2;

return _Mybase::ok;
}

virtual int do_length(
int do_length(
_Statype& _State, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const noexcept override {
// return min(_Count, converted length of bytes [_First1, _Last1))
size_t _Wchars = 0;
Expand Down Expand Up @@ -176,15 +176,15 @@ namespace stdext {
return static_cast<int>(_Wchars);
}

virtual bool do_always_noconv() const noexcept override { // return true if conversions never change input
bool do_always_noconv() const noexcept override { // return true if conversions never change input
return false;
}

virtual int do_max_length() const noexcept override { // return maximum length required for a conversion
int do_max_length() const noexcept override { // return maximum length required for a conversion
return 3;
}

virtual int do_encoding() const noexcept override { // return length of code sequence (from codecvt)
int do_encoding() const noexcept override { // return length of code sequence (from codecvt)
return 0; // 0 => varying length
}
};
Expand Down
16 changes: 8 additions & 8 deletions stl/inc/cvt/jis_0208
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ namespace stdext {

explicit codecvt_jis_0208(size_t _Refs = 0) : _Mybase(_Refs) {}

virtual ~codecvt_jis_0208() noexcept {}
~codecvt_jis_0208() noexcept override {}

protected:
virtual result do_in(_Statype& _State, const _Byte* _First1, const _Byte* _Last1, const _Byte*& _Mid1,
result do_in(_Statype& _State, const _Byte* _First1, const _Byte* _Last1, const _Byte*& _Mid1,
_Elem* _First2, _Elem* _Last2, _Elem*& _Mid2) const override {
// convert bytes [_First1, _Last1) to [_First2, _Last)
char* _Pstate = reinterpret_cast<char*>(&_State);
Expand Down Expand Up @@ -108,7 +108,7 @@ namespace stdext {
return _Ans;
}

virtual result do_out(_Statype& _State, const _Elem* _First1, const _Elem* _Last1, const _Elem*& _Mid1,
result do_out(_Statype& _State, const _Elem* _First1, const _Elem* _Last1, const _Elem*& _Mid1,
_Byte* _First2, _Byte* _Last2, _Byte*& _Mid2) const override {
// convert [_First1, _Last1) to bytes [_First2, _Last)
char* _Pstate = reinterpret_cast<char*>(&_State);
Expand Down Expand Up @@ -174,7 +174,7 @@ namespace stdext {
return _First1 == _Mid1 ? _Mybase::partial : _Mybase::ok;
}

virtual result do_unshift(_Statype& _State, _Byte* _First2, _Byte*, _Byte*& _Mid2) const override {
result do_unshift(_Statype& _State, _Byte* _First2, _Byte*, _Byte*& _Mid2) const override {
// generate bytes to return to default shift state
char* _Pstate = reinterpret_cast<char*>(&_State);

Expand All @@ -200,7 +200,7 @@ namespace stdext {
return _Mybase::partial;
}

virtual int do_length(
int do_length(
_Statype& _State, const _Byte* _First1, const _Byte* _Last1, size_t _Count) const noexcept override {
// return min(_Count, converted length of bytes [_First1, _Last1))
size_t _Wchars = 0;
Expand Down Expand Up @@ -232,15 +232,15 @@ namespace stdext {
return static_cast<int>(_Wchars);
}

virtual bool do_always_noconv() const noexcept override { // return true if conversions never change input
bool do_always_noconv() const noexcept override { // return true if conversions never change input
return false;
}

virtual int do_max_length() const noexcept override { // return maximum length required for a conversion
int do_max_length() const noexcept override { // return maximum length required for a conversion
return 5;
}

virtual int do_encoding() const noexcept override { // return length of code sequence (from codecvt)
int do_encoding() const noexcept override { // return length of code sequence (from codecvt)
return 0; // 0 => varying length
}
};
Expand Down
Loading