Skip to content

Get legalistic about use of override without virtual #2253

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

Merged
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 CODING_STANDARD.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ Formatting is enforced using clang-format. For more information about this, see
- Make references `const` whenever possible
- Make member functions `const` whenever possible
- Do not hide base class functions
- You are encouraged to use `override`
- When overriding a virtual function, use `override` (without `virtual`)
- Single argument constructors must be `explicit`
- Avoid implicit conversions
- Avoid `friend` declarations
Expand Down
30 changes: 15 additions & 15 deletions scripts/cpplint.py
Original file line number Diff line number Diff line change
Expand Up @@ -6136,21 +6136,21 @@ def CheckRedundantVirtual(filename, clean_lines, linenum, error):
if end_col < 0:
return # Couldn't find end of parameter list, give up

# # Look for "override" or "final" after the parameter list
# # (possibly on the next few lines).
# for i in xrange(end_line, min(end_line + 3, clean_lines.NumLines())):
# line = clean_lines.elided[i][end_col:]
# match = Search(r'\b(override|final)\b', line)
# if match:
# error(filename, linenum, 'readability/inheritance', 4,
# ('"virtual" is redundant since function is '
# 'already declared as "%s"' % match.group(1)))
#
# # Set end_col to check whole lines after we are done with the
# # first line.
# end_col = 0
# if Search(r'[^\w]\s*$', line):
# break
# Look for "override" or "final" after the parameter list
# (possibly on the next few lines).
for i in xrange(end_line, min(end_line + 3, clean_lines.NumLines())):
line = clean_lines.elided[i][end_col:]
match = Search(r'\b(override|final)\b', line)
if match:
error(filename, linenum, 'readability/inheritance', 4,
('"virtual" is redundant since function is '
'already declared as "%s"' % match.group(1)))

# Set end_col to check whole lines after we are done with the
# first line.
end_col = 0
if Search(r'[^\w]\s*$', line):
break



Expand Down