mirror of
https://github.com/libgit2/libgit2.git
synced 2026-01-25 02:56:17 +00:00
coverity: attempt to model clar's assertions
Coverity considers that anything that looks like assert() behaves like it (ie. side-effects would be skipped on a NDEBUG build). As we have a bunch of those in the test suite (128), this would ensure Coverity isn't confused.
This commit is contained in:
@@ -73,3 +73,26 @@ int git_buf_set(git_buf *buf, const void *data, size_t len)
|
||||
buf->size = len + 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void clar__fail(
|
||||
const char *file,
|
||||
int line,
|
||||
const char *error,
|
||||
const char *description,
|
||||
int should_abort)
|
||||
{
|
||||
if (should_abort)
|
||||
__coverity_panic__();
|
||||
}
|
||||
|
||||
void clar__assert(
|
||||
int condition,
|
||||
const char *file,
|
||||
int line,
|
||||
const char *error,
|
||||
const char *description,
|
||||
int should_abort)
|
||||
{
|
||||
if (!condition && should_abort)
|
||||
__coverity_panic__();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user