diff options
Diffstat (limited to 'tools/cpplint.py')
| -rwxr-xr-x | tools/cpplint.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/cpplint.py b/tools/cpplint.py index 30c712856e..0b5fb93536 100755 --- a/tools/cpplint.py +++ b/tools/cpplint.py @@ -645,6 +645,11 @@ class _FunctionState(object): filename: The name of the current file. linenum: The number of the line to check. """ + # BEGIN android-added + if not self.in_a_function: + return + # END android-added + if Match(r'T(EST|est)', self.current_function): base_trigger = self._TEST_TRIGGER else: @@ -1201,7 +1206,6 @@ threading_list = ( ('gmtime(', 'gmtime_r('), ('localtime(', 'localtime_r('), ('rand(', 'rand_r('), - ('readdir(', 'readdir_r('), ('strtok(', 'strtok_r('), ('ttyname(', 'ttyname_r('), ) @@ -1526,7 +1530,10 @@ def CheckSpacingForFunctionCall(filename, line, linenum, error): # Note that we assume the contents of [] to be short enough that # they'll never need to wrap. if ( # Ignore control structures. - not Search(r'\b(if|for|while|switch|return|delete)\b', fncall) and + # BEGIN android-changed + # not Search(r'\b(if|for|while|switch|return|delete)\b', fncall) and + not Search(r'\b(if|for|while|switch|return|delete|new)\b', fncall) and + # END android-changed # Ignore pointers/references to functions. not Search(r' \([^)]+\)\([^)]*(\)|,$)', fncall) and # Ignore pointers/references to arrays. |