-
Notifications
You must be signed in to change notification settings - Fork 274
Compile cbmc with NDEBUG using gcc tool chain on linux. #1477
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,7 +83,6 @@ class invariant_failedt: public std::logic_error | |
const std::string &reason); | ||
|
||
public: | ||
|
||
const std::string file; | ||
const std::string function; | ||
const int line; | ||
|
@@ -117,20 +116,24 @@ class invariant_failedt: public std::logic_error | |
#define INVARIANT(CONDITION, REASON) \ | ||
__CPROVER_assert((CONDITION), "Invariant : " REASON) | ||
|
||
#define INVARIANT_STRUCTURED(CONDITION, TYPENAME, ...) \ | ||
INVARIANT(CONDITION, "") | ||
|
||
#elif defined(CPROVER_INVARIANT_DO_NOT_CHECK) | ||
// For performance builds, invariants can be ignored | ||
// This is *not* recommended as it can result in unpredictable behaviour | ||
// including silently reporting incorrect results. | ||
// This is also useful for checking side-effect freedom. | ||
#define INVARIANT(CONDITION, REASON, ...) do {} while(0) | ||
#define INVARIANT(CONDITION, REASON) do {} while(0) | ||
#define INVARIANT_STRUCTURED(CONDITION, TYPENAME, ...) do {} while(0) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Having the ellipsis in the macro definition results in a warning, and without defining INVARIANT_STRUCTURED compilation will always fail. How did this ever work? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which warning would that be? It would be surprising that you are the first one to observe it?! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was surprised as well. See the discussion of the first commit. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suspect it didn't. The structured invariant stuff was added after the initial invariant support and it may have simply not been tested. I don't recall reviewing it. |
||
#elif defined(CPROVER_INVARIANT_ASSERT) | ||
// Not recommended but provided for backwards compatability | ||
#include <cassert> | ||
// NOLINTNEXTLINE(*) | ||
#define INVARIANT(CONDITION, REASON, ...) assert((CONDITION) && ((REASON), true)) | ||
|
||
#define INVARIANT(CONDITION, REASON) assert((CONDITION) && ((REASON), true)) | ||
// NOLINTNEXTLINE(*) | ||
#define INVARIANT_STRUCTURED(CONDITION, TYPENAME, ...) assert((CONDITION)) | ||
#else | ||
|
||
void print_backtrace(std::ostream &out); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Structured Invariant" might be a tad better but ... only if you are editing anyway.