1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

Only strip the newline character at the end of the lines that we're considering

for length and for trailing whitespace; otherwise, the whitespace themselves
will also be removed.

llvm-svn: 65182
This commit is contained in:
Misha Brukman 2009-02-20 22:28:45 +00:00
parent 380e3db1b4
commit 9d4bf3a090

View File

@ -15,7 +15,7 @@ def VerifyLineLength(filename, lines, max_length):
"""
line_num = 1
for line in lines:
length = len(line.rstrip())
length = len(line.rstrip('\n'))
if length > max_length:
print '%s:%d:Line exceeds %d chars (%d)' % (filename, line_num,
max_length, length)
@ -32,7 +32,7 @@ def VerifyTrailingWhitespace(filename, lines):
trailing_whitespace_re = re.compile(r'\s+$')
line_num = 1
for line in lines:
if trailing_whitespace_re.match(line.rstrip()):
if trailing_whitespace_re.match(line.rstrip('\n')):
print '%s:%d:Trailing whitespace' % (filename, line_num)
line_num += 1