summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authorEtienne Samson <samson.etienne@gmail.com>2019-01-04 14:04:48 +0100
committerEtienne Samson <samson.etienne@gmail.com>2019-01-04 14:04:48 +0100
commita74f4fb9d27875e46e330e66b0e40fff92b121d9 (patch)
treed447d610b6e5814842641f1cd4f2647a17db9484 /script
parent50d4688c316e60978963ff8fabc1b95a941eba24 (diff)
downloadlibgit2-a74f4fb9d27875e46e330e66b0e40fff92b121d9.tar.gz
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.
Diffstat (limited to 'script')
-rw-r--r--script/user_model.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/script/user_model.c b/script/user_model.c
index a933d735c..49425272e 100644
--- a/script/user_model.c
+++ b/script/user_model.c
@@ -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__();
+}