Skip to content

Commit

Permalink
Update to handle c++11
Browse files Browse the repository at this point in the history
  • Loading branch information
nkoenig committed Jul 14, 2014
1 parent 1a242d1 commit f8a4767
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tools/cpplint.py
Original file line number Diff line number Diff line change
Expand Up @@ -1869,7 +1869,8 @@ def CheckSpacing(filename, clean_lines, linenum, error):
# an initializer list, for instance), you should have spaces before your
# braces. And since you should never have braces at the beginning of a line,
# this is an easy test.
if Search(r'[^ ({]{', line):
if (Search(r'[^ ({]{', line) and not Search(r'{}()', line) and
not Search(r'{.*};', line)):
error(filename, linenum, 'whitespace/braces', 5,
'Missing space before {')

Expand Down Expand Up @@ -2036,11 +2037,12 @@ def CheckBraces(filename, clean_lines, linenum, error):
line = prevline + line
else:
break
if (Search(r'{.*}\s*;', line) and
line.count('{') == line.count('}') and
not Search(r'struct|class|enum|\s*=\s*{', line)):
error(filename, linenum, 'readability/braces', 4,
"You don't need a ; after a }")
# Disabling this because it's invalid for c++11
# if (Search(r'{.*}\s*;', line) and
# line.count('{') == line.count('}') and
# not Search(r'struct|class|enum|\s*=\s*{', line)):
# error(filename, linenum, 'readability/braces', 4,
# "You don't need a ; after a }")


def ReplaceableCheck(operator, macro, line):
Expand Down

0 comments on commit f8a4767

Please sign in to comment.