Remove parameter from language_info

Message ID 20210329142606.2501921-1-tromey@adacore.com
State New
Headers show
Series
  • Remove parameter from language_info
Related show

Commit Message

Tom Tromey March 29, 2021, 2:26 p.m.
I noticed that language_info is only ever called with a value of '1'.
This patch removes the parameter.

gdb/ChangeLog
2021-03-29  Tom Tromey  <tromey@adacore.com>

	* top.c (check_frame_language_change): Update.
	* language.c (language_info): Remove parameter.
	* language.h (language_info): Remove parameter.
---
 gdb/ChangeLog  |  6 ++++++
 gdb/language.c | 14 +++-----------
 gdb/language.h |  2 +-
 gdb/top.c      |  3 ++-
 4 files changed, 12 insertions(+), 13 deletions(-)

-- 
2.26.2

Comments

Keith Seitz via Gdb-patches March 29, 2021, 2:38 p.m. | #1
On 2021-03-29 10:26 a.m., Tom Tromey wrote:
> I noticed that language_info is only ever called with a value of '1'.

> This patch removes the parameter.

> 

> gdb/ChangeLog

> 2021-03-29  Tom Tromey  <tromey@adacore.com>

> 

> 	* top.c (check_frame_language_change): Update.

> 	* language.c (language_info): Remove parameter.

> 	* language.h (language_info): Remove parameter.

> ---

>  gdb/ChangeLog  |  6 ++++++

>  gdb/language.c | 14 +++-----------

>  gdb/language.h |  2 +-

>  gdb/top.c      |  3 ++-

>  4 files changed, 12 insertions(+), 13 deletions(-)

> 

> diff --git a/gdb/language.c b/gdb/language.c

> index f38d64f28d7..872f2553b22 100644

> --- a/gdb/language.c

> +++ b/gdb/language.c

> @@ -375,25 +375,17 @@ set_language (enum language lang)

>  

>  

>  /* Print out the current language settings: language, range and

> -   type checking.  If QUIETLY, print only what has changed.  */

> +   type checking.  */

>  

>  void

> -language_info (int quietly)

> +language_info ()

>  {

> -  if (quietly && expected_language == current_language)

> +  if (expected_language == current_language)

>      return;

>  

>    expected_language = current_language;

>    printf_unfiltered (_("Current language:  %s\n"), language);

>    show_language_command (NULL, 1, NULL, NULL);

> -

> -  if (!quietly)

> -    {

> -      printf_unfiltered (_("Range checking:    %s\n"), range);

> -      show_range_command (NULL, 1, NULL, NULL);

> -      printf_unfiltered (_("Case sensitivity:  %s\n"), case_sensitive);

> -      show_case_command (NULL, 1, NULL, NULL);

> -    }

>  }

>  

>  

> diff --git a/gdb/language.h b/gdb/language.h

> index 5afb8335961..b62ff845123 100644

> --- a/gdb/language.h

> +++ b/gdb/language.h

> @@ -733,7 +733,7 @@ struct symbol *

>  				  (LANG)->la_language == language_cplus || \

>  				  (LANG)->la_language == language_objc)

>  

> -extern void language_info (int);

> +extern void language_info ();

>  

>  extern enum language set_language (enum language);

>  

> diff --git a/gdb/top.c b/gdb/top.c

> index 31b751fa262..6dd2fe8a3b0 100644

> --- a/gdb/top.c

> +++ b/gdb/top.c

> @@ -482,7 +482,8 @@ check_frame_language_change (void)

>      {

>        if (language_mode == language_mode_auto && info_verbose)

>  	{

> -	  language_info (1);	/* Print what changed.  */

> +	  /* Print what changed.  */

> +	  language_info ();

>  	}

>        warned = 0;

>      }

> 


Thanks, that LGTM (obvious even).  I would suggest moving the function
comment to the header at the same time.

Simon
Tom Tromey March 29, 2021, 3:35 p.m. | #2
>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:


Simon> Thanks, that LGTM (obvious even).  I would suggest moving the function
Simon> comment to the header at the same time.

Good idea.  I made this change and now I'm checking it in.

Tom

Patch

diff --git a/gdb/language.c b/gdb/language.c
index f38d64f28d7..872f2553b22 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -375,25 +375,17 @@  set_language (enum language lang)
 
 
 /* Print out the current language settings: language, range and
-   type checking.  If QUIETLY, print only what has changed.  */
+   type checking.  */
 
 void
-language_info (int quietly)
+language_info ()
 {
-  if (quietly && expected_language == current_language)
+  if (expected_language == current_language)
     return;
 
   expected_language = current_language;
   printf_unfiltered (_("Current language:  %s\n"), language);
   show_language_command (NULL, 1, NULL, NULL);
-
-  if (!quietly)
-    {
-      printf_unfiltered (_("Range checking:    %s\n"), range);
-      show_range_command (NULL, 1, NULL, NULL);
-      printf_unfiltered (_("Case sensitivity:  %s\n"), case_sensitive);
-      show_case_command (NULL, 1, NULL, NULL);
-    }
 }
 
 
diff --git a/gdb/language.h b/gdb/language.h
index 5afb8335961..b62ff845123 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -733,7 +733,7 @@  struct symbol *
 				  (LANG)->la_language == language_cplus || \
 				  (LANG)->la_language == language_objc)
 
-extern void language_info (int);
+extern void language_info ();
 
 extern enum language set_language (enum language);
 
diff --git a/gdb/top.c b/gdb/top.c
index 31b751fa262..6dd2fe8a3b0 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -482,7 +482,8 @@  check_frame_language_change (void)
     {
       if (language_mode == language_mode_auto && info_verbose)
 	{
-	  language_info (1);	/* Print what changed.  */
+	  /* Print what changed.  */
+	  language_info ();
 	}
       warned = 0;
     }