Skip to content

Commit

Permalink
[gdb/build] Fix build with gcc 4.8.5
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vries committed Aug 7, 2022
1 parent c7cd106 commit 411c7e0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gdb/user-regs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 411c7e0

Please sign in to comment.