From 23acbfee6a82cc147b04b74a89d5b34b47c150f4 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Wed, 21 Feb 2024 11:46:52 -0500 Subject: gdbsupport: assume that compiler supports std::{is_trivially_constructible,is_trivially_copyable} This code was there to support g++ 4, which didn't support std::is_trivially_constructible and std::is_trivially_copyable. Since we now require g++ >= 9, I think it's fair to assume that GDB will always be compiled with a compiler that supports those. Change-Id: Ie7c1649139a2f48bf662cac92d7f3e38fb1f1ba1 --- gdbsupport/check-defines.el | 2 -- gdbsupport/packed.h | 2 -- gdbsupport/poison.h | 8 -------- gdbsupport/traits.h | 21 --------------------- 4 files changed, 33 deletions(-) (limited to 'gdbsupport') diff --git a/gdbsupport/check-defines.el b/gdbsupport/check-defines.el index 7603eff..b7cf61b 100644 --- a/gdbsupport/check-defines.el +++ b/gdbsupport/check-defines.el @@ -35,8 +35,6 @@ (put (intern "HAVE_USEFUL_SBRK") :check-ok t) (put (intern "HAVE_SOCKETS") :check-ok t) (put (intern "HAVE_F_GETFD") :check-ok t) -(put (intern "HAVE_IS_TRIVIALLY_COPYABLE") :check-ok t) -(put (intern "HAVE_IS_TRIVIALLY_CONSTRUCTIBLE") :check-ok t) (put (intern "HAVE_DOS_BASED_FILE_SYSTEM") :check-ok t) (defun check-read-config.in (file) diff --git a/gdbsupport/packed.h b/gdbsupport/packed.h index 8035535..5c817d4 100644 --- a/gdbsupport/packed.h +++ b/gdbsupport/packed.h @@ -80,9 +80,7 @@ public: static_assert (alignof (packed) == 1); /* Make sure packed can be wrapped with std::atomic. */ -#if HAVE_IS_TRIVIALLY_COPYABLE static_assert (std::is_trivially_copyable::value); -#endif static_assert (std::is_copy_constructible::value); static_assert (std::is_move_constructible::value); static_assert (std::is_copy_assignable::value); diff --git a/gdbsupport/poison.h b/gdbsupport/poison.h index 0d0159e..7b4f8e8 100644 --- a/gdbsupport/poison.h +++ b/gdbsupport/poison.h @@ -56,8 +56,6 @@ template >>> 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. */ @@ -83,17 +81,11 @@ template >>> void *memmove (D *dest, const S *src, size_t n) = delete; -#endif /* HAVE_IS_TRIVIALLY_COPYABLE */ - /* Poison XNEW and friends to catch usages of malloc-style allocations on objects that require new/delete. */ template -#if HAVE_IS_TRIVIALLY_CONSTRUCTIBLE using IsMallocable = std::is_trivially_constructible; -#else -using IsMallocable = std::true_type; -#endif template using IsFreeable = gdb::Or, std::is_void>; diff --git a/gdbsupport/traits.h b/gdbsupport/traits.h index eb97b96..92fe59f 100644 --- a/gdbsupport/traits.h +++ b/gdbsupport/traits.h @@ -20,27 +20,6 @@ #include -/* 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 - -/* HAVE_IS_TRIVIALLY_CONSTRUCTIBLE is defined as 1 iff - std::is_trivially_constructible is available. GCC only implemented it - in GCC 5. */ -#if (__has_feature(is_trivially_constructible) \ - || (defined __GNUC__ && __GNUC__ >= 5)) -# define HAVE_IS_TRIVIALLY_CONSTRUCTIBLE 1 -#endif - namespace gdb { /* Implementation of the detection idiom: -- cgit v1.1