Addressed some warnings (mostly MSVC)

This commit is contained in:
Phil Nash 2013-03-25 08:46:48 +00:00
parent 6ba2057abd
commit 2e3c5fa2ad
8 changed files with 26 additions and 3 deletions

View File

@ -8,6 +8,11 @@
#ifndef TWOBLUECUBES_CATCH_EVALUATE_HPP_INCLUDED #ifndef TWOBLUECUBES_CATCH_EVALUATE_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_EVALUATE_HPP_INCLUDED #define TWOBLUECUBES_CATCH_EVALUATE_HPP_INCLUDED
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4389) // '==' : signed/unsigned mismatch
#endif
namespace Catch { namespace Catch {
namespace Internal { namespace Internal {
@ -28,6 +33,7 @@ namespace Internal {
template<> struct OperatorTraits<IsLessThanOrEqualTo> { static const char* getName(){ return "<="; } }; template<> struct OperatorTraits<IsLessThanOrEqualTo> { static const char* getName(){ return "<="; } };
template<> struct OperatorTraits<IsGreaterThanOrEqualTo>{ static const char* getName(){ return ">="; } }; template<> struct OperatorTraits<IsGreaterThanOrEqualTo>{ static const char* getName(){ return ">="; } };
// So the compare overloads can be operator agnostic we convey the operator as a template // So the compare overloads can be operator agnostic we convey the operator as a template
// enum, which is used to specialise an Evaluator for doing the comparison. // enum, which is used to specialise an Evaluator for doing the comparison.
template<typename T1, typename T2, Operator Op> template<typename T1, typename T2, Operator Op>
@ -143,8 +149,12 @@ namespace Internal {
template<Operator Op, typename T> bool compare( T* lhs, int rhs ) { template<Operator Op, typename T> bool compare( T* lhs, int rhs ) {
return Evaluator<T*, T*, Op>::evaluate( lhs, reinterpret_cast<T*>( rhs ) ); return Evaluator<T*, T*, Op>::evaluate( lhs, reinterpret_cast<T*>( rhs ) );
} }
} // end of namespace Internal } // end of namespace Internal
} // end of namespace Catch } // end of namespace Catch
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // TWOBLUECUBES_CATCH_EVALUATE_HPP_INCLUDED #endif // TWOBLUECUBES_CATCH_EVALUATE_HPP_INCLUDED

View File

@ -102,6 +102,9 @@ namespace Catch {
} }
private: private:
RunningTest( RunningTest const& );
void operator=( RunningTest const& );
const TestCase& m_info; const TestCase& m_info;
RunStatus m_runStatus; RunStatus m_runStatus;
RunningSection m_rootSection; RunningSection m_rootSection;

View File

@ -30,7 +30,7 @@ namespace Catch {
WildcardAtEnd = 2, WildcardAtEnd = 2,
WildcardAtBothEnds = WildcardAtStart | WildcardAtEnd WildcardAtBothEnds = WildcardAtStart | WildcardAtEnd
}; };
public: public:
TestCaseFilter( const std::string& testSpec, IfFilterMatches::DoWhat matchBehaviour = IfFilterMatches::AutoDetectBehaviour ) TestCaseFilter( const std::string& testSpec, IfFilterMatches::DoWhat matchBehaviour = IfFilterMatches::AutoDetectBehaviour )
: m_stringToMatch( toLower( testSpec ) ), : m_stringToMatch( toLower( testSpec ) ),

View File

@ -26,6 +26,9 @@ namespace Catch {
const unsigned int minorVersion; const unsigned int minorVersion;
const unsigned int buildNumber; const unsigned int buildNumber;
const std::string branchName; const std::string branchName;
private:
void operator=( Version const& );
}; };
extern Version libraryVersion; extern Version libraryVersion;

View File

@ -97,6 +97,7 @@ namespace Catch {
private: private:
class AssertionPrinter { class AssertionPrinter {
void operator= ( AssertionPrinter const& );
public: public:
AssertionPrinter( std::ostream& _stream, AssertionStats const& _stats ) AssertionPrinter( std::ostream& _stream, AssertionStats const& _stats )
: stream( _stream ), : stream( _stream ),

View File

@ -210,6 +210,9 @@ TEST_CASE( "./succeeding/conditions/int literals",
#pragma GCC diagnostic ignored "-Wsign-compare" #pragma GCC diagnostic ignored "-Wsign-compare"
#pragma GCC diagnostic ignored "-Wsign-conversion" #pragma GCC diagnostic ignored "-Wsign-conversion"
#endif #endif
#ifdef _MSC_VER
#pragma warning(disable:4389) // '==' : signed/unsigned mismatch
#endif
TEST_CASE( "./succeeding/conditions//long_to_unsigned_x", TEST_CASE( "./succeeding/conditions//long_to_unsigned_x",
"comparisons between int variables" ) "comparisons between int variables" )

View File

@ -107,6 +107,9 @@ TEST_CASE_NORETURN( "./failing/exceptions/custom", "Unexpected custom exceptions
{ {
throw CustomException( "custom exception" ); throw CustomException( "custom exception" );
} }
#ifdef _MSC_VER
#pragma warning(disable:4702) // unreachable code
#endif
TEST_CASE( "./failing/exceptions/custom/nothrow", "Custom exceptions can be translated when testing for nothrow" ) TEST_CASE( "./failing/exceptions/custom/nothrow", "Custom exceptions can be translated when testing for nothrow" )
{ {

View File

@ -47,7 +47,7 @@ TEST_CASE( "./mixed/message/info/2", "INFO gets logged on failure" )
TEST_CASE( "./failing/message/fail", "FAIL aborts the test" ) TEST_CASE( "./failing/message/fail", "FAIL aborts the test" )
{ {
if( true ) if( Catch::isTrue( true ) )
FAIL( "This is a " << "failure" ); // This should output the message and abort FAIL( "This is a " << "failure" ); // This should output the message and abort
} }