Skip to content

Refine CPPLINT script to not report __CPROVER_ usage outside of strings #5000

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scripts/cpplint.py
Original file line number Diff line number Diff line change
Expand Up @@ -4605,7 +4605,7 @@ def CheckAssert(filename, clean_lines, linenum, error):


def Check__CPROVER_(filename, clean_lines, linenum, error):
"""Check for uses of __CPROVER_.
"""Check for uses of __CPROVER_ in strings.

Args:
filename: The name of the current file.
Expand All @@ -4614,7 +4614,7 @@ def Check__CPROVER_(filename, clean_lines, linenum, error):
error: The function to call with any errors found.
"""
line = clean_lines.lines[linenum]
match = Match(r'.*__CPROVER_.*', line)
match = Match(r'.*"([^"\\]|\\.)*__CPROVER_([^"\\]|\\.)*".*', line)
if match:
error(filename, linenum, 'build/deprecated', 4,
'use CPROVER_PREFIX instead of __CPROVER_')
Expand Down
6 changes: 0 additions & 6 deletions src/ansi-c/library/cprover.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ void __CPROVER_initialize(void);
void __CPROVER_cover(__CPROVER_bool condition);
#endif

// NOLINTNEXTLINE(build/deprecated)
void __CPROVER_printf(const char *format, ...);
void __CPROVER_input(const char *id, ...);
void __CPROVER_output(const char *id, ...);
Expand Down Expand Up @@ -153,15 +152,10 @@ __CPROVER_bool __CPROVER_get_may(const void *, const char *);
#define __CPROVER_danger_number_of_consts 1

// detect overflow
// NOLINTNEXTLINE(build/deprecated)
__CPROVER_bool __CPROVER_overflow_minus();
// NOLINTNEXTLINE(build/deprecated)
__CPROVER_bool __CPROVER_overflow_mult();
// NOLINTNEXTLINE(build/deprecated)
__CPROVER_bool __CPROVER_overflow_plus();
// NOLINTNEXTLINE(build/deprecated)
__CPROVER_bool __CPROVER_overflow_shl();
// NOLINTNEXTLINE(build/deprecated)
__CPROVER_bool __CPROVER_overflow_unary_minus();

#endif // CPROVER_ANSI_C_LIBRARY_CPROVER_H
2 changes: 0 additions & 2 deletions src/cpp/library/cprover.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ void __CPROVER_assume(__CPROVER_bool assumption) __attribute__((__noreturn__));
void __CPROVER_assert(__CPROVER_bool assertion, const char *description);
void __CPROVER_precondition(__CPROVER_bool assertion, const char *description);

// NOLINTNEXTLINE(build/deprecated)
void __CPROVER_input(const char *description, ...);
// NOLINTNEXTLINE(build/deprecated)
void __CPROVER_output(const char *description, ...);

// concurrency-related
Expand Down