|
Boost Users : |
From: Grant Erickson (gerickson_at_[hidden])
Date: 2008-07-30 20:11:37
In working through cross-compilation issues with boost, particularly the
filesystem library, I discovered the following error reproduced with the
following test case with both boost 1.34.1 and 1.35.0:
FAILS:
echo "#include <boost/filesystem.hpp>\nint main (void) { return (0);
}" | g++ -o test -I/${BuildRoot}/results/boost/include -Werror -Wall
-Wshadow -x c++ -
PASSES:
echo "#include <boost/filesystem.hpp>\nint main (void) { return (0);
}" | g++ -o test -I/usr/include -Werror -Wall -Wshadow -x c++ -
The failing case complains about 'what', 'path1' and 'path2' argument
shadowing in boost/filesystem/path.hpp with respect to like-named member
functions.
Since GCC does not enforce warning options on headers in /usr/include, this
only shows up when building against a boost installation outside
/usr/include, as in the above failure example.
The patch to address this is:
Signed-off-by: Grant Erickson <gerickson_at_[hidden]>
--- --- boost_1_35_0/boost/filesystem/path.hpp 2008-07-30 16:54:53.000000000 -0700 +++ boost_1_35_0/boost/filesystem/path.hpp.N 2008-07-30 16:59:42.000000000 -0700 @@ -577,23 +577,23 @@ // BOOST_FILESYSTEM_DECL version works for VC++ but not GCC. Go figure! inline const char * what( const char * sys_err_what, - const path & path1, const path & path2, std::string & target ) + const path & path1_arg, const path & path2_arg, std::string & target ) { try { if ( target.empty() ) { target = sys_err_what; - if ( !path1.empty() ) + if ( !path1_arg.empty() ) { target += ": \""; - target += path1.file_string(); + target += path1_arg.file_string(); target += "\""; } - if ( !path2.empty() ) + if ( !path2_arg.empty() ) { target += ", \""; - target += path2.file_string(); + target += path2_arg.file_string(); target += "\""; } } @@ -607,7 +607,7 @@ template<class Path> const char * what( const char * sys_err_what, - const Path & /*path1*/, const Path & /*path2*/, std::string & /*target*/ ) + const Path & /*path1_arg*/, const Path & /*path2_arg*/, std::string & /*target*/ ) { return sys_err_what; } @@ -624,14 +624,14 @@ typedef Path path_type; - basic_filesystem_error( const std::string & what, + basic_filesystem_error( const std::string & what_arg, system::error_code ec ); - basic_filesystem_error( const std::string & what, - const path_type & path1, system::error_code ec ); + basic_filesystem_error( const std::string & what_arg, + const path_type & path1_arg, system::error_code ec ); - basic_filesystem_error( const std::string & what, const path_type & path1, - const path_type & path2, system::error_code ec ); + basic_filesystem_error( const std::string & what_arg, const path_type & path1_arg, + const path_type & path2_arg, system::error_code ec ); ~basic_filesystem_error() throw() {} @@ -1385,8 +1385,8 @@ template<class Path> basic_filesystem_error<Path>::basic_filesystem_error( - const std::string & what, system::error_code ec ) - : system::system_error(ec, what) + const std::string & what_arg, system::error_code ec ) + : system::system_error(ec, what_arg) { try { @@ -1397,29 +1397,29 @@ template<class Path> basic_filesystem_error<Path>::basic_filesystem_error( - const std::string & what, const path_type & path1, + const std::string & what_arg, const path_type & path1_arg, system::error_code ec ) - : system::system_error(ec, what) + : system::system_error(ec, what_arg) { try { m_imp_ptr.reset( new m_imp ); - m_imp_ptr->m_path1 = path1; + m_imp_ptr->m_path1 = path1_arg; } catch (...) { m_imp_ptr.reset(); } } template<class Path> basic_filesystem_error<Path>::basic_filesystem_error( - const std::string & what, const path_type & path1, - const path_type & path2, system::error_code ec ) - : system::system_error(ec, what) + const std::string & what_arg, const path_type & path1_arg, + const path_type & path2_arg, system::error_code ec ) + : system::system_error(ec, what_arg) { try { m_imp_ptr.reset( new m_imp ); - m_imp_ptr->m_path1 = path1; - m_imp_ptr->m_path2 = path2; + m_imp_ptr->m_path1 = path1_arg; + m_imp_ptr->m_path2 = path2_arg; } catch (...) { m_imp_ptr.reset(); } } ---
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net