| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Top-level presubmit script for Chromium. | 5 """Top-level presubmit script for Chromium. |
| 6 | 6 |
| 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
| 8 for more details about the presubmit API built into gcl. | 8 for more details about the presubmit API built into gcl. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 ( | 195 ( |
| 196 'SkAutoUnref', | 196 'SkAutoUnref', |
| 197 ( | 197 ( |
| 198 'The indirect use of SkAutoTUnref through SkAutoUnref is dangerous ', | 198 'The indirect use of SkAutoTUnref through SkAutoUnref is dangerous ', |
| 199 'because it implicitly converts to a raw pointer. ', | 199 'because it implicitly converts to a raw pointer. ', |
| 200 'Please use skia::RefPtr instead.' | 200 'Please use skia::RefPtr instead.' |
| 201 ), | 201 ), |
| 202 True, | 202 True, |
| 203 (), | 203 (), |
| 204 ), | 204 ), |
| 205 ( |
| 206 r'/HANDLE_EINTR\(.*close', |
| 207 ( |
| 208 'HANDLE_EINTR(close) is invalid. If close fails with EINTR, the file', |
| 209 'descriptor will be closed, and it is incorrect to retry the close.', |
| 210 'Either call close directly and ignore its return value, or wrap close', |
| 211 'in IGNORE_EINTR to use its return value. See http://crbug.com/269623' |
| 212 ), |
| 213 True, |
| 214 (), |
| 215 ), |
| 216 ( |
| 217 r'/IGNORE_EINTR\((?!.*close)', |
| 218 ( |
| 219 'IGNORE_EINTR is only valid when wrapping close. To wrap other system', |
| 220 'calls, use HANDLE_EINTR. See http://crbug.com/269623', |
| 221 ), |
| 222 True, |
| 223 ( |
| 224 # Files that #define IGNORE_EINTR. |
| 225 r'^base[\\\/]posix[\\\/]eintr_wrapper\.h$', |
| 226 r'^ppapi[\\\/]tests[\\\/]test_broker\.cc$', |
| 227 ), |
| 228 ), |
| 205 ) | 229 ) |
| 206 | 230 |
| 207 | 231 |
| 208 _VALID_OS_MACROS = ( | 232 _VALID_OS_MACROS = ( |
| 209 # Please keep sorted. | 233 # Please keep sorted. |
| 210 'OS_ANDROID', | 234 'OS_ANDROID', |
| 211 'OS_BSD', | 235 'OS_BSD', |
| 212 'OS_CAT', # For testing. | 236 'OS_CAT', # For testing. |
| 213 'OS_CHROMEOS', | 237 'OS_CHROMEOS', |
| 214 'OS_FREEBSD', | 238 'OS_FREEBSD', |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 for line_num, line in f.ChangedContents(): | 392 for line_num, line in f.ChangedContents(): |
| 369 for func_name, message, error, excluded_paths in _BANNED_CPP_FUNCTIONS: | 393 for func_name, message, error, excluded_paths in _BANNED_CPP_FUNCTIONS: |
| 370 def IsBlacklisted(affected_file, blacklist): | 394 def IsBlacklisted(affected_file, blacklist): |
| 371 local_path = affected_file.LocalPath() | 395 local_path = affected_file.LocalPath() |
| 372 for item in blacklist: | 396 for item in blacklist: |
| 373 if input_api.re.match(item, local_path): | 397 if input_api.re.match(item, local_path): |
| 374 return True | 398 return True |
| 375 return False | 399 return False |
| 376 if IsBlacklisted(f, excluded_paths): | 400 if IsBlacklisted(f, excluded_paths): |
| 377 continue | 401 continue |
| 378 if func_name in line: | 402 matched = False |
| 403 if func_name[0:1] == '/': |
| 404 regex = func_name[1:] |
| 405 if input_api.re.search(regex, line): |
| 406 matched = True |
| 407 elif func_name in line: |
| 408 matched = True |
| 409 if matched: |
| 379 problems = warnings; | 410 problems = warnings; |
| 380 if error: | 411 if error: |
| 381 problems = errors; | 412 problems = errors; |
| 382 problems.append(' %s:%d:' % (f.LocalPath(), line_num)) | 413 problems.append(' %s:%d:' % (f.LocalPath(), line_num)) |
| 383 for message_line in message: | 414 for message_line in message: |
| 384 problems.append(' %s' % message_line) | 415 problems.append(' %s' % message_line) |
| 385 | 416 |
| 386 result = [] | 417 result = [] |
| 387 if (warnings): | 418 if (warnings): |
| 388 result.append(output_api.PresubmitPromptWarning( | 419 result.append(output_api.PresubmitPromptWarning( |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1138 trybots += ['cros_x86'] | 1169 trybots += ['cros_x86'] |
| 1139 | 1170 |
| 1140 # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it | 1171 # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it |
| 1141 # unless they're .gyp(i) files as changes to those files can break the gyp | 1172 # unless they're .gyp(i) files as changes to those files can break the gyp |
| 1142 # step on that bot. | 1173 # step on that bot. |
| 1143 if (not all(re.search('^chrome', f) for f in files) or | 1174 if (not all(re.search('^chrome', f) for f in files) or |
| 1144 any(re.search('\.gypi?$', f) for f in files)): | 1175 any(re.search('\.gypi?$', f) for f in files)): |
| 1145 trybots += ['android_aosp'] | 1176 trybots += ['android_aosp'] |
| 1146 | 1177 |
| 1147 return trybots | 1178 return trybots |
| OLD | NEW |