mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +01:00
Added unique_ptr detection to compiler_capabilities
- as well as use by C++11 conformant compilers now enabled for VS2013 on too (see #479) - updated docs with this (and long long and override support)
This commit is contained in:
parent
19520157fb
commit
40d0d2f656
@ -58,6 +58,9 @@ This can be useful on certain platforms that do not provide ```std::cout``` and
|
||||
CATCH_CONFIG_CPP11_IS_ENUM // std::is_enum is supported?
|
||||
CATCH_CONFIG_CPP11_TUPLE // std::tuple is supported
|
||||
CATCH_CONFIG_VARIADIC_MACROS // Usually pre-C++11 compiler extensions are sufficient
|
||||
CATCH_CONFIG_CPP11_LONG_LONG // generates overloads for the long long type
|
||||
CATCH_CONFIG_CPP11_OVERRIDE // CATCH_OVERRIDE expands to override (for virtual function implementations)
|
||||
CATCH_CONFIG_CPP11_UNIQUE_PTR // Use std::unique_ptr instead of std::auto_ptr
|
||||
|
||||
Catch has some basic compiler detection that will attempt to select the appropriate mix of these macros. However being incomplete - and often without access to the respective compilers - this detection tends to be conservative.
|
||||
So overriding control is given to the user. If a compiler supports a feature (and Catch does not already detect it) then one or more of these may be defined to enable it (or suppress it, in some cases). If you do do this please raise an issue, specifying your compiler version (ideally with an idea of how to detect it) and stating that it has such support.
|
||||
|
7
include/external/clara.h
vendored
7
include/external/clara.h
vendored
@ -503,12 +503,7 @@ namespace Clara {
|
||||
}
|
||||
};
|
||||
|
||||
// NOTE: std::auto_ptr is deprecated in c++11/c++0x
|
||||
#if defined(__cplusplus) && __cplusplus > 199711L
|
||||
typedef std::unique_ptr<Arg> ArgAutoPtr;
|
||||
#else
|
||||
typedef std::auto_ptr<Arg> ArgAutoPtr;
|
||||
#endif
|
||||
typedef CATCH_AUTO_PTR( Arg ) ArgAutoPtr;
|
||||
|
||||
friend void addOptName( Arg& arg, std::string const& optName )
|
||||
{
|
||||
|
@ -18,11 +18,16 @@
|
||||
// CATCH_CONFIG_CPP11_TUPLE : std::tuple is supported
|
||||
// CATCH_CONFIG_CPP11_LONG_LONG : is long long supported?
|
||||
// CATCH_CONFIG_CPP11_OVERRIDE : is override supported?
|
||||
// CATCH_CONFIG_CPP11_UNIQUE_PTR : is unique_ptr supported (otherwise use auto_ptr)
|
||||
|
||||
// CATCH_CONFIG_CPP11_OR_GREATER : Is C++11 supported?
|
||||
|
||||
// CATCH_CONFIG_VARIADIC_MACROS : are variadic macros supported?
|
||||
|
||||
// ****************
|
||||
// Note to maintainers: if new toggles are added please document them
|
||||
// in configuration.md, too
|
||||
// ****************
|
||||
|
||||
// In general each macro has a _NO_<feature name> form
|
||||
// (e.g. CATCH_CONFIG_CPP11_NO_NULLPTR) which disables the feature.
|
||||
@ -84,6 +89,7 @@
|
||||
|
||||
#if (_MSC_VER >= 1600)
|
||||
# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
|
||||
# define CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR
|
||||
#endif
|
||||
|
||||
#if (_MSC_VER >= 1900 ) // (VC++ 13 (VS2015))
|
||||
@ -93,6 +99,8 @@
|
||||
|
||||
#endif // _MSC_VER
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Use variadic macros if the compiler supports them
|
||||
#if ( defined _MSC_VER && _MSC_VER > 1400 && !defined __EDGE__) || \
|
||||
( defined __WAVE__ && __WAVE_HAS_VARIADICS ) || \
|
||||
@ -107,7 +115,7 @@
|
||||
// C++ language feature support
|
||||
|
||||
// catch all support for C++11
|
||||
#if (__cplusplus >= 201103L)
|
||||
#if defined(__cplusplus) && __cplusplus >= 201103L
|
||||
|
||||
# define CATCH_CPP11_OR_GREATER
|
||||
|
||||
@ -142,6 +150,9 @@
|
||||
# if !defined(CATCH_INTERNAL_CONFIG_CPP11_OVERRIDE)
|
||||
# define CATCH_INTERNAL_CONFIG_CPP11_OVERRIDE
|
||||
# endif
|
||||
# if !defined(CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR)
|
||||
# define CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR
|
||||
# endif
|
||||
|
||||
|
||||
#endif // __cplusplus >= 201103L
|
||||
@ -165,12 +176,15 @@
|
||||
#if defined(CATCH_INTERNAL_CONFIG_VARIADIC_MACROS) && !defined(CATCH_CONFIG_NO_VARIADIC_MACROS) && !defined(CATCH_CONFIG_VARIADIC_MACROS)
|
||||
# define CATCH_CONFIG_VARIADIC_MACROS
|
||||
#endif
|
||||
#if defined(CATCH_INTERNAL_CONFIG_CPP11_LONG_LONG) && !defined(CATCH_CONFIG_NO_LONG_LONG) && !defined(CATCH_CONFIG_CPP11_LONG_LONG)
|
||||
#if defined(CATCH_INTERNAL_CONFIG_CPP11_LONG_LONG) && !defined(CATCH_CONFIG_NO_LONG_LONG) && !defined(CATCH_CONFIG_CPP11_LONG_LONG) && !defined(CATCH_CONFIG_NO_CPP11)
|
||||
# define CATCH_CONFIG_CPP11_LONG_LONG
|
||||
#endif
|
||||
#if defined(CATCH_INTERNAL_CONFIG_CPP11_OVERRIDE) && !defined(CATCH_CONFIG_NO_OVERRIDE) && !defined(CATCH_CONFIG_CPP11_OVERRIDE)
|
||||
#if defined(CATCH_INTERNAL_CONFIG_CPP11_OVERRIDE) && !defined(CATCH_CONFIG_NO_OVERRIDE) && !defined(CATCH_CONFIG_CPP11_OVERRIDE) && !defined(CATCH_CONFIG_NO_CPP11)
|
||||
# define CATCH_CONFIG_CPP11_OVERRIDE
|
||||
#endif
|
||||
#if defined(CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR) && !defined(CATCH_CONFIG_NO_UNIQUE_PTR) && !defined(CATCH_CONFIG_CPP11_UNIQUE_PTR) && !defined(CATCH_CONFIG_NO_CPP11)
|
||||
# define CATCH_CONFIG_CPP11_UNIQUE_PTR
|
||||
#endif
|
||||
|
||||
|
||||
// noexcept support:
|
||||
@ -196,5 +210,12 @@
|
||||
# define CATCH_OVERRIDE
|
||||
#endif
|
||||
|
||||
// unique_ptr support
|
||||
#ifdef CATCH_CONFIG_CPP11_UNIQUE_PTR
|
||||
# define CATCH_AUTO_PTR( T ) std::unique_ptr<T>
|
||||
#else
|
||||
# define CATCH_AUTO_PTR( T ) std::auto_ptr<T>
|
||||
#endif
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user