Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH 6/6] Remove the auto_charset gdbarch hook
Date: Mon, 04 Nov 2024 14:14:16 -0700	[thread overview]
Message-ID: <20241104-check-unused-gdbarch-v1-6-7082f2121077@tromey.com> (raw)
In-Reply-To: <20241104-check-unused-gdbarch-v1-0-7082f2121077@tromey.com>

The auto_charset gdbarch hook has never been set by any architecture.
I probably added it (don't remember) to be parallel to
auto_wide_charset -- but considering that it hasn't ever been needed,
it seems fine to remove it.
---
 gdb/arch-utils.h          |  1 -
 gdb/charset.c             |  9 +++++----
 gdb/gdbarch-gen.c         | 22 ----------------------
 gdb/gdbarch-gen.h         |  6 ------
 gdb/gdbarch_components.py | 11 -----------
 5 files changed, 5 insertions(+), 44 deletions(-)

diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h
index 39094a0bf3e2e121c7df67a64d530ca6c471f661..807ab96ca4edad319cd42b7ff45768ef91a45a67 100644
--- a/gdb/arch-utils.h
+++ b/gdb/arch-utils.h
@@ -236,7 +236,6 @@ extern void default_gen_return_address (struct gdbarch *gdbarch,
 					struct axs_value *value,
 					CORE_ADDR scope);
 
-extern const char *default_auto_charset (void);
 extern const char *default_auto_wide_charset (void);
 
 extern int default_return_in_first_hidden_param_p (struct gdbarch *,
diff --git a/gdb/charset.c b/gdb/charset.c
index 35e700a8caf71fffffe5b06081f08d964d2d6bce..04c424b7fb5fca50b310340c8394b70c1868d342 100644
--- a/gdb/charset.c
+++ b/gdb/charset.c
@@ -216,6 +216,7 @@ gdb_iconv (iconv_t utf_flag, ICONV_CONST char **inbuf, size_t *inbytesleft,
 \f
 /* The global lists of character sets and translations.  */
 
+static const char *default_auto_charset ();
 
 #ifndef GDB_DEFAULT_TARGET_CHARSET
 #define GDB_DEFAULT_TARGET_CHARSET "ISO-8859-1"
@@ -249,7 +250,7 @@ show_target_charset_name (struct ui_file *file, int from_tty,
     gdb_printf (file,
 		_("The target character set is \"auto; "
 		  "currently %s\".\n"),
-		gdbarch_auto_charset (get_current_arch ()));
+		default_auto_charset ());
   else
     gdb_printf (file, _("The target character set is \"%s\".\n"),
 		value);
@@ -425,7 +426,7 @@ const char *
 target_charset (struct gdbarch *gdbarch)
 {
   if (!strcmp (target_charset_name, "auto"))
-    return gdbarch_auto_charset (gdbarch);
+    return default_auto_charset ();
   return target_charset_name;
 }
 
@@ -917,8 +918,8 @@ find_charset_names (void)
 /* The "auto" target charset used by default_auto_charset.  */
 static const char *auto_target_charset_name = GDB_DEFAULT_TARGET_CHARSET;
 
-const char *
-default_auto_charset (void)
+static const char *
+default_auto_charset ()
 {
   return auto_target_charset_name;
 }
diff --git a/gdb/gdbarch-gen.c b/gdb/gdbarch-gen.c
index 47f068967cce0e44f1e3e6a5b7eee485320ae705..4c3b9b7f9e27e853f4b6a52cf46c65173e252cef 100644
--- a/gdb/gdbarch-gen.c
+++ b/gdb/gdbarch-gen.c
@@ -228,7 +228,6 @@ struct gdbarch
   gdbarch_has_shared_address_space_ftype *has_shared_address_space = default_has_shared_address_space;
   gdbarch_fast_tracepoint_valid_at_ftype *fast_tracepoint_valid_at = default_fast_tracepoint_valid_at;
   gdbarch_guess_tracepoint_registers_ftype *guess_tracepoint_registers = default_guess_tracepoint_registers;
-  gdbarch_auto_charset_ftype *auto_charset = default_auto_charset;
   gdbarch_auto_wide_charset_ftype *auto_wide_charset = default_auto_wide_charset;
   int has_dos_based_file_system = 0;
   gdbarch_gen_return_address_ftype *gen_return_address = default_gen_return_address;
@@ -494,7 +493,6 @@ verify_gdbarch (struct gdbarch *gdbarch)
   /* Skip verify of has_shared_address_space, invalid_p == 0.  */
   /* Skip verify of fast_tracepoint_valid_at, invalid_p == 0.  */
   /* Skip verify of guess_tracepoint_registers, invalid_p == 0.  */
-  /* Skip verify of auto_charset, invalid_p == 0.  */
   /* Skip verify of auto_wide_charset, invalid_p == 0.  */
   /* Skip verify of has_dos_based_file_system, invalid_p == 0.  */
   /* Skip verify of gen_return_address, invalid_p == 0.  */
@@ -1260,9 +1258,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
   gdb_printf (file,
 	      "gdbarch_dump: guess_tracepoint_registers = <%s>\n",
 	      host_address_to_string (gdbarch->guess_tracepoint_registers));
-  gdb_printf (file,
-	      "gdbarch_dump: auto_charset = <%s>\n",
-	      host_address_to_string (gdbarch->auto_charset));
   gdb_printf (file,
 	      "gdbarch_dump: auto_wide_charset = <%s>\n",
 	      host_address_to_string (gdbarch->auto_wide_charset));
@@ -4847,23 +4842,6 @@ set_gdbarch_guess_tracepoint_registers (struct gdbarch *gdbarch,
   gdbarch->guess_tracepoint_registers = guess_tracepoint_registers;
 }
 
-const char *
-gdbarch_auto_charset (struct gdbarch *gdbarch)
-{
-  gdb_assert (gdbarch != NULL);
-  gdb_assert (gdbarch->auto_charset != NULL);
-  if (gdbarch_debug >= 2)
-    gdb_printf (gdb_stdlog, "gdbarch_auto_charset called\n");
-  return gdbarch->auto_charset ();
-}
-
-void
-set_gdbarch_auto_charset (struct gdbarch *gdbarch,
-			  gdbarch_auto_charset_ftype auto_charset)
-{
-  gdbarch->auto_charset = auto_charset;
-}
-
 const char *
 gdbarch_auto_wide_charset (struct gdbarch *gdbarch)
 {
diff --git a/gdb/gdbarch-gen.h b/gdb/gdbarch-gen.h
index d96bbe94f07b17a5ed173bdf20b3bfee7ff70cfa..4f7544c97b5ea2a6878d80dc253a04c2428551ed 100644
--- a/gdb/gdbarch-gen.h
+++ b/gdb/gdbarch-gen.h
@@ -1517,12 +1517,6 @@ typedef void (gdbarch_guess_tracepoint_registers_ftype) (struct gdbarch *gdbarch
 extern void gdbarch_guess_tracepoint_registers (struct gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr);
 extern void set_gdbarch_guess_tracepoint_registers (struct gdbarch *gdbarch, gdbarch_guess_tracepoint_registers_ftype *guess_tracepoint_registers);
 
-/* Return the "auto" target charset. */
-
-typedef const char * (gdbarch_auto_charset_ftype) ();
-extern const char * gdbarch_auto_charset (struct gdbarch *gdbarch);
-extern void set_gdbarch_auto_charset (struct gdbarch *gdbarch, gdbarch_auto_charset_ftype *auto_charset);
-
 /* Return the "auto" target wide charset. */
 
 typedef const char * (gdbarch_auto_wide_charset_ftype) ();
diff --git a/gdb/gdbarch_components.py b/gdb/gdbarch_components.py
index 78d9521154f629740bced42a44300c20a1e2b2cb..ca8731c69cf2d27d5a30654fdc5edde508a96564 100644
--- a/gdb/gdbarch_components.py
+++ b/gdb/gdbarch_components.py
@@ -2399,17 +2399,6 @@ On entry, regcache has all registers marked as unavailable.
     invalid=False,
 )
 
-Function(
-    comment="""
-Return the "auto" target charset.
-""",
-    type="const char *",
-    name="auto_charset",
-    params=[],
-    predefault="default_auto_charset",
-    invalid=False,
-)
-
 Function(
     comment="""
 Return the "auto" target wide charset.

-- 
2.46.1


  parent reply	other threads:[~2024-11-04 21:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-04 21:14 [PATCH 0/6] Add gdbarch-checking script Tom Tromey
2024-11-04 21:14 ` [PATCH 1/6] Add check-gdbarch.py Tom Tromey
2024-12-05 22:47   ` Keith Seitz
2024-11-04 21:14 ` [PATCH 2/6] Use 'invalid' rather than 'predicate' in some gdbarch functions Tom Tromey
2024-11-04 21:14 ` [PATCH 3/6] Remove solib_symbols_extension gdbarch hook Tom Tromey
2024-11-04 21:14 ` [PATCH 4/6] Remove skip_permanent_breakpoint " Tom Tromey
2024-11-04 21:14 ` [PATCH 5/6] Remove the print_vector_info " Tom Tromey
2024-12-05 22:49   ` Keith Seitz
2024-11-04 21:14 ` Tom Tromey [this message]
2024-12-05 22:50 ` [PATCH 0/6] Add gdbarch-checking script Keith Seitz
2024-12-06  2:58   ` Sergio Durigan Junior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241104-check-unused-gdbarch-v1-6-7082f2121077@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox