[RFC,01/23] Constify regset structures.

Message ID 877g696bew.fsf@br87z6lw.de.ibm.com
State Committed
Headers

Commit Message

Andreas Arnez April 28, 2014, 9:39 a.m. UTC
  Convert (unnecessarily) non-constant static regsets to constant ones.

gdb/
	* alpha-linux-tdep.c (alpha_linux_gregset, alpha_linux_fpregset):
	Constify structures.
	* alphanbsd-tdep.c (alphanbsd_gregset, alphanbsd_fpregset)
	(alphanbsd_aout_gregset): Likewise.
	* armbsd-tdep.c (armbsd_gregset, armbsd_fpregset): Likewise.
	* frv-linux-tdep.c (frv_linux_gregset, frv_linux_fpregset):
	Likewise.
	* hppa-hpux-tdep.c (hppa_hpux_regset): Likewise.
	* hppa-linux-tdep.c (hppa_linux_regset, hppa_linux_fpregset):
	Likewise.
	* hppanbsd-tdep.c (hppanbsd_gregset): Likewise.
	* hppaobsd-tdep.c (hppaobsd_gregset, hppaobsd_fpregset): Likewise.
	* m32r-linux-tdep.c (m32r_linux_gregset): Likewise.
	* m68kbsd-tdep.c (m68kbsd_gregset, m68kbsd_fpregset): Likewise.
	* m88k-tdep.c (m88k_gregset): Likewise.
	* mips64obsd-tdep.c (mips64obsd_gregset): Likewise.
	* mipsnbsd-tdep.c (mipsnbsd_gregset, mipsnbsd_fpregset): Likewise.
	* nios2-linux-tdep.c (nios2_core_regset): Likewise.
	* ppcfbsd-tdep.c (ppc32_fbsd_fpregset): Likewise.
	* ppcnbsd-tdep.c (ppcnbsd_gregset, ppcnbsd_fpregset): Likewise.
	* ppcnbsd-tdep.h (ppcnbsd_gregset, ppcnbsd_fpregset): Likewise.
	* ppcobsd-tdep.c (ppcobsd_gregset, ppcobsd_fpregset): Likewise.
	* ppcobsd-tdep.h (ppcobsd_gregset, ppcobsd_fpregset): Likewise.
	* rs6000-aix-tdep.c (rs6000_aix32_regset, rs6000_aix64_regset):
	Likewise.
	* sh-tdep.c (sh_corefile_gregset, sh_corefile_fpregset): Likewise.
	* sh-tdep.h (sh_corefile_gregset): Likewise.
	* tilegx-linux-tdep.c (tilegx_linux_regset): Likewise.
	* vax-tdep.c (vax_gregset): Likewise.
---
 gdb/alpha-linux-tdep.c  | 4 ++--
 gdb/alphanbsd-tdep.c    | 6 +++---
 gdb/armbsd-tdep.c       | 4 ++--
 gdb/frv-linux-tdep.c    | 4 ++--
 gdb/hppa-hpux-tdep.c    | 2 +-
 gdb/hppa-linux-tdep.c   | 4 ++--
 gdb/hppanbsd-tdep.c     | 2 +-
 gdb/hppaobsd-tdep.c     | 4 ++--
 gdb/m32r-linux-tdep.c   | 2 +-
 gdb/m68kbsd-tdep.c      | 4 ++--
 gdb/m88k-tdep.c         | 2 +-
 gdb/mips64obsd-tdep.c   | 2 +-
 gdb/mipsnbsd-tdep.c     | 4 ++--
 gdb/nios2-linux-tdep.c  | 2 +-
 gdb/ppcfbsd-tdep.c      | 2 +-
 gdb/ppcnbsd-tdep.c      | 4 ++--
 gdb/ppcnbsd-tdep.h      | 4 ++--
 gdb/ppcobsd-tdep.c      | 4 ++--
 gdb/ppcobsd-tdep.h      | 4 ++--
 gdb/rs6000-aix-tdep.c   | 4 ++--
 gdb/sh-tdep.c           | 4 ++--
 gdb/sh-tdep.h           | 2 +-
 gdb/tilegx-linux-tdep.c | 2 +-
 gdb/vax-tdep.c          | 2 +-
 24 files changed, 39 insertions(+), 39 deletions(-)
  

Comments

