Skip to content

Fix unused variable warnings in rdma.c with NDEBUG#312

Open
bjosv wants to merge 2 commits into
valkey-io:mainfrom
bjosv:rdma-ndebug
Open

Fix unused variable warnings in rdma.c with NDEBUG#312
bjosv wants to merge 2 commits into
valkey-io:mainfrom
bjosv:rdma-ndebug

Conversation

@bjosv
Copy link
Copy Markdown
Collaborator

@bjosv bjosv commented May 15, 2026

Remove unnecessary local variables ctx and event in valkeyRdmaWaitConn that only existed to make an assert() more readable. When built with -DNDEBUG -Werror, the assert is removed and both variables become unused, causing a build failure.

Also enable Release build types in the RDMA CI job so that NDEBUG is defined and this class of issue is caught going forward.

Fixes #311

bjosv added 2 commits May 15, 2026 08:26
Signed-off-by: Björn Svensson <bjorn.a.svensson@est.tech>
Signed-off-by: Björn Svensson <bjorn.a.svensson@est.tech>
@bjosv
Copy link
Copy Markdown
Collaborator Author

bjosv commented May 15, 2026

@pizhenwei Are you ok with this change?

Comment thread src/rdma.c

static int valkeyRdmaWaitConn(valkeyContext *c, long timeout) {
long now, end;
RdmaContext *ctx = c->privctx;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declaring a temporary variable in a separate line, casting it from a private type pointer, and then accessing it — to me, the original style is more readable. However, I don’t object to the current style either.

Otherwise, LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

src/rdma.c: unused variable warnings with -DNDEBUG (treated as error with -Werror)

2 participants