summaryrefslogtreecommitdiffstats
path: root/PRESUBMIT.py
diff options
context:
space:
mode:
authormarja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-22 18:11:56 +0000
committermarja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-22 18:11:56 +0000
commit962f117eb5ebc365e06c815a897885c4f683dafe (patch)
treed9653107e12b0b748a452b47347a96b46eb19965 /PRESUBMIT.py
parentbb40acf60c4caeb534bf091cbd44091b699043bd (diff)
downloadchromium_src-962f117eb5ebc365e06c815a897885c4f683dafe.zip
chromium_src-962f117eb5ebc365e06c815a897885c4f683dafe.tar.gz
chromium_src-962f117eb5ebc365e06c815a897885c4f683dafe.tar.bz2
PRESUBMIT #include check enhancement: <sys/..> includes can be in any order.
E.g., need to be in this order, since the latter uses definitions from the former. BUG=NONE Review URL: https://codereview.chromium.org/11418128 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169290 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'PRESUBMIT.py')
-rw-r--r--PRESUBMIT.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 7d93fa2..2fba7a5 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -558,6 +558,9 @@ def _CheckIncludeOrderInFile(input_api, f, is_source, changed_linenums):
"""Checks the #include order for the given file f."""
system_include_pattern = input_api.re.compile(r'\s*#include \<.*')
+ # Exclude #include <.../...> includes from the check; e.g., <sys/...> includes
+ # 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).*')
@@ -596,8 +599,9 @@ def _CheckIncludeOrderInFile(input_api, f, is_source, changed_linenums):
if if_pattern.match(line):
scopes.append(current_scope)
current_scope = []
- elif (system_include_pattern.match(line) or
- custom_include_pattern.match(line)):
+ elif ((system_include_pattern.match(line) or
+ custom_include_pattern.match(line)) and
+ not excluded_include_pattern.match(line)):
current_scope.append((line_num, line))
scopes.append(current_scope)