Mark Kettenis May 5, 2014, 9:45 a.m. UTC | #1
> From: "Andreas Arnez" <arnez@linux.vnet.ibm.com>
> Date: Mon, 28 Apr 2014 11:39:03 +0200
> 
> Convert (unnecessarily) non-constant static regsets to constant ones.
> 
> gdb/
> 	* alpha-linux-tdep.c (alpha_linux_gregset, alpha_linux_fpregset):
> 	Constify structures.
> 	* alphanbsd-tdep.c (alphanbsd_gregset, alphanbsd_fpregset)
> 	(alphanbsd_aout_gregset): Likewise.
> 	* armbsd-tdep.c (armbsd_gregset, armbsd_fpregset): Likewise.
> 	* frv-linux-tdep.c (frv_linux_gregset, frv_linux_fpregset):
> 	Likewise.
> 	* hppa-hpux-tdep.c (hppa_hpux_regset): Likewise.
> 	* hppa-linux-tdep.c (hppa_linux_regset, hppa_linux_fpregset):
> 	Likewise.
> 	* hppanbsd-tdep.c (hppanbsd_gregset): Likewise.
> 	* hppaobsd-tdep.c (hppaobsd_gregset, hppaobsd_fpregset): Likewise.
> 	* m32r-linux-tdep.c (m32r_linux_gregset): Likewise.
> 	* m68kbsd-tdep.c (m68kbsd_gregset, m68kbsd_fpregset): Likewise.
> 	* m88k-tdep.c (m88k_gregset): Likewise.
> 	* mips64obsd-tdep.c (mips64obsd_gregset): Likewise.
> 	* mipsnbsd-tdep.c (mipsnbsd_gregset, mipsnbsd_fpregset): Likewise.
> 	* nios2-linux-tdep.c (nios2_core_regset): Likewise.
> 	* ppcfbsd-tdep.c (ppc32_fbsd_fpregset): Likewise.
> 	* ppcnbsd-tdep.c (ppcnbsd_gregset, ppcnbsd_fpregset): Likewise.
> 	* ppcnbsd-tdep.h (ppcnbsd_gregset, ppcnbsd_fpregset): Likewise.
> 	* ppcobsd-tdep.c (ppcobsd_gregset, ppcobsd_fpregset): Likewise.
> 	* ppcobsd-tdep.h (ppcobsd_gregset, ppcobsd_fpregset): Likewise.
> 	* rs6000-aix-tdep.c (rs6000_aix32_regset, rs6000_aix64_regset):
> 	Likewise.
> 	* sh-tdep.c (sh_corefile_gregset, sh_corefile_fpregset): Likewise.
> 	* sh-tdep.h (sh_corefile_gregset): Likewise.
> 	* tilegx-linux-tdep.c (tilegx_linux_regset): Likewise.
> 	* vax-tdep.c (vax_gregset): Likewise.

Sure.
  

Patch

diff --git a/gdb/alpha-linux-tdep.c b/gdb/alpha-linux-tdep.c
index 0f39968..52f19d0 100644
--- a/gdb/alpha-linux-tdep.c
+++ b/gdb/alpha-linux-tdep.c
@@ -206,13 +206,13 @@  alpha_linux_supply_fpregset (const struct regset *regset,
     regcache_raw_supply (regcache, ALPHA_FPCR_REGNUM, regs + 31 * 8);
 }
 
-static struct regset alpha_linux_gregset =
+static const struct regset alpha_linux_gregset =
 {
   NULL,
   alpha_linux_supply_gregset
 };
 
