Don't lint text between #if 0...#endif

This commit is contained in:
Kareem Khazem 2017-07-25 12:24:13 +01:00
parent 49bceb269a
commit d4be554988
1 changed files with 4 additions and 2 deletions

6
scripts/cpplint.py vendored
View File

@ -1377,7 +1377,8 @@ def CleanseRawStrings(raw_lines):
def FindNextMultiLineCommentStart(lines, lineix):
"""Find the beginning marker for a multiline comment."""
while lineix < len(lines):
if lines[lineix].strip().startswith('/*'):
if (lines[lineix].strip().startswith('/*') or
lines[lineix].strip().startswith('#if 0')):
# Only return this marker if the comment goes beyond this line
if lines[lineix].strip().find('*/', 2) < 0:
return lineix
@ -1388,7 +1389,8 @@ def FindNextMultiLineCommentStart(lines, lineix):
def FindNextMultiLineCommentEnd(lines, lineix):
"""We are inside a comment, find the end marker."""
while lineix < len(lines):
if lines[lineix].strip().endswith('*/'):
if (lines[lineix].strip().endswith('*/') or
lines[lineix].strip().endswith('#endif')):
return lineix
lineix += 1
return len(lines)