[cfe-dev] Why is -Wshadow not in -Wextra?
seth.cantrell at gmail.com
Tue Nov 6 16:36:39 PST 2012
There's probably a fair amount of code that does use shadowing and so -Wshadow might be too noisy to be part of -Wall -Wextra.
Instead of just using -Wall -Wextra and an additive strategy for warnings you can use -Weverything and a subtractive strategy (-Wno-...) where you make an informed choice on each specific warning that you do not want to apply to your codebase. -Wall and -Wextra are necessarily the result of a compromise that might not be best for your specific project, and it is somewhat annoying to search for all the warnings you might want to use, especially as you may not remember to reevaluate when the available warnings are updated. With a subtractive strategy it's hard to avoid discovering new warnings.
On Nov 6, 2012, at 4:57 PM, Christopher Jefferson <chris at bubblescope.net> wrote:
> Sorry if this is a stupid, or FAQ, but I couldn't find it written down anywhere.
> After spending some time tracking down an annoying bug where I was
> redeclaring a local variable inside a scope, I was suprised to realise
> that -Wshadow is not included in -Wextra (or possibly even -Wall). It
> seems like a sensible error message, personally I try to avoid all
> Is there some reasoning behind what goes into -Wextra? I certainly
> have never gone looking for flags which aren't in -Wextra, and expect
> it to cover everything "sensible". I suppose people may differ on
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
More information about the cfe-dev