public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom de Vries <vries@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] [gdb/build] Fix build with gcc 4.8.5
Date: Sun,  7 Aug 2022 14:03:05 +0000 (GMT)	[thread overview]
Message-ID: <20220807140305.4ADB93858004@sourceware.org> (raw)

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,


             reply	other threads:[~2022-08-07 14:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-07 14:03 Tom de Vries [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-07-12 11:37 Tom de Vries

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=20220807140305.4ADB93858004@sourceware.org \
    --to=vries@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).