Commit 0122dc84 authored by Max Kellermann's avatar Max Kellermann

util/BindMethod: drop support for GCC older than 7

parent 95ad1b0c
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
#ifndef BIND_METHOD_HXX #ifndef BIND_METHOD_HXX
#define BIND_METHOD_HXX #define BIND_METHOD_HXX
#include "Compiler.h"
#include <type_traits> #include <type_traits>
#include <utility> #include <utility>
...@@ -45,21 +43,11 @@ ...@@ -45,21 +43,11 @@
template<typename S=void()> template<typename S=void()>
class BoundMethod; class BoundMethod;
#if GCC_OLDER_THAN(7,0)
static constexpr bool NoExcept = false;
#endif
template<typename R, template<typename R,
#if !GCC_OLDER_THAN(7,0)
bool NoExcept, bool NoExcept,
#endif
typename... Args> typename... Args>
class BoundMethod<R(Args...) noexcept(NoExcept)> { class BoundMethod<R(Args...) noexcept(NoExcept)> {
typedef R (*function_pointer)(void *instance, Args... args) typedef R (*function_pointer)(void *instance, Args... args) noexcept(NoExcept);
#if !GCC_OLDER_THAN(7,0)
noexcept(NoExcept)
#endif
;
void *instance_; void *instance_;
function_pointer function; function_pointer function;
...@@ -106,20 +94,10 @@ template<typename T, typename S> ...@@ -106,20 +94,10 @@ template<typename T, typename S>
struct MethodWithSignature; struct MethodWithSignature;
template<typename T, template<typename T,
#if !GCC_OLDER_THAN(7,0)
bool NoExcept, bool NoExcept,
#endif
typename R, typename... Args> typename R, typename... Args>
struct MethodWithSignature<T, R(Args...) struct MethodWithSignature<T, R(Args...) noexcept(NoExcept)> {
#if !GCC_OLDER_THAN(7,0) typedef R (T::*method_pointer)(Args...) noexcept(NoExcept);
noexcept(NoExcept)
#endif
> {
typedef R (T::*method_pointer)(Args...)
#if !GCC_OLDER_THAN(7,0)
noexcept(NoExcept)
#endif
;
}; };
/** /**
...@@ -130,11 +108,7 @@ struct MethodWithSignature<T, R(Args...) ...@@ -130,11 +108,7 @@ struct MethodWithSignature<T, R(Args...)
template<typename M> template<typename M>
struct MethodSignatureHelper; struct MethodSignatureHelper;
template<typename R, template<typename R, bool NoExcept, typename T, typename... Args>
#if !GCC_OLDER_THAN(7,0)
bool NoExcept,
#endif
typename T, typename... Args>
struct MethodSignatureHelper<R (T::*)(Args...) noexcept(NoExcept)> { struct MethodSignatureHelper<R (T::*)(Args...) noexcept(NoExcept)> {
/** /**
* The class which contains the given method (signature). * The class which contains the given method (signature).
...@@ -145,11 +119,7 @@ struct MethodSignatureHelper<R (T::*)(Args...) noexcept(NoExcept)> { ...@@ -145,11 +119,7 @@ struct MethodSignatureHelper<R (T::*)(Args...) noexcept(NoExcept)> {
* A function type which describes the "plain" function * A function type which describes the "plain" function
* signature. * signature.
*/ */
typedef R plain_signature(Args...) typedef R plain_signature(Args...) noexcept(NoExcept);
#if !GCC_OLDER_THAN(7,0)
noexcept(NoExcept)
#endif
;
}; };
/** /**
...@@ -159,17 +129,10 @@ struct MethodSignatureHelper<R (T::*)(Args...) noexcept(NoExcept)> { ...@@ -159,17 +129,10 @@ struct MethodSignatureHelper<R (T::*)(Args...) noexcept(NoExcept)> {
template<typename S> template<typename S>
struct MethodWrapperWithSignature; struct MethodWrapperWithSignature;
template<typename R, template<typename R, bool NoExcept, typename... Args>
#if !GCC_OLDER_THAN(7,0)
bool NoExcept,
#endif
typename... Args>
struct MethodWrapperWithSignature<R(Args...) noexcept(NoExcept)> { struct MethodWrapperWithSignature<R(Args...) noexcept(NoExcept)> {
typedef R (*function_pointer)(void *instance, Args...) typedef R (*function_pointer)(void *instance,
#if !GCC_OLDER_THAN(7,0) Args...) noexcept(NoExcept);
noexcept(NoExcept)
#endif
;
}; };
/** /**
...@@ -201,10 +164,7 @@ struct BindMethodWrapperGenerator2 { ...@@ -201,10 +164,7 @@ struct BindMethodWrapperGenerator2 {
template<typename T, typename M, M method, typename S> template<typename T, typename M, M method, typename S>
struct BindMethodWrapperGenerator; struct BindMethodWrapperGenerator;
template<typename T, template<typename T, bool NoExcept,
#if !GCC_OLDER_THAN(7,0)
bool NoExcept,
#endif
typename M, M method, typename R, typename... Args> typename M, M method, typename R, typename... Args>
struct BindMethodWrapperGenerator<T, M, method, R(Args...) noexcept(NoExcept)> struct BindMethodWrapperGenerator<T, M, method, R(Args...) noexcept(NoExcept)>
: BindMethodWrapperGenerator2<T, NoExcept, M, method, R, Args...> { : BindMethodWrapperGenerator2<T, NoExcept, M, method, R, Args...> {
...@@ -226,31 +186,19 @@ MakeBindMethodWrapper() noexcept ...@@ -226,31 +186,19 @@ MakeBindMethodWrapper() noexcept
template<typename S> template<typename S>
struct FunctionTraits; struct FunctionTraits;
template<typename R, template<typename R, bool NoExcept, typename... Args>
#if !GCC_OLDER_THAN(7,0)
bool NoExcept,
#endif
typename... Args>
struct FunctionTraits<R(Args...) noexcept(NoExcept)> { struct FunctionTraits<R(Args...) noexcept(NoExcept)> {
/** /**
* A function type which describes the "plain" function * A function type which describes the "plain" function
* signature. * signature.
*/ */
typedef R function_type(Args...) typedef R function_type(Args...) noexcept(NoExcept);
#if !GCC_OLDER_THAN(7,0)
noexcept(NoExcept)
#endif
;
/** /**
* A function pointer type which describes the "plain" * A function pointer type which describes the "plain"
* function signature. * function signature.
*/ */
typedef R (*pointer)(Args...) typedef R (*pointer)(Args...) noexcept(NoExcept);
#if !GCC_OLDER_THAN(7,0)
noexcept(NoExcept)
#endif
;
}; };
/** /**
...@@ -280,11 +228,7 @@ struct BindFunctionWrapperGenerator2 { ...@@ -280,11 +228,7 @@ struct BindFunctionWrapperGenerator2 {
template<typename S, typename P, P function> template<typename S, typename P, P function>
struct BindFunctionWrapperGenerator; struct BindFunctionWrapperGenerator;
template<typename P, P function, template<typename P, P function, bool NoExcept, typename R, typename... Args>
#if !GCC_OLDER_THAN(7,0)
bool NoExcept,
#endif
typename R, typename... Args>
struct BindFunctionWrapperGenerator<R(Args...) noexcept(NoExcept), P, function> struct BindFunctionWrapperGenerator<R(Args...) noexcept(NoExcept), P, function>
: BindFunctionWrapperGenerator2<NoExcept, P, function, R, Args...> { : BindFunctionWrapperGenerator2<NoExcept, P, function, R, Args...> {
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment