-
Notifications
You must be signed in to change notification settings - Fork 204
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
Fix compiler warnings #693
Conversation
@@ -188,6 +188,7 @@ void option_list::parse(int argc, char** argv) | |||
} catch (std::exception& exc) { | |||
throw std::exception(); | |||
}; | |||
break; |
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.
The fall-through here was a bug; it caused a blank line to be printed if the -R
, -j
, or -p
options were used with volk_profile
.
switch (help_line.size() / 8) { | ||
case 0: | ||
help_line += "\t"; | ||
case 1: | ||
help_line += "\t"; | ||
case 2: | ||
help_line += "\t"; | ||
case 3: | ||
help_line += "\t"; |
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.
This code is just meant to line up the tables that are displayed by volk_profile --help
and volk_config-info --help
. The new version gets rid of the fall-through warnings, and is simpler.
(void)input; | ||
|
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's intentional that input
is unused, so I added (void)input
to suppress the unused parameter warnings.
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.
C23 provides something for this exact situation:
maybe_unused
I suggest to add a comment to the (void)input;
lines because this will make it more verbose. Otherwise, someone may remove these lines in the future because the look superfluous.
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.
as to give a differing opinion: (void)input;
is the canonical way of silencing this warning and thus of marking a variable as unused. It's as concise as it gets! (and pretty unambiguous; if there's a (void)input;
in the code, and you are about to remove it, you would reasonably ask yourself why it is in the code, and stackoverflow has you covered.
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.
(also, the goal here would be to enable -Werror -Wunused-parameter
so that a removal of that line would become a build fail)
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.
I found one little thing that could improve the code for future reference.
Signed-off-by: Clayton Smith <[email protected]>
06afa9d
to
b900da1
Compare
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.
LGTM.
Fix compiler warnings
When building with
-DCMAKE_BUILD_TYPE=ASAN
a number of compiler warnings are shown. I've cleaned up most of them here.