diff options
author | marja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-18 20:17:11 +0000 |
---|---|---|
committer | marja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-18 20:17:11 +0000 |
commit | 0e5c185616221930126116017b66d577067c78ae (patch) | |
tree | 8ffee7b789c4ccb2647b8aef13185236aede2246 /PRESUBMIT.py | |
parent | 083c02368d175e7fdd8a1b31568875ab77f616d7 (diff) | |
download | chromium_src-0e5c185616221930126116017b66d577067c78ae.zip chromium_src-0e5c185616221930126116017b66d577067c78ae.tar.gz chromium_src-0e5c185616221930126116017b66d577067c78ae.tar.bz2 |
PRESUBMIT #include check: exclude known cases which need a non-standard order.
BUG=NONE
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/11607019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173773 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'PRESUBMIT.py')
-rw-r--r-- | PRESUBMIT.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/PRESUBMIT.py b/PRESUBMIT.py index b395233..ee75ad3 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -557,8 +557,13 @@ def _CheckIncludeOrderInFile(input_api, f, changed_linenums): # often need to appear in a specific order. excluded_include_pattern = input_api.re.compile(r'\s*#include \<.*/.*') custom_include_pattern = input_api.re.compile(r'\s*#include "(?P<FILE>.*)"') - if_pattern = ( - input_api.re.compile(r'\s*#\s*(if|elif|else|endif|define|undef).*')) + if_pattern = input_api.re.compile( + r'\s*#\s*(if|elif|else|endif|define|undef).*') + # Some files need specialized order of includes; exclude such files from this + # check. + uncheckable_includes_pattern = input_api.re.compile( + r'\s*#include ' + '("ipc/.*macros\.h"|<windows\.h>|".*gl.*autogen.h")\s*') contents = f.NewContents() warnings = [] @@ -591,6 +596,8 @@ def _CheckIncludeOrderInFile(input_api, f, changed_linenums): current_scope = [] for line in contents[line_num:]: line_num += 1 + if uncheckable_includes_pattern.match(line): + return [] if if_pattern.match(line): scopes.append(current_scope) current_scope = [] |