Skip to content

Commit 8099af0

Browse files
authored
Merge pull request #5000 from angelhof/cpplint-cprover-prefix
Refine CPPLINT script to not report __CPROVER_ usage outside of strings
2 parents 79dd38f + 60c49fd commit 8099af0

File tree

3 files changed

+2
-10
lines changed

3 files changed

+2
-10
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_')

src/ansi-c/library/cprover.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ void __CPROVER_initialize(void);
3838
void __CPROVER_cover(__CPROVER_bool condition);
3939
#endif
4040

41-
// NOLINTNEXTLINE(build/deprecated)
4241
void __CPROVER_printf(const char *format, ...);
4342
void __CPROVER_input(const char *id, ...);
4443
void __CPROVER_output(const char *id, ...);
@@ -153,15 +152,10 @@ __CPROVER_bool __CPROVER_get_may(const void *, const char *);
153152
#define __CPROVER_danger_number_of_consts 1
154153

155154
// detect overflow
156-
// NOLINTNEXTLINE(build/deprecated)
157155
__CPROVER_bool __CPROVER_overflow_minus();
158-
// NOLINTNEXTLINE(build/deprecated)
159156
__CPROVER_bool __CPROVER_overflow_mult();
160-
// NOLINTNEXTLINE(build/deprecated)
161157
__CPROVER_bool __CPROVER_overflow_plus();
162-
// NOLINTNEXTLINE(build/deprecated)
163158
__CPROVER_bool __CPROVER_overflow_shl();
164-
// NOLINTNEXTLINE(build/deprecated)
165159
__CPROVER_bool __CPROVER_overflow_unary_minus();
166160

167161
#endif // CPROVER_ANSI_C_LIBRARY_CPROVER_H

src/cpp/library/cprover.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ void __CPROVER_assume(__CPROVER_bool assumption) __attribute__((__noreturn__));
2222
void __CPROVER_assert(__CPROVER_bool assertion, const char *description);
2323
void __CPROVER_precondition(__CPROVER_bool assertion, const char *description);
2424

25-
// NOLINTNEXTLINE(build/deprecated)
2625
void __CPROVER_input(const char *description, ...);
27-
// NOLINTNEXTLINE(build/deprecated)
2826
void __CPROVER_output(const char *description, ...);
2927

3028
// concurrency-related

0 commit comments

Comments
 (0)