Chromium Code Reviews| Index: PRESUBMIT.py |
| diff --git a/PRESUBMIT.py b/PRESUBMIT.py |
| index 7d93fa247e5a50f29ad6f771da500ddcd36a960d..8cf9cf0129f483f013f307088d69d25af2010b52 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 <sys/...> includes from the check; they often need to |
|
M-A Ruel
2012/11/22 14:36:51
I'd exclude anything with the pattern \<.+\?/.+?\>
marja
2012/11/22 18:08:53
Done; though I used a simpler pattern:
\s*#include
|
| + # appear in a specific order. |
| + sys_include_pattern = input_api.re.compile(r'\s*#include \<sys/.*') |
| 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 sys_include_pattern.match(line)): |
| current_scope.append((line_num, line)) |
| scopes.append(current_scope) |