Expand DXX_CXX11_EXPLICIT_DELETE

Various functions use the non-macro form, so support for =delete is
already mandatory.  Remove the remnants of support for compilers which
lack =delete and replace it with a hard stop when the compiler rejects
declaring explicitly deleted functions.
This commit is contained in:
Kp 2015-05-01 02:18:33 +00:00
parent 9f01dcf0db
commit 9dc22b1ee6
7 changed files with 20 additions and 29 deletions

View file

@ -818,12 +818,8 @@ help:assume compiler supports explicitly deleted functions
int a()=delete;
'''
r = self.Cxx11Compile(context, text=f, msg='for explicitly deleted functions')
macro_name = 'DXX_CXX11_EXPLICIT_DELETE'
if r:
context.sconf.Define(macro_name, '=delete')
context.sconf.Define('DXX_HAVE_CXX11_EXPLICIT_DELETE')
else:
context.sconf.Define(macro_name, self.comment_not_supported)
if not r:
raise SCons.Errors.StopError("C++ compiler does not support explicitly deleted functions.")
@_implicit_test
def check_cxx11_free_begin(self,context,**kwargs):
return self.Cxx11Compile(context, msg='for C++11 functions begin(), end()', successflags={'CPPDEFINES' : ['DXX_HAVE_CXX11_BEGIN']}, **kwargs)

View file

@ -8,16 +8,16 @@ class exact_type
{
T *p;
public:
operator bool() DXX_CXX11_EXPLICIT_DELETE;
operator bool() = delete;
// Conversion to void* variants is prohibited
operator void *() const DXX_CXX11_EXPLICIT_DELETE;
operator volatile void *() const DXX_CXX11_EXPLICIT_DELETE;
operator const void *() const DXX_CXX11_EXPLICIT_DELETE;
operator const volatile void *() const DXX_CXX11_EXPLICIT_DELETE;
bool operator<(exact_type<T>) const DXX_CXX11_EXPLICIT_DELETE;
bool operator<=(exact_type<T>) const DXX_CXX11_EXPLICIT_DELETE;
bool operator>(exact_type<T>) const DXX_CXX11_EXPLICIT_DELETE;
bool operator>=(exact_type<T>) const DXX_CXX11_EXPLICIT_DELETE;
operator void *() const = delete;
operator volatile void *() const = delete;
operator const void *() const = delete;
operator const volatile void *() const = delete;
bool operator<(exact_type<T>) const = delete;
bool operator<=(exact_type<T>) const = delete;
bool operator>(exact_type<T>) const = delete;
bool operator>=(exact_type<T>) const = delete;
exact_type(T *t) : p(t) {}
// Conversion to the exact type is permitted
operator T *() const { return p; }

View file

@ -158,14 +158,14 @@ static inline PHYSFS_sint64 PHYSFSX_check_write(PHYSFS_file *file, const std::un
}
template <typename V>
PHYSFS_sint64 PHYSFSX_check_read(PHYSFS_file *file, exact_type<V> v, PHYSFS_uint32 S, PHYSFS_uint32 C) DXX_CXX11_EXPLICIT_DELETE;
PHYSFS_sint64 PHYSFSX_check_read(PHYSFS_file *file, exact_type<V> v, PHYSFS_uint32 S, PHYSFS_uint32 C) = delete;
template <typename V>
PHYSFS_sint64 PHYSFSX_check_write(PHYSFS_file *file, exact_type<V> v, PHYSFS_uint32 S, PHYSFS_uint32 C) DXX_CXX11_EXPLICIT_DELETE;
PHYSFS_sint64 PHYSFSX_check_write(PHYSFS_file *file, exact_type<V> v, PHYSFS_uint32 S, PHYSFS_uint32 C) = delete;
template <typename V>
PHYSFS_sint64 PHYSFSX_check_read(PHYSFS_file *file, V **v, PHYSFS_uint32 S, PHYSFS_uint32 C) DXX_CXX11_EXPLICIT_DELETE;
PHYSFS_sint64 PHYSFSX_check_read(PHYSFS_file *file, V **v, PHYSFS_uint32 S, PHYSFS_uint32 C) = delete;
template <typename V>
PHYSFS_sint64 PHYSFSX_check_write(PHYSFS_file *file, V **v, PHYSFS_uint32 S, PHYSFS_uint32 C) DXX_CXX11_EXPLICIT_DELETE;
PHYSFS_sint64 PHYSFSX_check_write(PHYSFS_file *file, V **v, PHYSFS_uint32 S, PHYSFS_uint32 C) = delete;
#define PHYSFS_read(F,V,S,C) PHYSFSX_check_read(F,V,S,C)
#define PHYSFS_write(F,V,S,C) PHYSFSX_check_write(F,V,S,C)

View file

@ -187,10 +187,7 @@ message<array<uint8_t, amount>> udt_to_message(const pad_type<amount, value> &);
template <typename T>
struct missing_udt_specialization
{
#ifndef DXX_HAVE_CXX11_EXPLICIT_DELETE
protected:
#endif
missing_udt_specialization() DXX_CXX11_EXPLICIT_DELETE;
missing_udt_specialization() = delete;
};
template <typename T>

View file

@ -171,7 +171,7 @@ struct laser_info : prohibit_void_ptr<laser_info>, laser_parent
return *this;
}
template <typename T>
void operator=(T) DXX_CXX11_EXPLICIT_DELETE;
void operator=(T) = delete;
};
array<uint8_t, (MAX_OBJECTS + 7) / 8> mask;
proxy operator[](objnum_t i)
@ -417,7 +417,7 @@ struct object_array_t : array<object, MAX_OBJECTS>
return array_t::operator[](n);
}
template <typename T>
typename tt::enable_if<!tt::is_integral<T>::value, reference>::type operator[](T) const DXX_CXX11_EXPLICIT_DELETE;
typename tt::enable_if<!tt::is_integral<T>::value, reference>::type operator[](T) const = delete;
object_array_t();
object_array_t(const object_array_t &) = delete;
object_array_t &operator=(const object_array_t &) = delete;

View file

@ -345,7 +345,7 @@ class visited_segment_bitarray_t : public visited_segment_mask_t<bool, 1>
{
return !!(this->m_byte & this->mask());
}
operator int() const DXX_CXX11_EXPLICIT_DELETE;
operator int() const = delete;
};
struct bitproxy_t : public tmpl_bitproxy_t<array_t::reference>
{
@ -361,7 +361,7 @@ class visited_segment_bitarray_t : public visited_segment_mask_t<bool, 1>
this->m_byte &= ~this->mask();
return *this;
}
bitproxy_t& operator=(int) DXX_CXX11_EXPLICIT_DELETE;
bitproxy_t& operator=(int) = delete;
};
typedef tmpl_bitproxy_t<array_t::const_reference> const_bitproxy_t;
public:

View file

@ -12,8 +12,6 @@
#define DXX_HAVE_CXX11_RANGE_FOR
#define DXX_HAVE_CXX11_STATIC_ASSERT
#define DXX_HAVE_CXX11_TYPE_TRAITS
#define DXX_HAVE_CXX11_EXPLICIT_DELETE
#define DXX_CXX11_EXPLICIT_DELETE =delete
#define DXX_HAVE_CXX11_TEMPLATE_ALIAS
#define dxx_explicit_operator_bool explicit
#define DXX_HAVE_CXX11_BEGIN