Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2008-04-20 09:00:52


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/guidelines_for_boost_authors.html#boost_config.guidelines_for_boost_authors.warnings

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;


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk