librdkafka icon indicating copy to clipboard operation
librdkafka copied to clipboard

Avoid unused variable warnings for return values used only in assertions

Open chrisnovakovic opened this issue 4 years ago • 3 comments

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().

chrisnovakovic avatar Sep 08 '21 15:09 chrisnovakovic

Rebased on master.

chrisnovakovic avatar Jan 27 '23 23:01 chrisnovakovic

CLA assistant check
All committers have signed the CLA.

cla-assistant[bot] avatar Aug 21 '23 15:08 cla-assistant[bot]

:tada: All Contributor License Agreements have been signed. Ready to merge.
:white_check_mark: chrisnovakovic
Please push an empty commit if you would like to re-run the checks to verify CLA status for all contributors.