librdkafka
librdkafka copied to clipboard
Avoid unused variable warnings for return values used only in assertions
The return values of many functions are assigned to variables for the sole purpose of using them in assertion conditions, which causes unused variable warnings to be emitted at compile-time when NDEBUG
is defined. Use some compiler trickery in the definition of rd_assert()
to avoid unused variable warnings when variables in the assertion condition are only used for that purpose, and ensure that assertions whose conditions contain single-use variables use rd_assert()
instead of assert()
.