The compiler should tell you if a variable is never used unless you turn that warning off. As far as knowing if a variable has too high a scope, I've never heard of such a tool.