Disabling compiler warnings in tests (was Filesystem bug report)

Folks, There is now a new Boost.Config header: <boost/config/warning_disable.hpp> That selectively disables some compiler warnings that are hard or impossible to get rid of otherwise. Docs are here: http://svn.boost.org/svn/boost/trunk/libs/config/doc/html/boost_config/guide... This also fixes the problems that Boost.Filesystem had trying to disable these, the following patch removes the #defines, and uses the new header to silence the warnings, I've tested this with VC++ 7.1, 8 and 9 and Intel 10.1. Beman: let me know if you want me to commit. Enjoy! John. Index: test/fstream_test.cpp =================================================================== --- test/fstream_test.cpp (revision 44538) +++ test/fstream_test.cpp (working copy) @@ -11,8 +11,7 @@ // See http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx // But at least in VC++ 8.0 betas, their own libraries use the problem // practices. So turn off the warnings. -#define _CRT_SECURE_NO_DEPRECATE -#define _SCL_SECURE_NO_DEPRECATE +#include <boost/config/warning_disable.hpp> #include <boost/filesystem/fstream.hpp> #include <boost/filesystem/operations.hpp> Index: test/operations_test.cpp =================================================================== --- test/operations_test.cpp (revision 44538) +++ test/operations_test.cpp (working copy) @@ -11,9 +11,7 @@ // See http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx // But at least in VC++ 8.0 betas, their own libraries use the problem // practices. So turn off the warnings. -#define _CRT_SECURE_NO_DEPRECATE -#define _SCL_SECURE_NO_DEPRECATE - +#include <boost/config/warning_disable.hpp> #include <boost/filesystem/operations.hpp> #include <boost/filesystem/convenience.hpp> #include <boost/cerrno.hpp> Index: test/wide_test.cpp =================================================================== --- test/wide_test.cpp (revision 44538) +++ test/wide_test.cpp (working copy) @@ -12,8 +12,7 @@ // See http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx // But at least in VC++ 8.0 betas, their own libraries use the problem // practices. So turn off the warnings. -#define _CRT_SECURE_NO_DEPRECATE -#define _SCL_SECURE_NO_DEPRECATE +#include <boost/config/warning_disable.hpp> #include <boost/filesystem/config.hpp> # ifdef BOOST_FILESYSTEM_NARROW_ONLY Index: test/convenience_test.cpp =================================================================== --- test/convenience_test.cpp (revision 44538) +++ test/convenience_test.cpp (working copy) @@ -12,8 +12,6 @@ // See http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx // But at least in VC++ 8.0 betas, their own libraries use the problem // practices. So turn off the warnings. -#define _CRT_SECURE_NO_DEPRECATE -#define _SCL_SECURE_NO_DEPRECATE #include <boost/filesystem/convenience.hpp> namespace fs = boost::filesystem;

John Maddock wrote:
Folks,
There is now a new Boost.Config header:
<boost/config/warning_disable.hpp>
That selectively disables some compiler warnings that are hard or impossible to get rid of otherwise.
Docs are here: http://svn.boost.org/svn/boost/trunk/libs/config/doc/html/boost_config/guide...
Misspelling problem in the above: "Disable Compiler Warings" instead of "Disable Compiler Warnings".

On Sun, Apr 20, 2008 at 9:00 AM, John Maddock <john@johnmaddock.co.uk> wrote:
Folks,
There is now a new Boost.Config header:
<boost/config/warning_disable.hpp>
That selectively disables some compiler warnings that are hard or impossible to get rid of otherwise.
Docs are here: http://svn.boost.org/svn/boost/trunk/libs/config/doc/html/boost_config/guide...
This also fixes the problems that Boost.Filesystem had trying to disable these, the following patch removes the #defines, and uses the new header to silence the warnings, I've tested this with VC++ 7.1, 8 and 9 and Intel 10.1.
Beman: let me know if you want me to commit.
Yes, please do. --Beman
participants (3)
-
Beman Dawes
-
Edward Diener
-
John Maddock