[PATCH] Remove register_gdbarch_init

Tom Tromey tom@tromey.com
Sun Jul 31 16:47:52 GMT 2022


This removes the deprecated register_gdbarch_init in favor a default
argument to gdbarch_register.  Regression tested on x86-64 Fedora 34.
---
 gdb/arch-utils.c      | 10 +---------
 gdb/avr-tdep.c        |  2 +-
 gdb/bfin-tdep.c       |  2 +-
 gdb/bpf-tdep.c        |  2 +-
 gdb/csky-tdep.c       |  2 +-
 gdb/frv-tdep.c        |  2 +-
 gdb/ft32-tdep.c       |  2 +-
 gdb/gdbarch.h         |  7 ++-----
 gdb/h8300-tdep.c      |  2 +-
 gdb/i386-tdep.c       |  2 +-
 gdb/iq2000-tdep.c     |  2 +-
 gdb/lm32-tdep.c       |  2 +-
 gdb/m32c-tdep.c       |  2 +-
 gdb/m32r-tdep.c       |  2 +-
 gdb/m68hc11-tdep.c    |  4 ++--
 gdb/mep-tdep.c        |  2 +-
 gdb/microblaze-tdep.c |  2 +-
 gdb/moxie-tdep.c      |  2 +-
 gdb/msp430-tdep.c     |  2 +-
 gdb/nds32-tdep.c      |  2 +-
 gdb/rl78-tdep.c       |  2 +-
 gdb/rx-tdep.c         |  2 +-
 gdb/s390-tdep.c       |  2 +-
 gdb/sparc-tdep.c      |  2 +-
 gdb/tic6x-tdep.c      |  2 +-
 gdb/tilegx-tdep.c     |  2 +-
 gdb/v850-tdep.c       |  4 ++--
 gdb/xstormy16-tdep.c  |  2 +-
 gdb/z80-tdep.c        |  2 +-
 29 files changed, 32 insertions(+), 43 deletions(-)

diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 4e55b2797b9..3fa4bea52b4 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -1387,7 +1387,7 @@ gdbarch_register (enum bfd_architecture bfd_architecture,
     }
   /* log it */
   if (gdbarch_debug)
