Fixed most pedantic warnings

This commit is contained in:
Phil Nash
2011-01-31 10:10:20 +00:00
parent 44488f6331
commit db378d8939
12 changed files with 102 additions and 86 deletions

View File

@@ -125,13 +125,13 @@ namespace Catch
if( m_args.size() >= 2 )
{
if( m_args[1] == "xml" )
listSpec = (Config::List::What)( listSpec | Config::List::AsXml );
listSpec = static_cast<Config::List::What>( listSpec | Config::List::AsXml );
else if( m_args[1] == "text" )
listSpec = (Config::List::What)( listSpec | Config::List::AsText );
listSpec = static_cast<Config::List::What>( listSpec | Config::List::AsText );
else
return setErrorMode( m_command + " expected [xml] or [text] but recieved: [" + m_args[1] + "]" );
}
m_config.setListSpec( (Config::List::What)( m_config.getListSpec() | listSpec ) );
m_config.setListSpec( static_cast<Config::List::What>( m_config.getListSpec() | listSpec ) );
}
break;
case modeTest:

View File

@@ -150,13 +150,13 @@ namespace Catch
///////////////////////////////////////////////////////////////////////////
List::What listWhat() const
{
return (List::What)( m_listSpec & List::WhatMask );
return static_cast<List::What>( m_listSpec & List::WhatMask );
}
///////////////////////////////////////////////////////////////////////////
List::What listAs() const
{
return (List::What)( m_listSpec & List::AsMask );
return static_cast<List::What>( m_listSpec & List::AsMask );
}
///////////////////////////////////////////////////////////////////////////
@@ -166,9 +166,9 @@ namespace Catch
}
///////////////////////////////////////////////////////////////////////////
void setShouldDebugBreak( bool shouldDebugBreak )
void setShouldDebugBreak( bool shouldDebugBreakFlag )
{
m_shouldDebugBreak = shouldDebugBreak;
m_shouldDebugBreak = shouldDebugBreakFlag;
}
///////////////////////////////////////////////////////////////////////////
@@ -178,9 +178,9 @@ namespace Catch
}
///////////////////////////////////////////////////////////////////////////
void setShowHelp( bool showHelp )
void setShowHelp( bool showHelpFlag )
{
m_showHelp = showHelp;
m_showHelp = showHelpFlag;
}
///////////////////////////////////////////////////////////////////////////

View File

@@ -67,7 +67,7 @@
// The following code snippet taken from:
// http://cocoawithlove.com/2008/03/break-into-debugger.html
#ifdef DEBUG
#if __ppc64__ || __ppc__
#if defined(__ppc64__) || defined(__ppc__)
#define DebugBreak() \
if( Catch::AmIBeingDebugged() ) \
{ \

View File

@@ -24,6 +24,10 @@ namespace Catch
///////////////////////////////////////////////////////////////////////////
struct IReporterConfig
{
virtual ~IReporterConfig
()
{}
virtual std::ostream& stream
() const = 0;

View File

@@ -18,6 +18,10 @@ namespace Catch
{
struct IRunner
{
virtual ~IRunner
()
{}
virtual void runAll
() = 0;

View File

@@ -42,8 +42,16 @@ namespace Catch
struct ITestCaseRegistry
{
virtual void registerTest( const TestCaseInfo& testInfo ) = 0;
virtual const std::vector<TestCaseInfo>& getAllTests() const = 0;
virtual ~ITestCaseRegistry
()
{}
virtual void registerTest
( const TestCaseInfo& testInfo
) = 0;
virtual const std::vector<TestCaseInfo>& getAllTests
() const = 0;
};
}

View File

@@ -41,7 +41,7 @@ namespace Catch
if( c != EOF )
{
if( pbase() == epptr() )
m_writer( std::string( 1, (char)c ) );
m_writer( std::string( 1, static_cast<char>( c ) ) );
else
sputc( c );
}

View File

@@ -75,7 +75,7 @@ namespace Catch
(
TestFunction fun
)
: fun( fun )
: m_fun( fun )
{}
///////////////////////////////////////////////////////////////////////////
@@ -83,7 +83,7 @@ namespace Catch
()
const
{
fun();
m_fun();
}
///////////////////////////////////////////////////////////////////////////
@@ -91,7 +91,7 @@ namespace Catch
()
const
{
return new FreeFunctionTestCase( fun );
return new FreeFunctionTestCase( m_fun );
}
///////////////////////////////////////////////////////////////////////////
@@ -102,7 +102,7 @@ namespace Catch
const
{
const FreeFunctionTestCase* ffOther = dynamic_cast<const FreeFunctionTestCase*> ( &other );
return ffOther && fun == ffOther->fun;
return ffOther && m_fun == ffOther->m_fun;
}
///////////////////////////////////////////////////////////////////////////
@@ -113,11 +113,11 @@ namespace Catch
const
{
const FreeFunctionTestCase* ffOther = dynamic_cast<const FreeFunctionTestCase*> ( &other );
return ffOther && fun < ffOther->fun;
return ffOther && m_fun < ffOther->m_fun;
}
private:
TestFunction fun;
TestFunction m_fun;
};
///////////////////////////////////////////////////////////////////////////

View File

@@ -22,34 +22,34 @@ template<typename C>
struct MethodTestCase : ITestCase
{
MethodTestCase( void (C::*method)() )
: method( method )
: m_method( method )
{}
virtual void invoke() const
{
C obj;
(obj.*method)();
(obj.*m_method)();
}
virtual ITestCase* clone() const
{
return new MethodTestCase<C>( method );
return new MethodTestCase<C>( m_method );
}
virtual bool operator == ( const ITestCase& other ) const
{
const MethodTestCase* mtOther = dynamic_cast<const MethodTestCase*>( &other );
return mtOther && method == mtOther->method;
return mtOther && m_method == mtOther->m_method;
}
virtual bool operator < ( const ITestCase& other ) const
{
const MethodTestCase* mtOther = dynamic_cast<const MethodTestCase*>( &other );
return mtOther && &method < &mtOther->method;
return mtOther && &m_method < &mtOther->m_method;
}
private:
void (C::*method)();
void (C::*m_method)();
};
typedef void(*TestFunction)();