Changed the way noexcept support is handled to (hopefully) fix #275 and #273

This commit is contained in:
Phil Nash 2014-04-23 18:19:19 +01:00
parent f1928b7f24
commit 1a6f2a0a80
8 changed files with 46 additions and 18 deletions

View File

@ -12,11 +12,13 @@
#ifdef __clang__ #ifdef __clang__
#if __has_feature(cxx_nullptr) # if __has_feature(cxx_nullptr)
# define CATCH_CONFIG_CPP11_NULLPTR
# endif
#define CATCH_CONFIG_CPP11_NULLPTR # if __has_feature(cxx_noexcept)
# define CATCH_CONFIG_CPP11_NOEXCEPT
#endif # endif
#endif // __clang__ #endif // __clang__
@ -108,13 +110,10 @@
#endif #endif
// noexcept support: // noexcept support:
#ifdef CATCH_CPP11_OR_GREATER #if defined(CATCH_CONFIG_CPP11_NOEXCEPT) && !defined(CATCH_NOEXCEPT)
# if (__has_feature(cxx_noexcept))
# define CATCH_NOEXCEPT noexcept # define CATCH_NOEXCEPT noexcept
# define CATCH_NOEXCEPT_IS(x) noexcept(x) # define CATCH_NOEXCEPT_IS(x) noexcept(x)
# endif #else
#endif
#ifndef CATCH_NO_EXCEPT
# define CATCH_NOEXCEPT throw() # define CATCH_NOEXCEPT throw()
# define CATCH_NOEXCEPT_IS(x) # define CATCH_NOEXCEPT_IS(x)
#endif #endif

View File

@ -13,6 +13,8 @@
#pragma warning(disable:4389) // '==' : signed/unsigned mismatch #pragma warning(disable:4389) // '==' : signed/unsigned mismatch
#endif #endif
#include <cstddef>
namespace Catch { namespace Catch {
namespace Internal { namespace Internal {

View File

@ -15,6 +15,7 @@
#include <iomanip> #include <iomanip>
#include <limits> #include <limits>
#include <vector> #include <vector>
#include <cstddef>
#ifdef __OBJC__ #ifdef __OBJC__
#include "catch_objc_arc.hpp" #include "catch_objc_arc.hpp"

View File

@ -772,5 +772,5 @@ with expansion:
"first" == "second" "first" == "second"
=============================================================================== ===============================================================================
126 test cases - 39 failed (628 assertions - 92 failed) 127 test cases - 39 failed (629 assertions - 92 failed)

View File

@ -6285,6 +6285,18 @@ PASSED:
with expansion: with expansion:
__null == 0 __null == 0
-------------------------------------------------------------------------------
null_ptr
-------------------------------------------------------------------------------
TrickyTests.cpp:<line number>
...............................................................................
TrickyTests.cpp:<line number>:
PASSED:
REQUIRE( ptr.get() == nullptr )
with expansion:
__null == nullptr
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
X/level/0/a X/level/0/a
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@ -6668,5 +6680,5 @@ with expansion:
true true
=============================================================================== ===============================================================================
126 test cases - 54 failed (647 assertions - 111 failed) 127 test cases - 54 failed (648 assertions - 111 failed)

View File

@ -1,5 +1,5 @@
<testsuites> <testsuites>
<testsuite name="~_" errors="12" failures="99" tests="647" hostname="tbd" time="{duration}" timestamp="tbd"> <testsuite name="~_" errors="12" failures="99" tests="648" hostname="tbd" time="{duration}" timestamp="tbd">
<testcase classname="global" name="Some simple comparisons between doubles" time="{duration}"/> <testcase classname="global" name="Some simple comparisons between doubles" time="{duration}"/>
<testcase classname="global" name="Approximate comparisons with different epsilons" time="{duration}"/> <testcase classname="global" name="Approximate comparisons with different epsilons" time="{duration}"/>
<testcase classname="global" name="Approximate comparisons with floats" time="{duration}"/> <testcase classname="global" name="Approximate comparisons with floats" time="{duration}"/>
@ -531,6 +531,7 @@ TrickyTests.cpp:<line number>
<testcase classname="global" name="Comparing function pointers" time="{duration}"/> <testcase classname="global" name="Comparing function pointers" time="{duration}"/>
<testcase classname="global" name="Comparing member function pointers" time="{duration}"/> <testcase classname="global" name="Comparing member function pointers" time="{duration}"/>
<testcase classname="global" name="pointer to class" time="{duration}"/> <testcase classname="global" name="pointer to class" time="{duration}"/>
<testcase classname="global" name="null_ptr" time="{duration}"/>
<testcase classname="global" name="X/level/0/a" time="{duration}"/> <testcase classname="global" name="X/level/0/a" time="{duration}"/>
<testcase classname="global" name="X/level/0/b" time="{duration}"/> <testcase classname="global" name="X/level/0/b" time="{duration}"/>
<testcase classname="global" name="X/level/1/a" time="{duration}"/> <testcase classname="global" name="X/level/1/a" time="{duration}"/>

View File

@ -6548,6 +6548,17 @@ there&quot;
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="null_ptr">
<Expression success="true" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/TrickyTests.cpp" >
<Original>
ptr.get() == nullptr
</Original>
<Expanded>
__null == nullptr
</Expanded>
</Expression>
<OverallResult success="true"/>
</TestCase>
<TestCase name="X/level/0/a"> <TestCase name="X/level/0/a">
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
@ -6881,7 +6892,7 @@ there&quot;
</Section> </Section>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<OverallResults successes="536" failures="111"/> <OverallResults successes="537" failures="111"/>
</Group> </Group>
<OverallResults successes="536" failures="111"/> <OverallResults successes="537" failures="111"/>
</Catch> </Catch>

View File

@ -634,7 +634,8 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES; CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++98"; CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_WARN__DUPLICATE_METHOD_MATCH = NO; CLANG_WARN__DUPLICATE_METHOD_MATCH = NO;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
@ -649,7 +650,8 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES; CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++98"; CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_WARN__DUPLICATE_METHOD_MATCH = NO; CLANG_WARN__DUPLICATE_METHOD_MATCH = NO;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";