Skip to content

Commit 64de843

Browse files
authored
Remove blacklist/whitelist from cpplint.py (#562)
Remove blacklist/whitelist from cpplint.py Merges pull request #562 from @nealrichardson.
2 parents b448694 + 08268ef commit 64de843

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

cpplint/cpplint.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3866,9 +3866,9 @@ def CheckTrailingSemicolon(filename, clean_lines, linenum, error):
38663866

38673867
# Block bodies should not be followed by a semicolon. Due to C++11
38683868
# brace initialization, there are more places where semicolons are
3869-
# required than not, so we use a whitelist approach to check these
3870-
# rather than a blacklist. These are the places where "};" should
3871-
# be replaced by just "}":
3869+
# required than not, so we explicitly list the allowed rules rather
3870+
# than listing the disallowed ones. These are the places where "};"
3871+
# should be replaced by just "}":
38723872
# 1. Some flavor of block following closing parenthesis:
38733873
# for (;;) {};
38743874
# while (...) {};
@@ -3924,11 +3924,11 @@ def CheckTrailingSemicolon(filename, clean_lines, linenum, error):
39243924
# - INTERFACE_DEF
39253925
# - EXCLUSIVE_LOCKS_REQUIRED, SHARED_LOCKS_REQUIRED, LOCKS_EXCLUDED:
39263926
#
3927-
# We implement a whitelist of safe macros instead of a blacklist of
3927+
# We implement a list of safe macros instead of a list of
39283928
# unsafe macros, even though the latter appears less frequently in
39293929
# google code and would have been easier to implement. This is because
3930-
# the downside for getting the whitelist wrong means some extra
3931-
# semicolons, while the downside for getting the blacklist wrong
3930+
# the downside for getting the allowed checks wrong means some extra
3931+
# semicolons, while the downside for getting disallowed checks wrong
39323932
# would result in compile errors.
39333933
#
39343934
# In addition to macros, we also don't want to warn on
@@ -5124,19 +5124,19 @@ def CheckForNonConstReference(filename, clean_lines, linenum,
51245124
#
51255125
# We also accept & in static_assert, which looks like a function but
51265126
# it's actually a declaration expression.
5127-
whitelisted_functions = (r'(?:[sS]wap(?:<\w:+>)?|'
5127+
allowed_functions = (r'(?:[sS]wap(?:<\w:+>)?|'
51285128
r'operator\s*[<>][<>]|'
51295129
r'static_assert|COMPILE_ASSERT'
51305130
r')\s*\(')
5131-
if Search(whitelisted_functions, line):
5131+
if Search(allowed_functions, line):
51325132
return
51335133
elif not Search(r'\S+\([^)]*$', line):
5134-
# Don't see a whitelisted function on this line. Actually we
5134+
# Don't see an allowed function on this line. Actually we
51355135
# didn't see any function name on this line, so this is likely a
51365136
# multi-line parameter list. Try a bit harder to catch this case.
51375137
for i in xrange(2):
51385138
if (linenum > i and
5139-
Search(whitelisted_functions, clean_lines.elided[linenum - i - 1])):
5139+
Search(allowed_functions, clean_lines.elided[linenum - i - 1])):
51405140
return
51415141

51425142
decls = ReplaceAll(r'{[^}]*}', ' ', line) # exclude function body

0 commit comments

Comments
 (0)