Chromium Code Reviews| Index: PRESUBMIT.py |
| diff --git a/PRESUBMIT.py b/PRESUBMIT.py |
| index aaf6544260c0ae6a01f42962b3f13d33ad133ffc..cf207823cc0f7f415f008f4c5563d35ff9248504 100644 |
| --- a/PRESUBMIT.py |
| +++ b/PRESUBMIT.py |
| @@ -354,6 +354,25 @@ def _CheckNoBannedFunctions(input_api, output_api): |
| return result |
| +def _CheckNoPragmaOnce(input_api, output_api): |
| + """Make sure that banned functions are not used.""" |
| + files = [] |
| + pattern = input_api.re.compile(r'^#pragma\s+once', |
| + input_api.re.MULTILINE) |
| + for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile): |
| + if not f.LocalPath().endswith('.h'): |
| + continue |
| + contents = input_api.ReadFile(f) |
| + if pattern.search(contents): |
| + files.append(f) |
| + |
| + if files: |
| + return [output_api.PresubmitError( |
| + 'Do not use #pragma once in header files.\n' + |
|
awong
2012/07/11 05:41:06
I don't think you need this plus to concat these s
dcheng
2012/07/11 05:44:19
Oops, you're right. I copied this from the iostrea
|
| + 'See http://www.chromium.org/developers/coding-style#TOC-File-headers', |
| + files)] |
| + return [] |
| + |
| def _CommonChecks(input_api, output_api): |
| """Checks common to both upload and commit.""" |
| @@ -368,6 +387,7 @@ def _CommonChecks(input_api, output_api): |
| results.extend(_CheckNoNewWStrings(input_api, output_api)) |
| results.extend(_CheckNoDEPSGIT(input_api, output_api)) |
| results.extend(_CheckNoBannedFunctions(input_api, output_api)) |
| + results.extend(_CheckNoPragmaOnce(input_api, output_api)) |
| return results |