diff options
author | shawnsingh@google.com <shawnsingh@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-29 01:00:19 +0000 |
---|---|---|
committer | shawnsingh@google.com <shawnsingh@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-29 01:00:19 +0000 |
commit | edc9183c42f56dbdedafb6455bb6ac71c97d7faf (patch) | |
tree | 914ea5ded792c4b48728ede20e488c3155b2c686 /cc/PRESUBMIT.py | |
parent | 8f1e35f3f703c9be068dda4aeb476b8c7b2ca48c (diff) | |
download | chromium_src-edc9183c42f56dbdedafb6455bb6ac71c97d7faf.zip chromium_src-edc9183c42f56dbdedafb6455bb6ac71c97d7faf.tar.gz chromium_src-edc9183c42f56dbdedafb6455bb6ac71c97d7faf.tar.bz2 |
Revert 214144 "Add PRESUBMIT check to cc to ensure that C++ std:..."
For some reason patch is causing a win7_aura failure, reverting
to investigate.
> Add PRESUBMIT check to cc to ensure that C++ std::abs is used
>
> Before this patch, it is possible to use abs() without the std::
> namespace qualifier, which may link to the C standard library
> implementation of abs(). Thus, someone using abs(float) may get
> wrong results because C standard version will convert the float
> to an int. This patch updates the occurrences of of abs() and
> fabs() in cc/ (though technically none were incorrect, thankfully)
> and adds a PRESUBMIT to enforce that all uses of abs from now on
> have an explicit std:: to resolve them correctly.
>
> BUG=261900
> R=enne@chromium.org
>
> Review URL: https://codereview.chromium.org/19835003
TBR=shawnsingh@google.com
Review URL: https://codereview.chromium.org/20992002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214149 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/PRESUBMIT.py')
-rw-r--r-- | cc/PRESUBMIT.py | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/cc/PRESUBMIT.py b/cc/PRESUBMIT.py index bcf71ef..83c22ab 100644 --- a/cc/PRESUBMIT.py +++ b/cc/PRESUBMIT.py @@ -57,46 +57,6 @@ def CheckAsserts(input_api, output_api, white_list=CC_SOURCE_FILES, black_list=N items=notreached_files)] return [] -def CheckStdAbs(input_api, output_api, - white_list=CC_SOURCE_FILES, black_list=None): - black_list = tuple(black_list or input_api.DEFAULT_BLACK_LIST) - source_file_filter = lambda x: input_api.FilterSourceFile(x, - white_list, - black_list) - - using_std_abs_files = [] - found_fabs_files = [] - missing_std_prefix_files = [] - - for f in input_api.AffectedSourceFiles(source_file_filter): - contents = input_api.ReadFile(f, 'rb') - if re.search(r"using std::f?abs;", contents): - using_std_abs_files.append(f.LocalPath()) - if re.search(r"\bfabsf?\(", contents): - found_fabs_files.append(f.LocalPath()); - # The following regular expression in words says: - # "if there is no 'std::' behind an 'abs(' or 'absf(', - # or if there is no 'std::' behind a 'fabs(' or 'fabsf(', - # then it's a match." - if re.search(r"((?<!std::)(\babsf?\()|(?<!std::)(\bfabsf?\())", contents): - missing_std_prefix_files.append(f.LocalPath()) - - result = [] - if using_std_abs_files: - result.append(output_api.PresubmitError( - 'These files have "using std::abs" which is not permitted.', - items=using_std_abs_files)) - if found_fabs_files: - result.append(output_api.PresubmitError( - 'std::abs() should be used instead of std::fabs() for consistency.', - items=found_fabs_files)) - if missing_std_prefix_files: - result.append(output_api.PresubmitError( - 'These files use abs(), absf(), fabs(), or fabsf() without qualifying ' - 'the std namespace. Please use std::abs() in all places.', - items=missing_std_prefix_files)) - return result - def CheckSpamLogging(input_api, output_api, white_list=CC_SOURCE_FILES, @@ -180,7 +140,6 @@ def CheckTodos(input_api, output_api): def CheckChangeOnUpload(input_api, output_api): results = [] results += CheckAsserts(input_api, output_api) - results += CheckStdAbs(input_api, output_api) results += CheckSpamLogging(input_api, output_api, black_list=CC_PERF_TEST) results += CheckPassByValue(input_api, output_api) results += CheckChangeLintsClean(input_api, output_api) |