Skip to content
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
7 changes: 7 additions & 0 deletions cpplint.py
Original file line number Diff line number Diff line change
Expand Up @@ -5055,6 +5055,7 @@ def CheckTrailingSemicolon(filename, clean_lines, linenum, error):
# - Compound literals
# - Lambdas
# - alignas specifier with anonymous structs
# - references to anonymous struct or union
# - decltype
# - concepts (requires expression)
closing_brace_pos = match.group(1).rfind(")")
Expand All @@ -5080,6 +5081,12 @@ def CheckTrailingSemicolon(filename, clean_lines, linenum, error):
)
)
or (func and not re.search(r"\boperator\s*\[\s*\]", func.group(1)))
or (
re.search(r"&\s*$", line_prefix)
and re.match(
r"(?:struct|union)\s", opening_parenthesis[0][opening_parenthesis[2] + 1 :]
)
)
or re.search(r"\b(?:struct|union)\s+alignas\s*$", line_prefix)
or re.search(r"\bdecltype$", line_prefix)
or re.search(r"\brequires.*$", line_prefix)
Expand Down
1 change: 1 addition & 0 deletions cpplint_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3062,6 +3062,7 @@ def testSemiColonAfterBraces(self):
for identifier in ["", " x"]:
self.TestLint(keyword + align + typename + " {}" + identifier + ";", "")

self.TestLint("struct mount_attr *attr = &(struct mount_attr){};", "")
Comment thread
aaronliu0130 marked this conversation as resolved.
self.TestLint("class X : public Y {};", "")
self.TestLint("class X : public MACRO() {};", "")
self.TestLint("class X : public decltype(expr) {};", "")
Expand Down