public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] [gdb/build] Fix build with gcc 4.8.5
@ 2022-07-12 11:37 Tom de Vries
  0 siblings, 0 replies; 2+ messages in thread
From: Tom de Vries @ 2022-07-12 11:37 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=02f0597c46892c4b69e0af45a95509bf310c759e

commit 02f0597c46892c4b69e0af45a95509bf310c759e
Author: Tom de Vries <tdevries@suse.de>
Date:   Tue Jul 12 13:36:57 2022 +0200

    [gdb/build] Fix build with gcc 4.8.5
    
    When building gdb with gcc 4.8.5, we run into problems due to unconditionally
    using:
    ...
         gdb_static_assert (std::is_trivially_copyable<packed>::value);
    ...
    in gdbsupport/packed.h.
    
    Fix this by guarding the usage with HAVE_IS_TRIVIALLY_COPYABLE.
    
    Tested by doing a full gdb build with gcc 4.8.5.

Diff:
---
 gdbsupport/packed.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gdbsupport/packed.h b/gdbsupport/packed.h
index ebc66c0cb1a..cd331b5477d 100644
--- a/gdbsupport/packed.h
+++ b/gdbsupport/packed.h
@@ -18,6 +18,8 @@
 #ifndef PACKED_H
 #define PACKED_H
 
+#include "traits.h"
+
 /* Each instantiation and full specialization of the packed template
    defines a type that behaves like a given scalar type, but that has
    byte alignment, and, may optionally have a smaller size than the
@@ -38,7 +40,9 @@ public:
     gdb_static_assert (alignof (packed) == 1);
 
     /* Make sure packed can be wrapped with std::atomic.  */
+#if HAVE_IS_TRIVIALLY_COPYABLE
     gdb_static_assert (std::is_trivially_copyable<packed>::value);
+#endif
     gdb_static_assert (std::is_copy_constructible<packed>::value);
     gdb_static_assert (std::is_move_constructible<packed>::value);
     gdb_static_assert (std::is_copy_assignable<packed>::value);


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [binutils-gdb] [gdb/build] Fix build with gcc 4.8.5
@ 2022-08-07 14:03 Tom de Vries
  0 siblings, 0 replies; 2+ messages in thread
From: Tom de Vries @ 2022-08-07 14:03 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=411c7e044fa99089d3030f2c61525c4d415f7b45

commit 411c7e044fa99089d3030f2c61525c4d415f7b45
Author: Tom de Vries <tdevries@suse.de>
Date:   Sun Aug 7 16:03:00 2022 +0200

    [gdb/build] Fix build with gcc 4.8.5
    
    When building with gcc 4.8.5, I run into:
    ...
    user-regs.c:85:1: error: could not convert \
      ‘{0l, (& builtin_user_regs.gdb_user_regs::first)}’ from \
      ‘<brace-enclosed initializer list>’ to ‘gdb_user_regs’
     };
     ^
    ...
    
    Fix this by removing the initialization and handling regs.last == nullptr in
    append_user_reg.
    
    Tested on x86_64-linux.

Diff:
---
 gdb/user-regs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gdb/user-regs.c b/gdb/user-regs.c
index 4bc4685387f..05bb04ef2ed 100644
--- a/gdb/user-regs.c
+++ b/gdb/user-regs.c
@@ -74,15 +74,15 @@ append_user_reg (struct gdb_user_regs *regs, const char *name,
   reg->xread = xread;
   reg->baton = baton;
   reg->next = NULL;
+  if (regs->last == nullptr)
+    regs->last = &regs->first;
   (*regs->last) = reg;
   regs->last = &(*regs->last)->next;
 }
 
 /* An array of the builtin user registers.  */
 
-static struct gdb_user_regs builtin_user_regs = {
-  NULL, &builtin_user_regs.first
-};
+static struct gdb_user_regs builtin_user_regs;
 
 void
 user_reg_add_builtin (const char *name, user_reg_read_ftype *xread,


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-07 14:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-12 11:37 [binutils-gdb] [gdb/build] Fix build with gcc 4.8.5 Tom de Vries
2022-08-07 14:03 Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).