Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Bernd Edlinger <bernd.edlinger@hotmail.de>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	Luis Machado <luis.machado@linaro.org>,
	Simon Marchi <simon.marchi@polymtl.ca>
Subject: [PATCH] Fix building gdb with gcc-4.x
Date: Mon, 4 Jan 2021 21:57:30 +0100	[thread overview]
Message-ID: <AM0PR0602MB3410CF3FCFD75CC32A681896E4D20@AM0PR0602MB3410.eurprd06.prod.outlook.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 402 bytes --]

Hi,

with Luis' commit of today the trunk is no longer able to
be compiled with gcc-4.x.

The problem is std::is_trivially_default_constructible is
not defined before gcc-5 although the compiler supports C++11 

I am not sure about what's the best approach for conditionally
enabling the code, especially for compilers other than g++.


This fixes the build for me.
Is it OK for trunk?


Thanks
Bernd.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-building-gdb-with-gcc-4.x.patch --]
[-- Type: text/x-patch; name="0001-Fix-building-gdb-with-gcc-4.x.patch", Size: 1632 bytes --]

From 0879e2cff0ea732769aa80b89fa6fbba70c84260 Mon Sep 17 00:00:00 2001
From: Bernd Edlinger <bernd.edlinger@hotmail.de>
Date: Mon, 4 Jan 2021 21:40:41 +0100
Subject: [PATCH] Fix building gdb with gcc-4.x
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Since is_trivially_default_constructible was not implemented before gcc-5
it cannot be used with gcc-4.x.

../../binutils-gdb/gdb/trad-frame.c: In function ‘trad_frame_saved_reg* trad_frame_alloc_saved_regs(gdbarch*)’:
../../binutils-gdb/gdb/trad-frame.c:64:22: error: ‘is_trivially_default_constructible’ is not a member of ‘std’
   gdb_static_assert (std::is_trivially_default_constructible<trad_frame_saved_reg>::value);

Fix build by using conditional compilation around that line.

Fixes: 098caef485a ("Refactor struct trad_frame_saved_regs")

gdb:
2021-01-04  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        * trad-frame.c (trad_frame_alloc_saved_regs): Avoid compile-error
	because is_trivially_default_constructible was first implemented with
	gcc-5.
---
 gdb/trad-frame.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gdb/trad-frame.c b/gdb/trad-frame.c
index 17375e8..de1acc1 100644
--- a/gdb/trad-frame.c
+++ b/gdb/trad-frame.c
@@ -60,7 +60,9 @@ struct trad_frame_cache *
 trad_frame_saved_reg *
 trad_frame_alloc_saved_regs (struct gdbarch *gdbarch)
 {
+#if defined(__GNUC__) && __GNUC__ >= 5
   gdb_static_assert (std::is_trivially_default_constructible<trad_frame_saved_reg>::value);
+#endif
 
   int numregs = gdbarch_num_cooked_regs (gdbarch);
   trad_frame_saved_reg *this_saved_regs
-- 
1.9.1


             reply	other threads:[~2021-01-04 20:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-04 20:57 Bernd Edlinger [this message]
2021-01-04 21:16 ` Luis Machado via Gdb-patches
2021-01-04 21:34   ` Luis Machado via Gdb-patches
2021-01-04 21:30 ` Simon Marchi via Gdb-patches
2021-01-14  6:36   ` Bernd Edlinger
2021-01-14 15:56     ` Simon Marchi via Gdb-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AM0PR0602MB3410CF3FCFD75CC32A681896E4D20@AM0PR0602MB3410.eurprd06.prod.outlook.com \
    --to=bernd.edlinger@hotmail.de \
    --cc=gdb-patches@sourceware.org \
    --cc=luis.machado@linaro.org \
    --cc=simon.marchi@polymtl.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox