Skip to content

Commit 249cdee

Browse files
Fix unused variable warnings in COVERAGE mode
1 parent 38f84ce commit 249cdee

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/util.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ static SECP256K1_INLINE void secp256k1_callback_call(const secp256k1_callback *
7373

7474
/* Like assert(), but when VERIFY is defined, and side-effect safe. */
7575
#if defined(COVERAGE)
76-
#define VERIFY_CHECK(check)
76+
/* Do nothing in coverage mode but try to stay syntactically correct.
77+
This suppresses a lot of implicit branches introduced by shortcutting
78+
operators at the cost of not being side-effect safe in coverage mode.
79+
We rely on the compiler to eliminate the if (0) statement entirely. */
80+
#define VERIFY_CHECK(cond) do { if (0) (void)(cond); } while(0)
7781
#define VERIFY_SETUP(stmt)
7882
#elif defined(VERIFY)
7983
#define VERIFY_CHECK CHECK

0 commit comments

Comments
 (0)