-    gdb_printf (gdb_stdlog, "register_gdbarch_init (%s, %s)\n",
+    gdb_printf (gdb_stdlog, "gdbarch_register (%s, %s)\n",
 		bfd_arch_info->printable_name,
 		host_address_to_string (init));
   /* Append it */
@@ -1399,14 +1399,6 @@ gdbarch_register (enum bfd_architecture bfd_architecture,
   (*curr)->next = NULL;
 }
 
-void
-register_gdbarch_init (enum bfd_architecture bfd_architecture,
-		       gdbarch_init_ftype *init)
-{
-  gdbarch_register (bfd_architecture, init, NULL);
-}
-
-
 /* Look for an architecture using gdbarch_info.  */
 
 struct gdbarch_list *
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index 357f5bb8f2d..693d563b911 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -1633,7 +1633,7 @@ void _initialize_avr_tdep ();
 void
 _initialize_avr_tdep ()
 {
-  register_gdbarch_init (bfd_arch_avr, avr_gdbarch_init);
+  gdbarch_register (bfd_arch_avr, avr_gdbarch_init);
 
   /* Add a new command to allow the user to query the avr remote target for
      the values of the io space registers in a saner way than just using
diff --git a/gdb/bfin-tdep.c b/gdb/bfin-tdep.c
index f232e22c37c..3e801a982a8 100644
--- a/gdb/bfin-tdep.c
+++ b/gdb/bfin-tdep.c
@@ -842,5 +842,5 @@ void _initialize_bfin_tdep ();
 void
 _initialize_bfin_tdep ()
 {
-  register_gdbarch_init (bfd_arch_bfin, bfin_gdbarch_init);
+  gdbarch_register (bfd_arch_bfin, bfin_gdbarch_init);
 }
diff --git a/gdb/bpf-tdep.c b/gdb/bpf-tdep.c
index a5df478063c..4c085093632 100644
--- a/gdb/bpf-tdep.c
+++ b/gdb/bpf-tdep.c
@@ -374,7 +374,7 @@ void _initialize_bpf_tdep ();
 void
 _initialize_bpf_tdep ()
 {
-  register_gdbarch_init (bfd_arch_bpf, bpf_gdbarch_init);
+  gdbarch_register (bfd_arch_bpf, bpf_gdbarch_init);
 
   /* Add commands 'set/show debug bpf'.  */
   add_setshow_zuinteger_cmd ("bpf", class_maintenance,
diff --git a/gdb/csky-tdep.c b/gdb/csky-tdep.c
index 01d4a0f28cb..ba53c1b10ca 100644
--- a/gdb/csky-tdep.c
+++ b/gdb/csky-tdep.c
@@ -3053,7 +3053,7 @@ void
 _initialize_csky_tdep ()
 {
 
-  register_gdbarch_init (bfd_arch_csky, csky_gdbarch_init);
+  gdbarch_register (bfd_arch_csky, csky_gdbarch_init);
 
   csky_init_reggroup ();
 
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index 55a6cfd9618..8029080c043 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -1575,5 +1575,5 @@ void _initialize_frv_tdep ();
 void
 _initialize_frv_tdep ()
 {
-  register_gdbarch_init (bfd_arch_frv, frv_gdbarch_init);
+  gdbarch_register (bfd_arch_frv, frv_gdbarch_init);
 }
diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c
index 024ca47ce4d..500c691aa34 100644
--- a/gdb/ft32-tdep.c
+++ b/gdb/ft32-tdep.c
@@ -625,5 +625,5 @@ void _initialize_ft32_tdep ();
 void
 _initialize_ft32_tdep ()
 {
-  register_gdbarch_init (bfd_arch_ft32, ft32_gdbarch_init);
+  gdbarch_register (bfd_arch_ft32, ft32_gdbarch_init);
 }
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 324958469a7..d6bcc306863 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -270,12 +270,9 @@ struct gdbarch_info
 typedef struct gdbarch *(gdbarch_init_ftype) (struct gdbarch_info info, struct gdbarch_list *arches);
 typedef void (gdbarch_dump_tdep_ftype) (struct gdbarch *gdbarch, struct ui_file *file);
 
-/* DEPRECATED - use gdbarch_register() */
-extern void register_gdbarch_init (enum bfd_architecture architecture, gdbarch_init_ftype *);
-
 extern void gdbarch_register (enum bfd_architecture architecture,
-			      gdbarch_init_ftype *,
-			      gdbarch_dump_tdep_ftype *);
+			      gdbarch_init_ftype *init,
+			      gdbarch_dump_tdep_ftype *dump_tdep = nullptr);
 
 
 /* Return a vector of the valid architecture names.  Since architectures are
diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c
index c4d9824ffda..d453fce3319 100644
--- a/gdb/h8300-tdep.c
+++ b/gdb/h8300-tdep.c
@@ -1383,7 +1383,7 @@ void _initialize_h8300_tdep ();
 void
 _initialize_h8300_tdep ()
 {
-  register_gdbarch_init (bfd_arch_h8300, h8300_gdbarch_init);
+  gdbarch_register (bfd_arch_h8300, h8300_gdbarch_init);
 }
 
 static int
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index d500f6998c5..7fd0978cb4a 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -9070,7 +9070,7 @@ void _initialize_i386_tdep ();
 void
 _initialize_i386_tdep ()
 {
-  register_gdbarch_init (bfd_arch_i386, i386_gdbarch_init);
+  gdbarch_register (bfd_arch_i386, i386_gdbarch_init);
 
   /* Add the variable that controls the disassembly flavor.  */
   add_setshow_enum_cmd ("disassembly-flavor", no_class, valid_flavors,
diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c
index 42fcc46ac85..e5fe1c62466 100644
--- a/gdb/iq2000-tdep.c
+++ b/gdb/iq2000-tdep.c
@@ -844,5 +844,5 @@ void _initialize_iq2000_tdep ();
 void
 _initialize_iq2000_tdep ()
 {
-  register_gdbarch_init (bfd_arch_iq2000, iq2000_gdbarch_init);
+  gdbarch_register (bfd_arch_iq2000, iq2000_gdbarch_init);
 }
diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c
index 4cbff537fab..af322511cfa 100644
--- a/gdb/lm32-tdep.c
+++ b/gdb/lm32-tdep.c
@@ -539,5 +539,5 @@ void _initialize_lm32_tdep ();
 void
 _initialize_lm32_tdep ()
 {
-  register_gdbarch_init (bfd_arch_lm32, lm32_gdbarch_init);
+  gdbarch_register (bfd_arch_lm32, lm32_gdbarch_init);
 }
diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c
index 30f716b6969..83b7432f491 100644
--- a/gdb/m32c-tdep.c
+++ b/gdb/m32c-tdep.c
@@ -2658,7 +2658,7 @@ void _initialize_m32c_tdep ();
 void
 _initialize_m32c_tdep ()
 {
-  register_gdbarch_init (bfd_arch_m32c, m32c_gdbarch_init);
+  gdbarch_register (bfd_arch_m32c, m32c_gdbarch_init);
 
   m32c_dma_reggroup = reggroup_new ("dma", USER_REGGROUP);
 }
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
index 3ad4c8de6bf..7edbd500bc5 100644
--- a/gdb/m32r-tdep.c
+++ b/gdb/m32r-tdep.c
@@ -916,5 +916,5 @@ void _initialize_m32r_tdep ();
 void
 _initialize_m32r_tdep ()
 {
-  register_gdbarch_init (bfd_arch_m32r, m32r_gdbarch_init);
+  gdbarch_register (bfd_arch_m32r, m32r_gdbarch_init);
 }
diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c
index 7ea1f9a5b91..53b7752f073 100644
--- a/gdb/m68hc11-tdep.c
+++ b/gdb/m68hc11-tdep.c
@@ -1533,8 +1533,8 @@ void _initialize_m68hc11_tdep ();
 void
 _initialize_m68hc11_tdep ()
 {
-  register_gdbarch_init (bfd_arch_m68hc11, m68hc11_gdbarch_init);
-  register_gdbarch_init (bfd_arch_m68hc12, m68hc11_gdbarch_init);
+  gdbarch_register (bfd_arch_m68hc11, m68hc11_gdbarch_init);
+  gdbarch_register (bfd_arch_m68hc12, m68hc11_gdbarch_init);
   m68hc11_init_reggroups ();
 } 
 
diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c
index 170b4b07460..66b7656b3d5 100644
--- a/gdb/mep-tdep.c
+++ b/gdb/mep-tdep.c
@@ -2463,7 +2463,7 @@ _initialize_mep_tdep ()
   mep_cr_reggroup  = reggroup_new ("cr", USER_REGGROUP); 
   mep_ccr_reggroup = reggroup_new ("ccr", USER_REGGROUP);
 
-  register_gdbarch_init (bfd_arch_mep, mep_gdbarch_init);
+  gdbarch_register (bfd_arch_mep, mep_gdbarch_init);
 
   mep_init_pseudoregister_maps ();
 }
diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
index 3d5dd669341..3525453deeb 100644
--- a/gdb/microblaze-tdep.c
+++ b/gdb/microblaze-tdep.c
@@ -742,7 +742,7 @@ void _initialize_microblaze_tdep ();
 void
 _initialize_microblaze_tdep ()
 {
-  register_gdbarch_init (bfd_arch_microblaze, microblaze_gdbarch_init);
+  gdbarch_register (bfd_arch_microblaze, microblaze_gdbarch_init);
 
   initialize_tdesc_microblaze_with_stack_protect ();
   initialize_tdesc_microblaze ();
diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c
index f5cf501cea0..77e1c33ecb6 100644
--- a/gdb/moxie-tdep.c
+++ b/gdb/moxie-tdep.c
@@ -1108,5 +1108,5 @@ void _initialize_moxie_tdep ();
 void
 _initialize_moxie_tdep ()
 {
-  register_gdbarch_init (bfd_arch_moxie, moxie_gdbarch_init);
+  gdbarch_register (bfd_arch_moxie, moxie_gdbarch_init);
 }
diff --git a/gdb/msp430-tdep.c b/gdb/msp430-tdep.c
index cf4106d1a34..35bea093076 100644
--- a/gdb/msp430-tdep.c
+++ b/gdb/msp430-tdep.c
@@ -996,5 +996,5 @@ void _initialize_msp430_tdep ();
 void
 _initialize_msp430_tdep ()
 {
-  register_gdbarch_init (bfd_arch_msp430, msp430_gdbarch_init);
+  gdbarch_register (bfd_arch_msp430, msp430_gdbarch_init);
 }
diff --git a/gdb/nds32-tdep.c b/gdb/nds32-tdep.c
index 11bfd2d1f54..5b555236d46 100644
--- a/gdb/nds32-tdep.c
+++ b/gdb/nds32-tdep.c
@@ -2093,7 +2093,7 @@ void
 _initialize_nds32_tdep ()
 {
   /* Initialize gdbarch.  */
-  register_gdbarch_init (bfd_arch_nds32, nds32_gdbarch_init);
+  gdbarch_register (bfd_arch_nds32, nds32_gdbarch_init);
 
   initialize_tdesc_nds32 ();
   nds32_init_reggroups ();
diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c
index be668bfa6fe..3920fa12265 100644
--- a/gdb/rl78-tdep.c
+++ b/gdb/rl78-tdep.c
@@ -1489,5 +1489,5 @@ void _initialize_rl78_tdep ();
 void
 _initialize_rl78_tdep ()
 {
-  register_gdbarch_init (bfd_arch_rl78, rl78_gdbarch_init);
+  gdbarch_register (bfd_arch_rl78, rl78_gdbarch_init);
 }
diff --git a/gdb/rx-tdep.c b/gdb/rx-tdep.c
index 989d90096bd..c7e7c3fde2f 100644
--- a/gdb/rx-tdep.c
+++ b/gdb/rx-tdep.c
@@ -1063,6 +1063,6 @@ void _initialize_rx_tdep ();
 void
 _initialize_rx_tdep ()
 {
-  register_gdbarch_init (bfd_arch_rx, rx_gdbarch_init);
+  gdbarch_register (bfd_arch_rx, rx_gdbarch_init);
   initialize_tdesc_rx ();
 }
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index 2aeb3a14637..7f0ed65c8d2 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -7229,7 +7229,7 @@ void
 _initialize_s390_tdep ()
 {
   /* Hook us into the gdbarch mechanism.  */
-  register_gdbarch_init (bfd_arch_s390, s390_gdbarch_init);
+  gdbarch_register (bfd_arch_s390, s390_gdbarch_init);
 
   initialize_tdesc_s390_linux32 ();
   initialize_tdesc_s390x_linux64 ();
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 397f5489550..0f5da2c393a 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -2269,5 +2269,5 @@ void _initialize_sparc_tdep ();
 void
 _initialize_sparc_tdep ()
 {
-  register_gdbarch_init (bfd_arch_sparc, sparc32_gdbarch_init);
+  gdbarch_register (bfd_arch_sparc, sparc32_gdbarch_init);
 }
diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c
index b7efcf18576..77576834733 100644
--- a/gdb/tic6x-tdep.c
+++ b/gdb/tic6x-tdep.c
@@ -1302,5 +1302,5 @@ void _initialize_tic6x_tdep ();
 void
 _initialize_tic6x_tdep ()
 {
-  register_gdbarch_init (bfd_arch_tic6x, tic6x_gdbarch_init);
+  gdbarch_register (bfd_arch_tic6x, tic6x_gdbarch_init);
 }
diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c
index 9668aa80b53..744aca96438 100644
--- a/gdb/tilegx-tdep.c
+++ b/gdb/tilegx-tdep.c
@@ -1028,5 +1028,5 @@ void _initialize_tilegx_tdep ();
 void
 _initialize_tilegx_tdep ()
 {
-  register_gdbarch_init (bfd_arch_tilegx, tilegx_gdbarch_init);
+  gdbarch_register (bfd_arch_tilegx, tilegx_gdbarch_init);
 }
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index f7094e37a92..232b92d0a08 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -1465,6 +1465,6 @@ void _initialize_v850_tdep ();
 void
 _initialize_v850_tdep ()
 {
-  register_gdbarch_init (bfd_arch_v850, v850_gdbarch_init);
-  register_gdbarch_init (bfd_arch_v850_rh850, v850_gdbarch_init);
+  gdbarch_register (bfd_arch_v850, v850_gdbarch_init);
+  gdbarch_register (bfd_arch_v850_rh850, v850_gdbarch_init);
 }
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index c0fe5dab1cb..10c0d3e6b1c 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -838,5 +838,5 @@ void _initialize_xstormy16_tdep ();
 void
 _initialize_xstormy16_tdep ()
 {
-  register_gdbarch_init (bfd_arch_xstormy16, xstormy16_gdbarch_init);
+  gdbarch_register (bfd_arch_xstormy16, xstormy16_gdbarch_init);
 }
diff --git a/gdb/z80-tdep.c b/gdb/z80-tdep.c
index 1ab375c5014..684f08303c4 100644
--- a/gdb/z80-tdep.c
+++ b/gdb/z80-tdep.c
@@ -1460,6 +1460,6 @@ extern initialize_file_ftype _initialize_z80_tdep;
 void
 _initialize_z80_tdep ()
 {
-  register_gdbarch_init (bfd_arch_z80, z80_gdbarch_init);
+  gdbarch_register (bfd_arch_z80, z80_gdbarch_init);
   initialize_tdesc_z80 ();
 }
-- 
2.34.1



More information about the Gdb-patches mailing list