-static struct regset alpha_linux_fpregset =
+static const struct regset alpha_linux_fpregset =
 {
   NULL,
   alpha_linux_supply_fpregset
diff --git a/gdb/alphanbsd-tdep.c b/gdb/alphanbsd-tdep.c
index 2225790..58d9f32 100644
--- a/gdb/alphanbsd-tdep.c
+++ b/gdb/alphanbsd-tdep.c
@@ -141,19 +141,19 @@  alphanbsd_aout_supply_gregset (const struct regset *regset,
 
 /* NetBSD/alpha register sets.  */
 
-static struct regset alphanbsd_gregset =
+static const struct regset alphanbsd_gregset =
 {
   NULL,
   alphanbsd_supply_gregset
 };
 
-static struct regset alphanbsd_fpregset =
+static const struct regset alphanbsd_fpregset =
 {
   NULL,
   alphanbsd_supply_fpregset
 };
 
-static struct regset alphanbsd_aout_gregset =
+static const struct regset alphanbsd_aout_gregset =
 {
   NULL,
   alphanbsd_aout_supply_gregset
diff --git a/gdb/armbsd-tdep.c b/gdb/armbsd-tdep.c
index b57af3d..036db6c 100644
--- a/gdb/armbsd-tdep.c
+++ b/gdb/armbsd-tdep.c
@@ -98,13 +98,13 @@  armbsd_supply_gregset (const struct regset *regset,
 
 /* ARM register sets.  */
 
-static struct regset armbsd_gregset =
+static const struct regset armbsd_gregset =
 {
   NULL,
   armbsd_supply_gregset
 };
 
-static struct regset armbsd_fpregset =
+static const struct regset armbsd_fpregset =
 {
   NULL,
   armbsd_supply_fpregset
diff --git a/gdb/frv-linux-tdep.c b/gdb/frv-linux-tdep.c
index 2ddc3f2..fb163a8 100644
--- a/gdb/frv-linux-tdep.c
+++ b/gdb/frv-linux-tdep.c
@@ -465,13 +465,13 @@  frv_linux_supply_fpregset (const struct regset *regset,
 
 /* FRV Linux kernel register sets.  */
 
-static struct regset frv_linux_gregset =
+static const struct regset frv_linux_gregset =
 {
   NULL,
   frv_linux_supply_gregset
 };
 
-static struct regset frv_linux_fpregset =
+static const struct regset frv_linux_fpregset =
 {
   NULL,
   frv_linux_supply_fpregset
diff --git a/gdb/hppa-hpux-tdep.c b/gdb/hppa-hpux-tdep.c
index 8d4686f..588f577 100644
--- a/gdb/hppa-hpux-tdep.c
+++ b/gdb/hppa-hpux-tdep.c
@@ -1367,7 +1367,7 @@  hppa_hpux_supply_save_state (const struct regset *regset,
 
 /* HP-UX register set.  */
 
-static struct regset hppa_hpux_regset =
+static const struct regset hppa_hpux_regset =
 {
   NULL,
   hppa_hpux_supply_save_state
diff --git a/gdb/hppa-linux-tdep.c b/gdb/hppa-linux-tdep.c
index 4e89048..7a765a2 100644
--- a/gdb/hppa-linux-tdep.c
+++ b/gdb/hppa-linux-tdep.c
@@ -491,13 +491,13 @@  hppa_linux_supply_fpregset (const struct regset *regset,
 }
 
 /* HPPA Linux kernel register set.  */
-static struct regset hppa_linux_regset =
+static const struct regset hppa_linux_regset =
 {
   NULL,
   hppa_linux_supply_regset
 };
 
-static struct regset hppa_linux_fpregset =
+static const struct regset hppa_linux_fpregset =
 {
   NULL,
   hppa_linux_supply_fpregset
diff --git a/gdb/hppanbsd-tdep.c b/gdb/hppanbsd-tdep.c
index 466aa69..fdc9719 100644
--- a/gdb/hppanbsd-tdep.c
+++ b/gdb/hppanbsd-tdep.c
@@ -181,7 +181,7 @@  hppanbsd_supply_gregset (const struct regset *regset,
 
 /* NetBSD/hppa register set.  */
 
-static struct regset hppanbsd_gregset =
+static const struct regset hppanbsd_gregset =
 {
   NULL,
   hppanbsd_supply_gregset
diff --git a/gdb/hppaobsd-tdep.c b/gdb/hppaobsd-tdep.c
index 7f517dc..8dc03a2 100644
--- a/gdb/hppaobsd-tdep.c
+++ b/gdb/hppaobsd-tdep.c
@@ -131,13 +131,13 @@  hppaobsd_supply_fpregset (const struct regset *regset,
 
 /* OpenBSD/hppa register sets.  */
 
-static struct regset hppaobsd_gregset =
+static const struct regset hppaobsd_gregset =
 {
   NULL,
   hppaobsd_supply_gregset
 };
 
-static struct regset hppaobsd_fpregset =
+static const struct regset hppaobsd_fpregset =
 {
   NULL,
   hppaobsd_supply_fpregset
diff --git a/gdb/m32r-linux-tdep.c b/gdb/m32r-linux-tdep.c
index 683b67e..bf1ffff 100644
--- a/gdb/m32r-linux-tdep.c
+++ b/gdb/m32r-linux-tdep.c
@@ -388,7 +388,7 @@  m32r_linux_supply_gregset (const struct regset *regset,
     }
 }
 
-static struct regset m32r_linux_gregset = {
+static const struct regset m32r_linux_gregset = {
   NULL, m32r_linux_supply_gregset
 };
 
diff --git a/gdb/m68kbsd-tdep.c b/gdb/m68kbsd-tdep.c
index e59bc66..d27beb8 100644
--- a/gdb/m68kbsd-tdep.c
+++ b/gdb/m68kbsd-tdep.c
@@ -105,13 +105,13 @@  m68kbsd_supply_gregset (const struct regset *regset,
 
 /* Motorola 68000 register sets.  */
 
-static struct regset m68kbsd_gregset =
+static const struct regset m68kbsd_gregset =
 {
   NULL,
   m68kbsd_supply_gregset
 };
 
-static struct regset m68kbsd_fpregset =
+static const struct regset m68kbsd_fpregset =
 {
   NULL,
   m68kbsd_supply_fpregset
diff --git a/gdb/m88k-tdep.c b/gdb/m88k-tdep.c
index bab7fee..56384a7 100644
--- a/gdb/m88k-tdep.c
+++ b/gdb/m88k-tdep.c
@@ -799,7 +799,7 @@  m88k_supply_gregset (const struct regset *regset,
 
 /* Motorola 88000 register set.  */
 
-static struct regset m88k_gregset =
+static const struct regset m88k_gregset =
 {
   NULL,
   m88k_supply_gregset
diff --git a/gdb/mips64obsd-tdep.c b/gdb/mips64obsd-tdep.c
index 62853ce..6d8b9ee 100644
--- a/gdb/mips64obsd-tdep.c
+++ b/gdb/mips64obsd-tdep.c
@@ -61,7 +61,7 @@  mips64obsd_supply_gregset (const struct regset *regset,
 
 /* OpenBSD/mips64 register set.  */
 
-static struct regset mips64obsd_gregset =
+static const struct regset mips64obsd_gregset =
 {
   NULL,
   mips64obsd_supply_gregset
diff --git a/gdb/mipsnbsd-tdep.c b/gdb/mipsnbsd-tdep.c
index 9742150..31b8dca 100644
--- a/gdb/mipsnbsd-tdep.c
+++ b/gdb/mipsnbsd-tdep.c
@@ -103,13 +103,13 @@  mipsnbsd_supply_gregset (const struct regset *regset,
 
 /* NetBSD/mips register sets.  */
 
-static struct regset mipsnbsd_gregset =
+static const struct regset mipsnbsd_gregset =
 {
   NULL,
   mipsnbsd_supply_gregset
 };
 
-static struct regset mipsnbsd_fpregset =
+static const struct regset mipsnbsd_fpregset =
 {
   NULL,
   mipsnbsd_supply_fpregset
diff --git a/gdb/nios2-linux-tdep.c b/gdb/nios2-linux-tdep.c
index 792a4da..d9a51a8 100644
--- a/gdb/nios2-linux-tdep.c
+++ b/gdb/nios2-linux-tdep.c
@@ -73,7 +73,7 @@  nios2_supply_gregset (const struct regset *regset,
       }
 }
 
-static struct regset nios2_core_regset =
+static const struct regset nios2_core_regset =
 {
   NULL,
   nios2_supply_gregset,
diff --git a/gdb/ppcfbsd-tdep.c b/gdb/ppcfbsd-tdep.c
index a03c6a9..77292f3 100644
--- a/gdb/ppcfbsd-tdep.c
+++ b/gdb/ppcfbsd-tdep.c
@@ -115,7 +115,7 @@  static const struct regset ppc64_fbsd_gregset = {
 
 /* 32-/64-bit floating-point register set.  */
 
-static struct regset ppc32_fbsd_fpregset = {
+static const struct regset ppc32_fbsd_fpregset = {
   &ppc32_fbsd_reg_offsets,
   ppc_supply_fpregset,
   ppc_collect_fpregset
diff --git a/gdb/ppcnbsd-tdep.c b/gdb/ppcnbsd-tdep.c
index 58e6599..6fe8477 100644
--- a/gdb/ppcnbsd-tdep.c
+++ b/gdb/ppcnbsd-tdep.c
@@ -42,13 +42,13 @@  struct ppc_reg_offsets ppcnbsd_reg_offsets;
 
 /* NetBSD/powerpc register sets.  */
 
-struct regset ppcnbsd_gregset =
+const struct regset ppcnbsd_gregset =
 {
   &ppcnbsd_reg_offsets,
   ppc_supply_gregset
 };
 
-struct regset ppcnbsd_fpregset =
+const struct regset ppcnbsd_fpregset =
 {
   &ppcnbsd_reg_offsets,
   ppc_supply_fpregset
diff --git a/gdb/ppcnbsd-tdep.h b/gdb/ppcnbsd-tdep.h
index 52f6478..747b452 100644
--- a/gdb/ppcnbsd-tdep.h
+++ b/gdb/ppcnbsd-tdep.h
@@ -28,7 +28,7 @@  struct regset;
 extern struct ppc_reg_offsets ppcnbsd_reg_offsets;
 
 /* Register sets for NetBSD/powerpc.  */
-extern struct regset ppcnbsd_gregset;
-extern struct regset ppcnbsd_fpregset;
+extern const struct regset ppcnbsd_gregset;
+extern const struct regset ppcnbsd_fpregset;
 
 #endif /* ppcnbsd-tdep.h */
diff --git a/gdb/ppcobsd-tdep.c b/gdb/ppcobsd-tdep.c
index ac60bcc..2cdf687 100644
--- a/gdb/ppcobsd-tdep.c
+++ b/gdb/ppcobsd-tdep.c
@@ -71,13 +71,13 @@  ppcobsd_collect_gregset (const struct regset *regset,
 
 /* OpenBSD/powerpc register set.  */
 
-struct regset ppcobsd_gregset =
+const struct regset ppcobsd_gregset =
 {
   &ppcobsd_reg_offsets,
   ppcobsd_supply_gregset
 };
 
-struct regset ppcobsd_fpregset =
+const struct regset ppcobsd_fpregset =
 {
   &ppcobsd_fpreg_offsets,
   ppc_supply_fpregset
diff --git a/gdb/ppcobsd-tdep.h b/gdb/ppcobsd-tdep.h
index ea6bd3d..8c9ac3a 100644
--- a/gdb/ppcobsd-tdep.h
+++ b/gdb/ppcobsd-tdep.h
@@ -30,8 +30,8 @@  extern struct ppc_reg_offsets ppcobsd_reg_offsets;
 extern struct ppc_reg_offsets ppcobsd_fpreg_offsets;
 
 /* Register sets for OpenBSD/powerpc.  */
-extern struct regset ppcobsd_gregset;
-extern struct regset ppcobsd_fpregset;
+extern const struct regset ppcobsd_gregset;
+extern const struct regset ppcobsd_fpregset;
 
 
 /* Supply register REGNUM in the general-purpose register set REGSET
diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c
index 3ab8883..83e881e 100644
--- a/gdb/rs6000-aix-tdep.c
+++ b/gdb/rs6000-aix-tdep.c
@@ -135,14 +135,14 @@  rs6000_aix_collect_regset (const struct regset *regset,
 
 /* AIX register set.  */
 
-static struct regset rs6000_aix32_regset =
+static const struct regset rs6000_aix32_regset =
 {
   &rs6000_aix32_reg_offsets,
   rs6000_aix_supply_regset,
   rs6000_aix_collect_regset,
 };
 
-static struct regset rs6000_aix64_regset =
+static const struct regset rs6000_aix64_regset =
 {
   &rs6000_aix64_reg_offsets,
   rs6000_aix_supply_regset,
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 85f8067..0c1fbed 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -2195,14 +2195,14 @@  sh_corefile_collect_regset (const struct regset *regset,
 /* The following two regsets have the same contents, so it is tempting to
    unify them, but they are distiguished by their address, so don't.  */
 
-struct regset sh_corefile_gregset =
+const struct regset sh_corefile_gregset =
 {
   NULL,
   sh_corefile_supply_regset,
   sh_corefile_collect_regset
 };
 
-static struct regset sh_corefile_fpregset =
+static const struct regset sh_corefile_fpregset =
 {
   NULL,
   sh_corefile_supply_regset,
diff --git a/gdb/sh-tdep.h b/gdb/sh-tdep.h
index 3e3c746..5d64c74 100644
--- a/gdb/sh-tdep.h
+++ b/gdb/sh-tdep.h
@@ -101,7 +101,7 @@  struct gdbarch_tdep
   struct sh_corefile_regmap *core_fpregmap;
 };
 
-extern struct regset sh_corefile_gregset;
+extern const struct regset sh_corefile_gregset;
 
 void sh_corefile_supply_regset (const struct regset *regset,
 				struct regcache *regcache,
diff --git a/gdb/tilegx-linux-tdep.c b/gdb/tilegx-linux-tdep.c
index 98b071a..98b03db 100644
--- a/gdb/tilegx-linux-tdep.c
+++ b/gdb/tilegx-linux-tdep.c
@@ -97,7 +97,7 @@  tilegx_linux_supply_regset (const struct regset *regset,
 }
 
 /* TILE-Gx Linux kernel register set.  */
-static struct regset tilegx_linux_regset =
+static const struct regset tilegx_linux_regset =
 {
   NULL,
   tilegx_linux_supply_regset
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
index efa702c..4780c90 100644
--- a/gdb/vax-tdep.c
+++ b/gdb/vax-tdep.c
@@ -85,7 +85,7 @@  vax_supply_gregset (const struct regset *regset, struct regcache *regcache,
 
 /* VAX register set.  */
 
-static struct regset vax_gregset =
+static const struct regset vax_gregset =
 {
   NULL,
   vax_supply_gregset