From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1726) id 33BE73857811; Thu, 7 Apr 2022 15:08:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 33BE73857811 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Andrew Burgess To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb: more 'const' in gdb/reggroups.{c,h} X-Act-Checkin: binutils-gdb X-Git-Author: Andrew Burgess X-Git-Refname: refs/heads/master X-Git-Oldrev: 1bca9b1e6be9cb45684f38dba0d4d323447a653a X-Git-Newrev: e7fe10114995aee4d7012f287e5b8fee74c60fd8 Message-Id: <20220407150842.33BE73857811@sourceware.org> Date: Thu, 7 Apr 2022 15:08:42 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2022 15:08:42 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3De7fe10114995= aee4d7012f287e5b8fee74c60fd8 commit e7fe10114995aee4d7012f287e5b8fee74c60fd8 Author: Andrew Burgess Date: Thu Mar 31 16:32:50 2022 +0100 gdb: more 'const' in gdb/reggroups.{c,h} =20 Convert the reggroup_new and reggroup_gdbarch_new functions to return a 'const regggroup *', and fix up all the fallout. =20 There should be no user visible changes after this commit. Diff: --- gdb/csky-tdep.c | 10 +++++----- gdb/i386-tdep.c | 4 ++-- gdb/m32c-tdep.c | 2 +- gdb/m68hc11-tdep.c | 4 ++-- gdb/mep-tdep.c | 6 +++--- gdb/nds32-tdep.c | 20 ++++++++++---------- gdb/reggroups.c | 8 ++++---- gdb/reggroups.h | 13 +++++++------ gdb/riscv-tdep.c | 2 +- gdb/xtensa-tdep.c | 8 ++++---- 10 files changed, 39 insertions(+), 38 deletions(-) diff --git a/gdb/csky-tdep.c b/gdb/csky-tdep.c index feb416a2406..3712409dbe8 100644 --- a/gdb/csky-tdep.c +++ b/gdb/csky-tdep.c @@ -61,11 +61,11 @@ /* Control debugging information emitted in this file. */ static bool csky_debug =3D false; =20 -static struct reggroup *cr_reggroup; -static struct reggroup *fr_reggroup; -static struct reggroup *vr_reggroup; -static struct reggroup *mmu_reggroup; -static struct reggroup *prof_reggroup; +static const reggroup *cr_reggroup; +static const reggroup *fr_reggroup; +static const reggroup *vr_reggroup; +static const reggroup *mmu_reggroup; +static const reggroup *prof_reggroup; =20 /* Convenience function to print debug messages in prologue analysis. */ =20 diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 99a81b98da1..8501e12e241 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -4531,8 +4531,8 @@ i386_svr4_init_abi (struct gdbarch_info info, struct = gdbarch *gdbarch) /* i386 register groups. In addition to the normal groups, add "mmx" and "sse". */ =20 -static struct reggroup *i386_sse_reggroup; -static struct reggroup *i386_mmx_reggroup; +static const reggroup *i386_sse_reggroup; +static const reggroup *i386_mmx_reggroup; =20 static void i386_init_reggroups (void) diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c index 5a767c9ed52..55ef5a551f8 100644 --- a/gdb/m32c-tdep.c +++ b/gdb/m32c-tdep.c @@ -35,7 +35,7 @@ =0C /* The m32c tdep structure. */ =20 -static struct reggroup *m32c_dma_reggroup; +static const reggroup *m32c_dma_reggroup; =20 /* The type of a function that moves the value of REG between CACHE or BUF --- in either direction. */ diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index 9d978d88018..5c1f20415c8 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -1346,8 +1346,8 @@ m68hc11_elf_make_msymbol_special (asymbol *sym, struc= t minimal_symbol *msym) /* 68HC11/68HC12 register groups. Identify real hard registers and soft registers used by gcc. */ =20 -static struct reggroup *m68hc11_soft_reggroup; -static struct reggroup *m68hc11_hard_reggroup; +static const reggroup *m68hc11_soft_reggroup; +static const reggroup *m68hc11_hard_reggroup; =20 static void m68hc11_init_reggroups (void) diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c index 1ab01c6cbb3..6b3a62391c0 100644 --- a/gdb/mep-tdep.c +++ b/gdb/mep-tdep.c @@ -1021,9 +1021,9 @@ mep_register_name (struct gdbarch *gdbarch, int regnr) =20 =20 /* Custom register groups for the MeP. */ -static struct reggroup *mep_csr_reggroup; /* control/special */ -static struct reggroup *mep_cr_reggroup; /* coprocessor general-purpose */ -static struct reggroup *mep_ccr_reggroup; /* coprocessor control */ +static const reggroup *mep_csr_reggroup; /* control/special */ +static const reggroup *mep_cr_reggroup; /* coprocessor general-purpose */ +static const reggroup *mep_ccr_reggroup; /* coprocessor control */ =20 =20 static int diff --git a/gdb/nds32-tdep.c b/gdb/nds32-tdep.c index a94a03ab2ab..06b129bdd31 100644 --- a/gdb/nds32-tdep.c +++ b/gdb/nds32-tdep.c @@ -314,16 +314,16 @@ nds32_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, = int num) } =0C /* NDS32 register groups. */ -static struct reggroup *nds32_cr_reggroup; -static struct reggroup *nds32_ir_reggroup; -static struct reggroup *nds32_mr_reggroup; -static struct reggroup *nds32_dr_reggroup; -static struct reggroup *nds32_pfr_reggroup; -static struct reggroup *nds32_hspr_reggroup; -static struct reggroup *nds32_dmar_reggroup; -static struct reggroup *nds32_racr_reggroup; -static struct reggroup *nds32_idr_reggroup; -static struct reggroup *nds32_secur_reggroup; +static const reggroup *nds32_cr_reggroup; +static const reggroup *nds32_ir_reggroup; +static const reggroup *nds32_mr_reggroup; +static const reggroup *nds32_dr_reggroup; +static const reggroup *nds32_pfr_reggroup; +static const reggroup *nds32_hspr_reggroup; +static const reggroup *nds32_dmar_reggroup; +static const reggroup *nds32_racr_reggroup; +static const reggroup *nds32_idr_reggroup; +static const reggroup *nds32_secur_reggroup; =20 static void nds32_init_reggroups (void) diff --git a/gdb/reggroups.c b/gdb/reggroups.c index 7b8537e94f6..bb8a83f7653 100644 --- a/gdb/reggroups.c +++ b/gdb/reggroups.c @@ -36,7 +36,7 @@ struct reggroup enum reggroup_type type; }; =20 -struct reggroup * +const reggroup * reggroup_new (const char *name, enum reggroup_type type) { struct reggroup *group =3D XNEW (struct reggroup); @@ -48,7 +48,7 @@ reggroup_new (const char *name, enum reggroup_type type) =20 /* See reggroups.h. */ =20 -struct reggroup * +const reggroup * reggroup_gdbarch_new (struct gdbarch *gdbarch, const char *name, enum reggroup_type type) { @@ -81,7 +81,7 @@ struct reggroups { /* Add GROUP to the list of register groups. */ =20 - void add (struct reggroup *group) + void add (const reggroup *group) { gdb_assert (group !=3D nullptr); gdb_assert (std::find (m_groups.begin(), m_groups.end(), group) @@ -116,7 +116,7 @@ static struct gdbarch_data *reggroups_data; /* Add GROUP to the list of register groups for GDBARCH. */ =20 void -reggroup_add (struct gdbarch *gdbarch, struct reggroup *group) +reggroup_add (struct gdbarch *gdbarch, const reggroup *group) { struct reggroups *groups =3D (struct reggroups *) gdbarch_data (gdbarch, reggroups_data); diff --git a/gdb/reggroups.h b/gdb/reggroups.h index 4f0453871fc..8ac372574be 100644 --- a/gdb/reggroups.h +++ b/gdb/reggroups.h @@ -39,15 +39,16 @@ extern struct reggroup *const save_reggroup; extern struct reggroup *const restore_reggroup; =20 /* Create a new local register group. */ -extern struct reggroup *reggroup_new (const char *name, - enum reggroup_type type); +extern const reggroup *reggroup_new (const char *name, + enum reggroup_type type); + /* Create a new register group allocated onto the gdbarch obstack. */ -extern struct reggroup *reggroup_gdbarch_new (struct gdbarch *gdbarch, - const char *name, - enum reggroup_type type); +extern const reggroup *reggroup_gdbarch_new (struct gdbarch *gdbarch, + const char *name, + enum reggroup_type type); =20 /* Add a register group (with attribute values) to the pre-defined list. = */ -extern void reggroup_add (struct gdbarch *gdbarch, struct reggroup *group); +extern void reggroup_add (struct gdbarch *gdbarch, const reggroup *group); =20 /* Register group attributes. */ extern const char *reggroup_name (const struct reggroup *reggroup); diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c index 79b81351039..ab239744393 100644 --- a/gdb/riscv-tdep.c +++ b/gdb/riscv-tdep.c @@ -129,7 +129,7 @@ struct riscv_unwind_cache =20 /* RISC-V specific register group for CSRs. */ =20 -static reggroup *csr_reggroup =3D NULL; +static const reggroup *csr_reggroup =3D nullptr; =20 /* Callback function for user_reg_add. */ =20 diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c index 6e478ee893d..89bdd7ffd28 100644 --- a/gdb/xtensa-tdep.c +++ b/gdb/xtensa-tdep.c @@ -712,10 +712,10 @@ xtensa_pseudo_register_write (struct gdbarch *gdbarch, _("invalid register number %d"), regnum); } =20 -static struct reggroup *xtensa_ar_reggroup; -static struct reggroup *xtensa_user_reggroup; -static struct reggroup *xtensa_vectra_reggroup; -static struct reggroup *xtensa_cp[XTENSA_MAX_COPROCESSOR]; +static const reggroup *xtensa_ar_reggroup; +static const reggroup *xtensa_user_reggroup; +static const reggroup *xtensa_vectra_reggroup; +static const reggroup *xtensa_cp[XTENSA_MAX_COPROCESSOR]; =20 static void xtensa_init_reggroups (void)