-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suppress unused variable warning in helper_thread.c #1789
base: master
Are you sure you want to change the base?
Conversation
Allows `-Wunused-but-set-variable` to pass in opt mode. Adds what appears to be a missing assert.
helper_thread.c
Outdated
@@ -110,10 +110,12 @@ static void block_signals(void) | |||
sigset_t sigmask; | |||
|
|||
int ret; | |||
(void)ret; // Suppress unused variable warning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this line necessary with the assert added below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is. A more comprehensive take would be:
#if defined(NDEBUG)
#define USED_FOR_DEBUG(x) (void)0;
#else
#define USED_FOR_DEBUG(x) (void)x;
#endif
That way the warning is suppressed during debug mode, but not during opt mode.
But this seems simpler for a smaller codebase.
I've built with Our CI builds with What did you do to trigger this warning? |
@vincentkfu Our builds use a different build system with LLVM-15 with |
Ok. The convention in our codebase is to use |
@vincentkfu - Thanks! I've made the change. My apologies for not noticing your convention the first time. |
These are small changes but I can't let them go in this way. How about this: Patch 1: add missing assert only Please make sure the commit messages for each patch accurately describe the purpose of the change. |
Allows
-Wunused-but-set-variable
to pass in opt mode. Adds what appears to be a missing assert.Please confirm that your commit message(s) follow these guidelines:
aren't something like a URL at 72-74 chars.
Reminders:
cconv.c and bump FIO_SERVER_VER in server.h
FIO_IOOPS_VERSION in ioengines.h.