gdb: add some const in gdb/reggroups.c

This commit makes the 'struct reggroup *' argument const for the
following functions:

  reggroup_next
  reggroup_prev
  reggroup_name
  reggroup_type

There are other places that could benefit from const in the
reggroup.{c,h} files, but these will be changing in further commits.

There should be no user visible changes after this commit.
This commit is contained in:
Andrew Burgess
2022-03-30 15:53:42 +01:00
parent 86d77f6a5b
commit b5556e33b5
2 changed files with 8 additions and 8 deletions

View File

@ -63,13 +63,13 @@ reggroup_gdbarch_new (struct gdbarch *gdbarch, const char *name,
/* Register group attributes. */ /* Register group attributes. */
const char * const char *
reggroup_name (struct reggroup *group) reggroup_name (const struct reggroup *group)
{ {
return group->name; return group->name;
} }
enum reggroup_type enum reggroup_type
reggroup_type (struct reggroup *group) reggroup_type (const struct reggroup *group)
{ {
return group->type; return group->type;
} }
@ -130,7 +130,7 @@ static struct reggroups default_groups = { NULL, &default_groups.first };
/* A register group iterator. */ /* A register group iterator. */
struct reggroup * struct reggroup *
reggroup_next (struct gdbarch *gdbarch, struct reggroup *last) reggroup_next (struct gdbarch *gdbarch, const struct reggroup *last)
{ {
struct reggroups *groups; struct reggroups *groups;
struct reggroup_el *el; struct reggroup_el *el;
@ -161,7 +161,7 @@ reggroup_next (struct gdbarch *gdbarch, struct reggroup *last)
/* See reggroups.h. */ /* See reggroups.h. */
struct reggroup * struct reggroup *
reggroup_prev (struct gdbarch *gdbarch, struct reggroup *curr) reggroup_prev (struct gdbarch *gdbarch, const struct reggroup *curr)
{ {
struct reggroups *groups; struct reggroups *groups;
struct reggroup_el *el; struct reggroup_el *el;

View File

@ -50,17 +50,17 @@ extern struct reggroup *reggroup_gdbarch_new (struct gdbarch *gdbarch,
extern void reggroup_add (struct gdbarch *gdbarch, struct reggroup *group); extern void reggroup_add (struct gdbarch *gdbarch, struct reggroup *group);
/* Register group attributes. */ /* Register group attributes. */
extern const char *reggroup_name (struct reggroup *reggroup); extern const char *reggroup_name (const struct reggroup *reggroup);
extern enum reggroup_type reggroup_type (struct reggroup *reggroup); extern enum reggroup_type reggroup_type (const struct reggroup *reggroup);
/* Iterators for the architecture's register groups. Pass in NULL, returns /* Iterators for the architecture's register groups. Pass in NULL, returns
the first (for next), or last (for prev) group. Pass in a group, the first (for next), or last (for prev) group. Pass in a group,
returns the next or previous group, or NULL when either the end or the returns the next or previous group, or NULL when either the end or the
beginning of the group list is reached. */ beginning of the group list is reached. */
extern struct reggroup *reggroup_next (struct gdbarch *gdbarch, extern struct reggroup *reggroup_next (struct gdbarch *gdbarch,
struct reggroup *last); const struct reggroup *last);
extern struct reggroup *reggroup_prev (struct gdbarch *gdbarch, extern struct reggroup *reggroup_prev (struct gdbarch *gdbarch,
struct reggroup *curr); const struct reggroup *curr);
/* Find a reggroup by name. */ /* Find a reggroup by name. */
extern reggroup *reggroup_find (struct gdbarch *gdbarch, const char *name); extern reggroup *reggroup_find (struct gdbarch *gdbarch, const char *name);