Index: PRESUBMIT.py |
diff --git a/PRESUBMIT.py b/PRESUBMIT.py |
index b395233d2462df2c941367ae9b9a33ca0d2afce1..ee75ad3dde2a4d706208b33f1bfd15d6c5a6cc13 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): |
M-A Ruel
2012/12/18 13:37:33
Why not just skip the file instead of aborting?
marja
2012/12/18 14:57:40
I assume you meant "line" instead of "file"; such
M-A Ruel
2012/12/18 20:02:07
Yes I meant line and not file. I don't mind.
lgtm
|
+ return [] |
if if_pattern.match(line): |
scopes.append(current_scope) |
current_scope = [] |