public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH 1/3] gdb: remove return value of set_language
Date: Tue, 18 Apr 2023 16:27:49 -0400	[thread overview]
Message-ID: <20230418202751.117181-2-simon.marchi@efficios.com> (raw)
In-Reply-To: <20230418202751.117181-1-simon.marchi@efficios.com>

set_language returns the previous language, but nothing uses it.  Remove
the return value.  This lets us remove the assignment to
current_language, in _initialize_language.

Change-Id: Ifccf9b488434c1addf4626130a74e159a37d8c17
---
 gdb/language.c | 14 ++------------
 gdb/language.h |  5 +++--
 2 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/gdb/language.c b/gdb/language.c
index fb065ef6a759..1ab356597d74 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -353,18 +353,13 @@ set_range_case (void)
     case_sensitivity = current_language->case_sensitivity ();
 }
 
-/* Set current language to (enum language) LANG.  Returns previous
-   language.  */
+/* See language.h.  */
 
-enum language
+void
 set_language (enum language lang)
 {
-  enum language prev_language;
-
-  prev_language = current_language->la_language;
   current_language = language_def (lang);
   set_range_case ();
-  return prev_language;
 }
 \f
 
@@ -1125,11 +1120,6 @@ For Fortran the default is off; for other languages the default is on."),
 			show_case_command,
 			&setlist, &showlist);
 
-  /* In order to call SET_LANGUAGE (below) we need to make sure that
-     CURRENT_LANGUAGE is not NULL.  So first set the language to unknown,
-     then we can change the language to 'auto'.  */
-  current_language = language_def (language_unknown);
-
   add_set_language_command ();
 
   /* Have the above take effect.  */
diff --git a/gdb/language.h b/gdb/language.h
index 57df8acd0a3b..4c91776d94dc 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -761,8 +761,9 @@ struct symbol *
 
 extern void language_info ();
 
-extern enum language set_language (enum language);
-\f
+/* Set the current language to LANG.  */
+
+extern void set_language (enum language lang);
 
 /* Test a character to decide whether it can be printed in literal form
    or needs to be printed in another representation.  For example,
-- 
2.40.0


  reply	other threads:[~2023-04-18 20:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-18 20:27 [PATCH 0/3] Some language cleanups Simon Marchi
2023-04-18 20:27 ` Simon Marchi [this message]
2023-04-18 20:27 ` [PATCH 2/3] gdb: switch "set language" to getter/setter Simon Marchi
2023-04-18 20:27 ` [PATCH 3/3] gdb: remove language_auto Simon Marchi
2023-04-21 14:26 ` [PATCH 0/3] Some language cleanups Tom Tromey
2023-04-21 18:10   ` Simon Marchi

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=20230418202751.117181-2-simon.marchi@efficios.com \
    --to=simon.marchi@efficios.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).