Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(264)

Unified Diff: PRESUBMIT.py

Issue 2707843002: Remove uses of #pragma once and add PRESUBMIT check. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/examples/peerconnection/client/conductor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: PRESUBMIT.py
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 3405ef9116fcd9e654af577ba49538e08ca945d3..f7500e80768f8c0750263afa5156f9e8cf6f48ec 100755
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -169,6 +169,26 @@ def _CheckNoIOStreamInHeaders(input_api, output_api):
return []
+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'
+ 'See http://www.chromium.org/developers/coding-style#TOC-File-headers',
+ files)]
+ return []
+
+
def _CheckNoFRIEND_TEST(input_api, output_api):
"""Make sure that gtest's FRIEND_TEST() macro is not used, the
FRIEND_TEST_ALL_PREFIXES() macro from testsupport/gtest_prod_util.h should be
@@ -514,6 +534,7 @@ def _CommonChecks(input_api, output_api):
input_api, output_api))
results.extend(_CheckNativeApiHeaderChanges(input_api, output_api))
results.extend(_CheckNoIOStreamInHeaders(input_api, output_api))
+ results.extend(_CheckNoPragmaOnce(input_api, output_api))
results.extend(_CheckNoFRIEND_TEST(input_api, output_api))
results.extend(_CheckGnChanges(input_api, output_api))
results.extend(_CheckUnwantedDependencies(input_api, output_api))
« no previous file with comments | « no previous file | webrtc/examples/peerconnection/client/conductor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698