+2017-04-25 Pedro Alves <palves@redhat.com>
+
+ * common/poison.h [!HAVE_IS_TRIVIALLY_COPYABLE] (IsRelocatable)
+ (BothAreRelocatable, memcopy, memmove): Don't define.
+ * common/traits.h (__has_feature, HAVE_IS_TRIVIALLY_COPYABLE): New
+ macros.
+
2017-04-25 Pedro Alves <palves@redhat.com>
* common/common-defs.h: Include "common/poison.h".
typename = gdb::Requires<gdb::Not<IsMemsettable<T>>>>
void *memset (T *s, int c, size_t n) = delete;
+#if HAVE_IS_TRIVIALLY_COPYABLE
+
/* Similarly, poison memcpy and memmove of non trivially-copyable
types, which is undefined. */
typename = gdb::Requires<gdb::Not<BothAreRelocatable<D, S>>>>
void *memmove (D *dest, const S *src, size_t n) = delete;
+#endif /* HAVE_IS_TRIVIALLY_COPYABLE */
+
#endif /* COMMON_POISON_H */
#include <type_traits>
+/* GCC does not understand __has_feature. */
+#if !defined(__has_feature)
+# define __has_feature(x) 0
+#endif
+
+/* HAVE_IS_TRIVIALLY_COPYABLE is defined as 1 iff
+ std::is_trivially_copyable is available. GCC only implemented it
+ in GCC 5. */
+#if (__has_feature(is_trivially_copyable) \
+ || (defined __GNUC__ && __GNUC__ >= 5))
+# define HAVE_IS_TRIVIALLY_COPYABLE 1
+#endif
+
namespace gdb {
/* Pre C++14-safe (CWG 1558) version of C++17's std::void_t. See