Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r57510 - in trunk/libs/conversion: . test
From: john_at_[hidden]
Date: 2009-11-09 07:27:56


Author: johnmaddock
Date: 2009-11-09 07:27:54 EST (Mon, 09 Nov 2009)
New Revision: 57510
URL: http://svn.boost.org/trac/boost/changeset/57510

Log:
Misc small fixes to suppress warnings.
Code should now be clean with msvc /W4 and gcc /Wall /Wextra -pedantic with the exception of one deliberate warning in one test.
Text files modified:
   trunk/libs/conversion/lexical_cast_test.cpp | 7 +++++++
   trunk/libs/conversion/numeric_cast_test.cpp | 2 +-
   trunk/libs/conversion/test/implicit_cast.cpp | 6 ++++++
   trunk/libs/conversion/test/implicit_cast_fail.cpp | 2 ++
   trunk/libs/conversion/test/lexical_cast_abstract_test.cpp | 2 +-
   5 files changed, 17 insertions(+), 2 deletions(-)

Modified: trunk/libs/conversion/lexical_cast_test.cpp
==============================================================================
--- trunk/libs/conversion/lexical_cast_test.cpp (original)
+++ trunk/libs/conversion/lexical_cast_test.cpp 2009-11-09 07:27:54 EST (Mon, 09 Nov 2009)
@@ -11,6 +11,13 @@
 //
 // Note: The unit test no longer compile on MSVC 6, but lexical_cast itself works for it.
 
+//
+// We need this #define before any #includes: otherwise msvc will emit warnings
+// deep within std::string, resulting from our (perfectly legal) use of basic_string
+// with a custom traits class:
+//
+#define _SCL_SECURE_NO_WARNINGS
+
 #include <boost/config.hpp>
 
 #if defined(__INTEL_COMPILER)

Modified: trunk/libs/conversion/numeric_cast_test.cpp
==============================================================================
--- trunk/libs/conversion/numeric_cast_test.cpp (original)
+++ trunk/libs/conversion/numeric_cast_test.cpp 2009-11-09 07:27:54 EST (Mon, 09 Nov 2009)
@@ -28,7 +28,7 @@
 using std::cout;
 
 
-int test_main( int argc, char * argv[] )
+int test_main( int , char * [] )
 {
 
 # ifdef NDEBUG

Modified: trunk/libs/conversion/test/implicit_cast.cpp
==============================================================================
--- trunk/libs/conversion/test/implicit_cast.cpp (original)
+++ trunk/libs/conversion/test/implicit_cast.cpp 2009-11-09 07:27:54 EST (Mon, 09 Nov 2009)
@@ -28,5 +28,11 @@
 
     type<foo> f = check_return(boost::implicit_cast<foo>("hello"));
     type<long> z = check_return(boost::implicit_cast<long>(foo("hello")));
+
+ // warning supression:
+ (void)x;
+ (void)f;
+ (void)z;
+
     return boost::report_errors();
 }

Modified: trunk/libs/conversion/test/implicit_cast_fail.cpp
==============================================================================
--- trunk/libs/conversion/test/implicit_cast_fail.cpp (original)
+++ trunk/libs/conversion/test/implicit_cast_fail.cpp 2009-11-09 07:27:54 EST (Mon, 09 Nov 2009)
@@ -19,4 +19,6 @@
 int test_main(int, char*[])
 {
     foo x = implicit_cast<foo>("foobar");
+ (void)x; // warning suppression.
+ return 0;
 }

Modified: trunk/libs/conversion/test/lexical_cast_abstract_test.cpp
==============================================================================
--- trunk/libs/conversion/test/lexical_cast_abstract_test.cpp (original)
+++ trunk/libs/conversion/test/lexical_cast_abstract_test.cpp 2009-11-09 07:27:54 EST (Mon, 09 Nov 2009)
@@ -51,7 +51,7 @@
 {
     a.out(O);
     return O;
-};
+}
 
 void test_abstract()
 {


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk