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

*: expose and fix variable shadowing warnings #17915

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

mjstapp
Copy link
Contributor

@mjstapp mjstapp commented Jan 23, 2025

Add the -Wshadow warning option for builds; this exposes variable-shadowing issues. I've cleaned up several components, but some of the choices might be controversial (or ... awkward, or ... wrong), so I'm opening this as a draft to get some feedback before continuing with more components.

Mark Stapp added 5 commits January 23, 2025 15:44
Start exposing variable-shadowing warnings in all builds.

Signed-off-by: Mark Stapp <[email protected]>
Fix various "shadow" warnings in lib.

Signed-off-by: Mark Stapp <[email protected]>
Clean up various "shadow" warnings.

Signed-off-by: Mark Stapp <[email protected]>
Clean up various "shadow" warnings.

Signed-off-by: Mark Stapp <[email protected]>
Clean up various "shadow" warnings.
}

cpu_records_fini(old);
frr_mutex_lock_autounlock(&masters_mtx);
Copy link
Member

Choose a reason for hiding this comment

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

I don't see any changes in this chunk? What am I missing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, this is one of the patterns that was a little awkward. note that the original had a with_mutex block, and then an inner with_mutex block. with_mutex is a macro, and it uses ... a local variable - so the inner block's variable shadows the outer block's. so the conversion replace the outer block, and that resolves the warning.

Mark Stapp added 5 commits January 24, 2025 14:44
Clean up various "shadow" warnings in babeld.

Signed-off-by: Mark Stapp <[email protected]>
Clean up various variable-shadow warnings in bfdd.

Signed-off-by: Mark Stapp <[email protected]>
Clean up various warnings from -Wshadow in eigrp.

Signed-off-by: Mark Stapp <[email protected]>
Clean up various variable-shadow warnings in ldpd.

Signed-off-by: Mark Stapp <[email protected]>
Clean up various variable-shadow warnings in mgmtd.

Signed-off-by: Mark Stapp <[email protected]>
@frrbot frrbot bot added babel bfd eigrp ldp mgmt FRR Management Infra labels Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants