id summary reporter owner description type status milestone component version severity resolution keywords cc 6365 Compiler warnings when running static code analysis after build on MSVC 10 seppe.de.clercq@… Emil Dotchevski "As the title says I'm getting several compiler warnings when running static code analysis in Visual Studio 10 (attached the list to the ticket). The reported warnings are harmless (are only triggered by the static analyzer and not when compiling with warning level 4), but could you fix them if you have the time? I'm getting two type of warnings. == Warning type 1 == warning C6246: Local declaration of 'l' hides declaration of the same name in outer scope. For additional information, see previous declaration at line '131' of 'c:\users\seppe\boost_1_48_0\boost\exception\diagnostic_information.hpp': Lines: 131 c:\users\seppe\boost_1_48_0\boost\exception\diagnostic_information.hpp 140 warning C6246: Local declaration of 'fn' hides declaration of the same name in outer scope. For additional information, see previous declaration at line '132' of 'c:\users\seppe\boost_1_48_0\boost\exception\diagnostic_information.hpp': Lines: 132 c:\users\seppe\boost_1_48_0\boost\exception\diagnostic_information.hpp 144 and the affected code: {{{ 130: char const * const * f=get_error_info(*be); 131: int const * l=get_error_info(*be); 132: char const * const * fn=get_error_info(*be); 133: if( !f && !l && !fn ) 134: tmp << ""Throw location unknown (consider using BOOST_THROW_EXCEPTION)\n""; 135: else 136: { 137: if( f ) 138: { 139: tmp << *f; 140: if( int const * l=get_error_info(*be) ) 141: tmp << '(' << *l << ""): ""; 142: } 143: tmp << ""Throw in function ""; 144: if( char const * const * fn=get_error_info(*be) ) 145: tmp << *fn; 146: else 147: tmp << ""(unknown)""; 148: tmp << '\n'; 149: } }}} Both warnings can be fixed by: - line 140: replacing if( int const * l=get_error_info(*be) ) with if( l ) - line 144: replacing if( char const * const * fn=get_error_info(*be) ) with if( fn ) == Warning type 2 == Only displaying the first warning. warning C6246: Local declaration of 'e' hides declaration of the same name in outer scope. For additional information, see previous declaration at line '300' of 'c:\users\seppe\boost_1_48_0\boost\exception\detail\exception_ptr.hpp': Lines: 300 c:\users\seppe\boost_1_48_0\boost\exception\detail\exception_ptr.hpp 332 and the affected code: {{{ 296: inline 297: exception_ptr 298: current_exception_impl() 299: { 300: exception_detail::clone_base const * e=0; <> 328: try 329: { 330: throw; 331: } 332: catch( 333: exception_detail::clone_base & e ) 334: { 335: return exception_ptr(shared_ptr(e.clone())); 336: } ... }}} Well this is more of a false positive of the static analyzer, but can be avoided by changing the variable name of the caught exception. '''Remark''': A warning is generated for each caught exception in the method (see attached list). " Bugs new To Be Determined exception Boost 1.48.0 Cosmetic