diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-18 17:46:52 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-18 17:46:52 +0000 |
commit | 7777d9633bed51e5458ca2ec4b0df1f73d809bfb (patch) | |
tree | bd43e98d29fd1c5584a64f0622b3742f6eedc0e8 /tools/checkdeps | |
parent | 3d076e00ef5aec7b3c2fdb0e72b8eb200676b303 (diff) | |
download | chromium_src-7777d9633bed51e5458ca2ec4b0df1f73d809bfb.zip chromium_src-7777d9633bed51e5458ca2ec4b0df1f73d809bfb.tar.gz chromium_src-7777d9633bed51e5458ca2ec4b0df1f73d809bfb.tar.bz2 |
Let checkdeps ignore #if 0 blocks. Also strip lines of leading/trailing whitespaces before checking.
Review URL: http://codereview.chromium.org/42316
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11986 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/checkdeps')
-rwxr-xr-x | tools/checkdeps/checkdeps.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tools/checkdeps/checkdeps.py b/tools/checkdeps/checkdeps.py index 9cbfa2f..96e9a16 100755 --- a/tools/checkdeps/checkdeps.py +++ b/tools/checkdeps/checkdeps.py @@ -330,8 +330,21 @@ def CheckFile(rules, file_name): ret_val = "" # We'll collect the error messages in here try: cur_file = open(file_name, "r") + in_if0 = 0 for cur_line in range(MAX_LINES): - cur_line = cur_file.readline(MAX_LINE_LENGTH) + cur_line = cur_file.readline(MAX_LINE_LENGTH).strip() + + # Check to see if we're at / inside a #if 0 block + if cur_line == '#if 0': + in_if0 += 1 + continue + if in_if0 > 0: + if cur_line.startswith('#if'): + in_if0 += 1 + elif cur_line == '#endif': + in_if0 -= 1 + continue + line_status = CheckLine(rules, cur_line) if line_status is not None: if len(line_status) > 0: # Add newline to separate messages. |