Skip to content

Commit 59ab9e9

Browse files
committed
Refine the CPPLINT script to not report a __CPROVER_ misuse false positive
Change r'.*__CPROVER_.*' with r'.*"([^"\\]|\\.)*__CPROVER_([^"\\]|\\.)*".*' so that only occurrences of __CPROVER_ in strings are caught. Note that this check will still erroneously complain for the following "foo" __CPROVER_func() "bar"
1 parent f4a6f43 commit 59ab9e9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/cpplint.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4605,7 +4605,7 @@ def CheckAssert(filename, clean_lines, linenum, error):
46054605

46064606

46074607
def Check__CPROVER_(filename, clean_lines, linenum, error):
4608-
"""Check for uses of __CPROVER_.
4608+
"""Check for uses of __CPROVER_ in strings.
46094609
46104610
Args:
46114611
filename: The name of the current file.
@@ -4614,7 +4614,7 @@ def Check__CPROVER_(filename, clean_lines, linenum, error):
46144614
error: The function to call with any errors found.
46154615
"""
46164616
line = clean_lines.lines[linenum]
4617-
match = Match(r'.*__CPROVER_.*', line)
4617+
match = Match(r'.*"([^"\\]|\\.)*__CPROVER_([^"\\]|\\.)*".*', line)
46184618
if match:
46194619
error(filename, linenum, 'build/deprecated', 4,
46204620
'use CPROVER_PREFIX instead of __CPROVER_')

0 commit comments

Comments
 (0)