Skip to content

Commit 8431b77

Browse files
committed
fix(readability/casting): noexcept *functions
1 parent 2d2e1c9 commit 8431b77

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

cpplint.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6645,10 +6645,10 @@ def CheckCStyleCast(filename, clean_lines, linenum, cast_type, pattern, error):
66456645
if context.endswith((" operator++", " operator--", "::operator++", "::operator--")):
66466646
return False
66476647

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

66546654
# At this point, all that should be left is actual casts.

cpplint_unittest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,6 +1066,7 @@ def testDeprecatedCast(self):
10661066
self.TestLint("void Function(bool(FunctionPointerArg)()) {}", "")
10671067
self.TestLint("typedef set<int64_t, bool(*)(int64_t, int64_t)> SortedIdSet", "")
10681068
self.TestLint("bool TraverseNode(T *Node, bool(VisitorBase:: *traverse) (T *t)) {}", "")
1069+
self.TestLint("void (*execute_)(operation_base*) noexcept(may_throw());", "")
10691070

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy