From: Bart Van Assche Date: Fri, 16 Mar 2018 15:44:35 +0000 (-0700) Subject: Make sure that assert() expressions do not have side effects X-Git-Tag: fio-3.6~39^2~1 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=93b45bb2e4c511f2d9a9a7552d74e1d921b0bf76 Make sure that assert() expressions do not have side effects Assert statements are compiled out if NDEBUG is defined. Hence make sure that the expressions passed to assert do not have side effects. Signed-off-by: Bart Van Assche --- diff --git a/io_u.c b/io_u.c index 01b36938..84d93155 100644 --- a/io_u.c +++ b/io_u.c @@ -1558,6 +1558,7 @@ bool queue_full(const struct thread_data *td) struct io_u *__get_io_u(struct thread_data *td) { struct io_u *io_u = NULL; + int ret; if (td->stop_io) return NULL; @@ -1594,7 +1595,8 @@ again: * return one */ assert(!(td->flags & TD_F_CHILD)); - assert(!pthread_cond_wait(&td->free_cond, &td->io_u_lock)); + ret = pthread_cond_wait(&td->free_cond, &td->io_u_lock); + assert(ret == 0); goto again; }