Skip to content
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

minmax: don't nest min/max in clamp to avoid -Wshadow warnings #98

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kuba-moo
Copy link

@kuba-moo kuba-moo commented Dec 9, 2021

Using clamp from minmax.h with -Wshadow (GCC 11 and 8, haven't tested others)
generates a bunch of warnings because min and max both declare _a, _b vars.
Store the result of min to a temporary variable instead of nesting the calls
this way min's variables are not in scope of max.

Signed-off-by: Jakub Kicinski [email protected]

Using clamp from minmax.h with -Wshadow (GCC 11 and 8, haven't tested others)
generates a bunch of warnings because min and max both declare _a, _b vars.
Store the result of min to a temporary variable instead of nesting the calls
this way min's variables are not in scope of max.

Signed-off-by: Jakub Kicinski <[email protected]>
Copy link

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

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

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.

2 participants