Fixed more warnings and applied workaround for getting to std::numeric_limits without clashing with Windows' min() and max() macros.

This commit is contained in:
Phil Nash 2011-02-16 19:02:09 +00:00
parent dea778138e
commit 73acd945cd
18 changed files with 55 additions and 22 deletions

View File

@ -35,8 +35,8 @@ namespace
} }
METHOD_AS_TEST_CASE( TestClass::succeedingCase, "./succeeding/TestClass/succeedingCase", "A method based test run that succeeds" ); METHOD_AS_TEST_CASE( TestClass::succeedingCase, "./succeeding/TestClass/succeedingCase", "A method based test run that succeeds" )
METHOD_AS_TEST_CASE( TestClass::failingCase, "./failing/TestClass/failingCase", "A method based test run that fails" ); METHOD_AS_TEST_CASE( TestClass::failingCase, "./failing/TestClass/failingCase", "A method based test run that fails" )
struct Fixture struct Fixture

View File

@ -12,7 +12,7 @@
#include "../catch.hpp" #include "../catch.hpp"
size_t multiply( int a, int b ) size_t multiply( size_t a, size_t b )
{ {
return a*b; return a*b;
} }

View File

@ -321,7 +321,35 @@
GCC_C_LANGUAGE_STANDARD = gnu99; GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_OPTIMIZATION_LEVEL = 0; GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = DEBUG; GCC_PREPROCESSOR_DEFINITIONS = DEBUG;
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
GCC_TREAT_NONCONFORMANT_CODE_ERRORS_AS_WARNINGS = YES;
GCC_TREAT_WARNINGS_AS_ERRORS = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_GLOBAL_CONSTRUCTORS = NO;
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_CHECK_SWITCH_STATEMENTS = YES;
GCC_WARN_EFFECTIVE_CPLUSPLUS_VIOLATIONS = NO;
GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES;
GCC_WARN_INHIBIT_ALL_WARNINGS = NO;
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
GCC_WARN_MISSING_PARENTHESES = YES;
GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES;
GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
GCC_WARN_PEDANTIC = YES;
GCC_WARN_PROTOTYPE_CONVERSION = YES;
GCC_WARN_SHADOW = YES;
GCC_WARN_SIGN_COMPARE = YES;
GCC_WARN_STRICT_SELECTOR_MATCH = YES;
GCC_WARN_UNINITIALIZED_AUTOS = NO;
GCC_WARN_UNKNOWN_PRAGMAS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_LABEL = YES;
GCC_WARN_UNUSED_PARAMETER = YES;
GCC_WARN_UNUSED_VALUE = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO; PREBINDING = NO;

View File

@ -26,6 +26,7 @@ TEST_CASE( "selftest/main", "Runs all Catch self tests and checks their results"
CHECK( runner.getFailureCount() == 0 ); CHECK( runner.getFailureCount() == 0 );
runner.runMatching( "./failing/*" ); runner.runMatching( "./failing/*" );
INFO( runner.getOutput() );
CHECK( runner.getSuccessCount() == 0 ); CHECK( runner.getSuccessCount() == 0 );
CHECK( runner.getFailureCount() == 53 ); CHECK( runner.getFailureCount() == 53 );
} }

View File

@ -282,7 +282,7 @@ namespace Catch
SpanInfo m_testSpan; SpanInfo m_testSpan;
}; };
INTERNAL_CATCH_REGISTER_REPORTER( "basic", BasicReporter ); INTERNAL_CATCH_REGISTER_REPORTER( "basic", BasicReporter )
} // end namespace Catch } // end namespace Catch

View File

@ -256,7 +256,7 @@ namespace Catch
std::ostringstream m_stdErr; std::ostringstream m_stdErr;
}; };
INTERNAL_CATCH_REGISTER_REPORTER( "junit", JunitReporter ); INTERNAL_CATCH_REGISTER_REPORTER( "junit", JunitReporter )
} // end namespace Catch } // end namespace Catch

View File

@ -168,7 +168,7 @@ namespace Catch
XmlWriter m_xml; XmlWriter m_xml;
}; };
INTERNAL_CATCH_REGISTER_REPORTER( "xml", XmlReporter ); INTERNAL_CATCH_REGISTER_REPORTER( "xml", XmlReporter )
} // end namespace Catch } // end namespace Catch

View File

@ -34,7 +34,7 @@ namespace Catch
if( !config.getMessage().empty() ) if( !config.getMessage().empty() )
{ {
std::cerr << config.getMessage() << std::endl; std::cerr << config.getMessage() << std::endl;
return std::numeric_limits<int>::max(); return (std::numeric_limits<int>::max)();
} }
// Handle help // Handle help
@ -70,7 +70,7 @@ namespace Catch
if( ofs.fail() ) if( ofs.fail() )
{ {
std::cerr << "Unable to open file: '" << config.getFilename() << "'" << std::endl; std::cerr << "Unable to open file: '" << config.getFilename() << "'" << std::endl;
return std::numeric_limits<int>::max(); return (std::numeric_limits<int>::max)();
} }
config.setStreamBuf( ofs.rdbuf() ); config.setStreamBuf( ofs.rdbuf() );
} }
@ -103,7 +103,7 @@ namespace Catch
config.getReporter()->EndGroup( *it, runner.getSuccessCount()-prevSuccess, runner.getFailureCount()-prevFail ); config.getReporter()->EndGroup( *it, runner.getSuccessCount()-prevSuccess, runner.getFailureCount()-prevFail );
} }
} }
return runner.getFailureCount(); return static_cast<int>( runner.getFailureCount() );
} }
} // end namespace Catch } // end namespace Catch

View File

@ -62,3 +62,4 @@ namespace Catch
#endif #endif
#endif // TWOBLUECUBES_CATCH_COMMON_H_INCLUDED #endif // TWOBLUECUBES_CATCH_COMMON_H_INCLUDED

View File

@ -36,6 +36,9 @@ namespace Catch
static Hub& me(); static Hub& me();
Hub( const Hub& );
void operator=( const Hub& );
public: public:
static void setRunner static void setRunner

View File

@ -51,7 +51,7 @@ namespace Catch
if( ( config.listWhat() & Config::List::All ) == 0 ) if( ( config.listWhat() & Config::List::All ) == 0 )
{ {
std::cerr << "Unknown list type" << std::endl; std::cerr << "Unknown list type" << std::endl;
return std::numeric_limits<int>::max(); return (std::numeric_limits<int>::max)();
} }
if( config.getReporter() ) if( config.getReporter() )

View File

@ -53,7 +53,7 @@ namespace Catch
if( pbase() == epptr() ) if( pbase() == epptr() )
m_writer( std::string( 1, static_cast<char>( c ) ) ); m_writer( std::string( 1, static_cast<char>( c ) ) );
else else
sputc( c ); sputc( static_cast<char>( c ) );
} }
return 0; return 0;
} }