summaryrefslogtreecommitdiffstats
path: root/cc/PRESUBMIT.py
diff options
context:
space:
mode:
authormostynb <mostynb@opera.com>2014-10-06 11:07:37 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-06 18:07:51 +0000
commitf68776d8c52601899d957c7ac222693fd51405d2 (patch)
treee769b135b24375bf55447c1c4638a99927e4d98c /cc/PRESUBMIT.py
parentee4b857ca20186868aad7a5b22fc454a11b6fe86 (diff)
downloadchromium_src-f68776d8c52601899d957c7ac222693fd51405d2.zip
chromium_src-f68776d8c52601899d957c7ac222693fd51405d2.tar.gz
chromium_src-f68776d8c52601899d957c7ac222693fd51405d2.tar.bz2
replace OVERRIDE and FINAL with override and final in cc/
BUG=417463 Review URL: https://codereview.chromium.org/628443002 Cr-Commit-Position: refs/heads/master@{#298271}
Diffstat (limited to 'cc/PRESUBMIT.py')
-rw-r--r--cc/PRESUBMIT.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/cc/PRESUBMIT.py b/cc/PRESUBMIT.py
index f381684..d749aac 100644
--- a/cc/PRESUBMIT.py
+++ b/cc/PRESUBMIT.py
@@ -313,6 +313,42 @@ def CheckForUseOfWrongClock(input_api,
else:
return []
+def CheckOverrideFinal(input_api, output_api,
+ whitelist=CC_SOURCE_FILES, blacklist=None):
+ """Make sure new lines of code don't use the OVERRIDE or FINAL macros."""
+
+ # TODO(mostynb): remove this check once the macros are removed
+ # from base/compiler_specific.h.
+
+ errors = []
+
+ source_file_filter = lambda x: input_api.FilterSourceFile(
+ x, white_list=CC_SOURCE_FILES, black_list=None)
+
+ override_files = []
+ final_files = []
+
+ for f in input_api.AffectedSourceFiles(source_file_filter):
+ contents = input_api.ReadFile(f, 'rb')
+
+ # "override" and "final" should be used instead of OVERRIDE/FINAL now.
+ if re.search(r"\bOVERRIDE\b", contents):
+ override_files.append(f.LocalPath())
+
+ if re.search(r"\bFINAL\b", contents):
+ final_files.append(f.LocalPath())
+
+ if override_files:
+ return [output_api.PresubmitError(
+ 'These files use OVERRIDE instead of using override:',
+ items=override_files)]
+ if final_files:
+ return [output_api.PresubmitError(
+ 'These files use FINAL instead of using final:',
+ items=final_files)]
+
+ return []
+
def CheckChangeOnUpload(input_api, output_api):
results = []
results += CheckAsserts(input_api, output_api)
@@ -324,6 +360,7 @@ def CheckChangeOnUpload(input_api, output_api):
results += CheckNamespace(input_api, output_api)
results += CheckForUseOfWrongClock(input_api, output_api)
results += FindUselessIfdefs(input_api, output_api)
+ results += CheckOverrideFinal(input_api, output_api)
results += input_api.canned_checks.CheckPatchFormatted(input_api, output_api)
return results