From d4be554988481b9a0c5e79bcf22bc04b2efb41c5 Mon Sep 17 00:00:00 2001 From: Kareem Khazem Date: Tue, 25 Jul 2017 12:24:13 +0100 Subject: [PATCH] Don't lint text between #if 0...#endif --- scripts/cpplint.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/cpplint.py b/scripts/cpplint.py index a41d26d772..68ba0f5e6b 100755 --- a/scripts/cpplint.py +++ b/scripts/cpplint.py @@ -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)