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

Side by Side Diff: Tools/Scripts/webkitpy/style/checkers/cpp.py

Issue 648223003: Remove a few residual references to the old OVERRIDE and FINAL macros. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/wtf/Compiler.h ('k') | Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 # 2 #
3 # Copyright (C) 2009, 2010, 2012 Google Inc. All rights reserved. 3 # Copyright (C) 2009, 2010, 2012 Google Inc. All rights reserved.
4 # Copyright (C) 2009 Torch Mobile Inc. 4 # Copyright (C) 2009 Torch Mobile Inc.
5 # Copyright (C) 2009 Apple Inc. All rights reserved. 5 # Copyright (C) 2009 Apple Inc. All rights reserved.
6 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org) 6 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org)
7 # 7 #
8 # Redistribution and use in source and binary forms, with or without 8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions are 9 # modification, are permitted provided that the following conditions are
10 # met: 10 # met:
(...skipping 2384 matching lines...) Expand 10 before | Expand all | Expand 10 after
2395 if match(r'\s*{\s*$', line): 2395 if match(r'\s*{\s*$', line):
2396 # We allow an open brace to start a line in the case where someone 2396 # We allow an open brace to start a line in the case where someone
2397 # is using braces for function definition or in a block to 2397 # is using braces for function definition or in a block to
2398 # explicitly create a new scope, which is commonly used to control 2398 # explicitly create a new scope, which is commonly used to control
2399 # the lifetime of stack-allocated variables. We don't detect this 2399 # the lifetime of stack-allocated variables. We don't detect this
2400 # perfectly: we just don't complain if the last non-whitespace 2400 # perfectly: we just don't complain if the last non-whitespace
2401 # character on the previous non-blank line is ';', ':', '{', '}', 2401 # character on the previous non-blank line is ';', ':', '{', '}',
2402 # ')', or ') const' and doesn't begin with 'if|for|while|switch|else'. 2402 # ')', or ') const' and doesn't begin with 'if|for|while|switch|else'.
2403 # We also allow '#' for #endif and '=' for array initialization. 2403 # We also allow '#' for #endif and '=' for array initialization.
2404 previous_line = get_previous_non_blank_line(clean_lines, line_number)[0] 2404 previous_line = get_previous_non_blank_line(clean_lines, line_number)[0]
2405 if ((not search(r'[;:}{)=]\s*$|\)\s*((const|OVERRIDE|override|FINAL|fina l)\s*)*\s*$', previous_line) 2405 if ((not search(r'[;:}{)=]\s*$|\)\s*((const|override|final)\s*)*\s*$', p revious_line)
2406 or search(r'\b(if|for|foreach|while|switch|else)\b', previous_line) ) 2406 or search(r'\b(if|for|foreach|while|switch|else)\b', previous_line) )
2407 and previous_line.find('#') < 0): 2407 and previous_line.find('#') < 0):
2408 error(line_number, 'whitespace/braces', 4, 2408 error(line_number, 'whitespace/braces', 4,
2409 'This { should be at the end of the previous line') 2409 'This { should be at the end of the previous line')
2410 elif (search(r'\)\s*(((const|OVERRIDE|override|FINAL|final)\s*)*\s*)?{\s*$', line) 2410 elif (search(r'\)\s*(((const|override|final)\s*)*\s*)?{\s*$', line)
2411 and line.count('(') == line.count(')') 2411 and line.count('(') == line.count(')')
2412 and not search(r'\b(if|for|foreach|while|switch)\b', line) 2412 and not search(r'\b(if|for|foreach|while|switch)\b', line)
2413 and not match(r'\s+[A-Z_][A-Z_0-9]+\b', line)): 2413 and not match(r'\s+[A-Z_][A-Z_0-9]+\b', line)):
2414 error(line_number, 'whitespace/braces', 4, 2414 error(line_number, 'whitespace/braces', 4,
2415 'Place brace on its own line for function definitions.') 2415 'Place brace on its own line for function definitions.')
2416 2416
2417 # An else clause should be on the same line as the preceding closing brace. 2417 # An else clause should be on the same line as the preceding closing brace.
2418 if match(r'\s*else\s*', line): 2418 if match(r'\s*else\s*', line):
2419 previous_line = get_previous_non_blank_line(clean_lines, line_number)[0] 2419 previous_line = get_previous_non_blank_line(clean_lines, line_number)[0]
2420 if match(r'\s*}\s*$', previous_line): 2420 if match(r'\s*}\s*$', previous_line):
(...skipping 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after
4077 4077
4078 def check(self, lines): 4078 def check(self, lines):
4079 _process_lines(self.file_path, self.file_extension, lines, 4079 _process_lines(self.file_path, self.file_extension, lines,
4080 self.handle_style_error, self.min_confidence) 4080 self.handle_style_error, self.min_confidence)
4081 4081
4082 4082
4083 # FIXME: Remove this function (requires refactoring unit tests). 4083 # FIXME: Remove this function (requires refactoring unit tests).
4084 def process_file_data(filename, file_extension, lines, error, min_confidence, fs =None): 4084 def process_file_data(filename, file_extension, lines, error, min_confidence, fs =None):
4085 checker = CppChecker(filename, file_extension, error, min_confidence, fs) 4085 checker = CppChecker(filename, file_extension, error, min_confidence, fs)
4086 checker.check(lines) 4086 checker.check(lines)
OLDNEW
« no previous file with comments | « Source/wtf/Compiler.h ('k') | Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698