From 58eadc4b691b5c943a9b8879420242ffc6d498c7 Mon Sep 17 00:00:00 2001 From: Bernd Edlinger Date: Mon, 4 Jan 2021 21:40:41 +0100 Subject: [PATCH] Fix building gdb with gcc-4.x Since is_trivially_default_constructible was not implemented before gcc-5 it cannot be used with gcc-4.x. Fix the build by using conditional compilation around that line. Use the equivalent is_trivially_constructible instead, since we already have HAVE_IS_TRIVIALLY_CONSTRUCTIBLE for that purpose. Fixes: 098caef485a ("Refactor struct trad_frame_saved_regs") gdb: 2021-01-14 Bernd Edlinger * trad-frame.c (trad_frame_alloc_saved_regs): Avoid compile-error because is_trivially_default_constructible was first implemented with gcc-5. --- gdb/ChangeLog | 6 ++++++ gdb/trad-frame.c | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c290957bd7d..15d332cc85c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2021-01-14 Bernd Edlinger + + * trad-frame.c (trad_frame_alloc_saved_regs): Avoid compile-error + because is_trivially_default_constructible was first implemented with + gcc-5. + 2021-01-14 Tom de Vries PR breakpoints/27151 diff --git a/gdb/trad-frame.c b/gdb/trad-frame.c index 17375e83482..3284c452317 100644 --- a/gdb/trad-frame.c +++ b/gdb/trad-frame.c @@ -25,6 +25,7 @@ #include "target.h" #include "value.h" #include "gdbarch.h" +#include "gdbsupport/traits.h" struct trad_frame_cache { @@ -60,7 +61,9 @@ trad_frame_reset_saved_regs (struct gdbarch *gdbarch, trad_frame_saved_reg * trad_frame_alloc_saved_regs (struct gdbarch *gdbarch) { - gdb_static_assert (std::is_trivially_default_constructible::value); +#ifdef HAVE_IS_TRIVIALLY_CONSTRUCTIBLE + gdb_static_assert (std::is_trivially_constructible::value); +#endif int numregs = gdbarch_num_cooked_regs (gdbarch); trad_frame_saved_reg *this_saved_regs -- 2.30.2