mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 13:26:10 +01:00
Fixed more gcc warnings
This commit is contained in:
parent
db378d8939
commit
d1ee964f5d
@ -17,9 +17,13 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
ATTRIBUTE_NORETURN
|
||||
int thisThrows();
|
||||
|
||||
int thisThrows()
|
||||
{
|
||||
throw std::domain_error( "expected exception" );
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
int thisDoesntThrow()
|
||||
@ -42,9 +46,10 @@ TEST_CASE( "./failing/exceptions/explicit", "When checked exceptions are thrown
|
||||
CHECK_NOTHROW( thisThrows() );
|
||||
}
|
||||
|
||||
TEST_CASE( "./failing/exceptions/implicit", "When unchecked exceptions are thrown they are always failures" )
|
||||
INTERNAL_CATCH_TESTCASE_NORETURN( "./failing/exceptions/implicit", "When unchecked exceptions are thrown they are always failures" )
|
||||
{
|
||||
throw std::domain_error( "unexpected exception" );
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
TEST_CASE( "./succeeding/exceptions/implicit", "When unchecked exceptions are thrown, but caught, they do not affect the test" )
|
||||
|
@ -53,6 +53,7 @@
|
||||
#define SECTION( name, description ) INTERNAL_CATCH_SECTION( name, description )
|
||||
|
||||
#define TEST_CASE( name, description ) INTERNAL_CATCH_TESTCASE( name, description )
|
||||
#define TEST_CASE_NORETURN( name, description ) INTERNAL_CATCH_TESTCASE_NORETURN( name, description )
|
||||
#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE( "", "Anonymous test case" )
|
||||
#define METHOD_AS_TEST_CASE( method, name, description ) CATCH_METHOD_AS_TEST_CASE( method, name, description )
|
||||
|
||||
|
@ -55,5 +55,10 @@ namespace Catch
|
||||
}
|
||||
|
||||
}
|
||||
#ifdef __GNUC__
|
||||
#define ATTRIBUTE_NORETURN __attribute__ ((noreturn))
|
||||
#else
|
||||
#define ATTRIBUTE_NORETURN
|
||||
#endif
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_COMMON_H_INCLUDED
|
@ -58,6 +58,6 @@ namespace Catch
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
#define INTERNAL_CATCH_SECTION( name, desc ) if( Catch::Section catch_internal_Section = Catch::Section( name, desc ) )
|
||||
#define INTERNAL_CATCH_SECTION( name, desc ) if( Catch::Section INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::Section( name, desc ) )
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_SECTION_HPP_INCLUDED
|
||||
|
@ -83,6 +83,11 @@ struct FixtureWrapper{};
|
||||
namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &INTERNAL_CATCH_UNIQUE_NAME( catch_internal_TestFunction ), Name, Desc ); }\
|
||||
static void INTERNAL_CATCH_UNIQUE_NAME( catch_internal_TestFunction )()
|
||||
|
||||
#define INTERNAL_CATCH_TESTCASE_NORETURN( Name, Desc ) \
|
||||
static void INTERNAL_CATCH_UNIQUE_NAME( catch_internal_TestFunction )() ATTRIBUTE_NORETURN; \
|
||||
namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &INTERNAL_CATCH_UNIQUE_NAME( catch_internal_TestFunction ), Name, Desc ); }\
|
||||
static void INTERNAL_CATCH_UNIQUE_NAME( catch_internal_TestFunction )()
|
||||
|
||||
#define CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, Name, Desc ) \
|
||||
namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &QualifiedMethod, Name, Desc ); }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user