From 411c7e044fa99089d3030f2c61525c4d415f7b45 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Sun, 7 Aug 2022 16:03:00 +0200 Subject: [PATCH] [gdb/build] Fix build with gcc 4.8.5 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 \ ‘’ to ‘gdb_user_regs’ }; ^ ... Fix this by removing the initialization and handling regs.last == nullptr in append_user_reg. Tested on x86_64-linux. --- 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 = ®s->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, -- 2.30.2