Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(readability/casting): noexcept *functions #377

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

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions cpplint.py
Original file line number Diff line number Diff line change
Expand Up @@ -6645,10 +6645,10 @@ def CheckCStyleCast(filename, clean_lines, linenum, cast_type, pattern, error):
if context.endswith((" operator++", " operator--", "::operator++", "::operator--")):
return False

# A single unnamed argument for a function tends to look like old style cast.
# If we see those, don't issue warnings for deprecated casts.
# A single unnamed argument for a function tends to look like old style cast;
# so do function pointers. If we see those, don't issue warnings for deprecated casts.
remainder = line[match.end(0) :]
if re.match(r"^\s*(?:;|const\b|throw\b|final\b|override\b|[=>{),]|->)", remainder):
if re.match(r"^\s*(?:;|(?:const|throw|final|override|noexcept)\b|[=>{),]|->)", remainder):
return False

# At this point, all that should be left is actual casts.
Expand Down
1 change: 1 addition & 0 deletions cpplint_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,7 @@ def testDeprecatedCast(self):
self.TestLint("void Function(bool(FunctionPointerArg)()) {}", "")
self.TestLint("typedef set<int64_t, bool(*)(int64_t, int64_t)> SortedIdSet", "")
self.TestLint("bool TraverseNode(T *Node, bool(VisitorBase:: *traverse) (T *t)) {}", "")
self.TestLint("void (*execute_)(operation_base*) noexcept(may_throw());", "")

# The second parameter to a gMock method definition is a function signature
# that often looks like a bad cast but should not picked up by lint.
Expand Down