Folks, I really like the -Wshadow option since it helps to spot some possible problematic pieces of code. I want to use it in a really large project but I can't since it's too strict. For example it throws a warning for the following case:
struct Foo
{
Foo(int info) : info_(info) {} //shadow warning is here
void info(){ ... }
int info_;
};
gcc
throws a warning about "int info" variable shadowing "void info" method in constructor which is... well, not really a useful warning for me.
What I really care about is cases such as the following:
int i = 0;
for(int j=0;j<10;++j)
{
int i = j; //local scope variable "int i" shadows outer scope variable
++i;
}
Is it possible to make gcc
warn about these cases only?