Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Fix -Wformat-extra-args warning.
@ 2012-11-26  9:24 Yao Qi
  2012-11-26  9:37 ` Joel Brobecker
  0 siblings, 1 reply; 3+ messages in thread
From: Yao Qi @ 2012-11-26  9:24 UTC (permalink / raw)
  To: gdb-patches

Hi,
When compile gdb with clang, the following warning is reported,

  git/gdb/symtab.c:3784:24: error: data argument not used by format string [-Werror,-Wformat-extra-args]

It is obvious to me, but review is still welcome.

gdb:

2012-11-26  Yao Qi  <yao@codesourcery.com>

	* symtab.c (symtab_symbol_info): Fix a -Wformat-extra-args
	warning.
---
 gdb/symtab.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/gdb/symtab.c b/gdb/symtab.c
index 05943cf..e8cd861 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -3778,10 +3778,11 @@ symtab_symbol_info (char *regexp, enum search_domain kind, int from_tty)
   search_symbols (regexp, kind, 0, (char **) NULL, &symbols);
   old_chain = make_cleanup_free_search_symbols (symbols);
 
-  printf_filtered (regexp
-		   ? "All %ss matching regular expression \"%s\":\n"
-		   : "All defined %ss:\n",
-		   classnames[kind], regexp);
+  if (regexp != NULL)
+    printf_filtered ("All %ss matching regular expression \"%s\":\n",
+		     classnames[kind], regexp);
+  else
+    printf_filtered ("All defined %ss:\n", classnames[kind]);
 
   for (p = symbols; p != NULL; p = p->next)
     {
-- 
1.7.7.6


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix -Wformat-extra-args warning.
  2012-11-26  9:24 [PATCH] Fix -Wformat-extra-args warning Yao Qi
@ 2012-11-26  9:37 ` Joel Brobecker
  2012-11-27  7:26   ` Yao Qi
  0 siblings, 1 reply; 3+ messages in thread
From: Joel Brobecker @ 2012-11-26  9:37 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

Thanks for doing all those cleanups!

> 2012-11-26  Yao Qi  <yao@codesourcery.com>
> 
> 	* symtab.c (symtab_symbol_info): Fix a -Wformat-extra-args
> 	warning.

Your version does look much better to me also, by a mile. I do think
you need i18n, though. OK with the _() mark up.

> ---
>  gdb/symtab.c |    9 +++++----
>  1 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/gdb/symtab.c b/gdb/symtab.c
> index 05943cf..e8cd861 100644
> --- a/gdb/symtab.c
> +++ b/gdb/symtab.c
> @@ -3778,10 +3778,11 @@ symtab_symbol_info (char *regexp, enum search_domain kind, int from_tty)
>    search_symbols (regexp, kind, 0, (char **) NULL, &symbols);
>    old_chain = make_cleanup_free_search_symbols (symbols);
>  
> -  printf_filtered (regexp
> -		   ? "All %ss matching regular expression \"%s\":\n"
> -		   : "All defined %ss:\n",
> -		   classnames[kind], regexp);
> +  if (regexp != NULL)
> +    printf_filtered ("All %ss matching regular expression \"%s\":\n",
> +		     classnames[kind], regexp);
> +  else
> +    printf_filtered ("All defined %ss:\n", classnames[kind]);
>  
>    for (p = symbols; p != NULL; p = p->next)
>      {

-- 
Joel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix -Wformat-extra-args warning.
  2012-11-26  9:37 ` Joel Brobecker
@ 2012-11-27  7:26   ` Yao Qi
  0 siblings, 0 replies; 3+ messages in thread
From: Yao Qi @ 2012-11-27  7:26 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

On 11/26/2012 05:37 PM, Joel Brobecker wrote:
> Thanks for doing all those cleanups!
> 
>> >2012-11-26  Yao Qi<yao@codesourcery.com>
>> >
>> >	* symtab.c (symtab_symbol_info): Fix a -Wformat-extra-args
>> >	warning.
> Your version does look much better to me also, by a mile. I do think
> you need i18n, though. OK with the _() mark up.
> 

I noticed another i18n markup is missing in some lines below, so get it
fix together in this patch.  Below is what I committed.

-- 
Yao (齐尧)

gdb:

2012-11-27  Yao Qi  <yao@codesourcery.com>

	* symtab.c (symtab_symbol_info): Fix a -Wformat-extra-args
	warning.
	Add i18n markup.
---
 gdb/symtab.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/gdb/symtab.c b/gdb/symtab.c
index 05943cf..c4bd13d 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -3778,10 +3778,11 @@ symtab_symbol_info (char *regexp, enum search_domain kind, int from_tty)
   search_symbols (regexp, kind, 0, (char **) NULL, &symbols);
   old_chain = make_cleanup_free_search_symbols (symbols);
 
-  printf_filtered (regexp
-		   ? "All %ss matching regular expression \"%s\":\n"
-		   : "All defined %ss:\n",
-		   classnames[kind], regexp);
+  if (regexp != NULL)
+    printf_filtered (_("All %ss matching regular expression \"%s\":\n"),
+		     classnames[kind], regexp);
+  else
+    printf_filtered (_("All defined %ss:\n"), classnames[kind]);
 
   for (p = symbols; p != NULL; p = p->next)
     {
@@ -3791,7 +3792,7 @@ symtab_symbol_info (char *regexp, enum search_domain kind, int from_tty)
 	{
 	  if (first)
 	    {
-	      printf_filtered ("\nNon-debugging symbols:\n");
+	      printf_filtered (_("\nNon-debugging symbols:\n"));
 	      first = 0;
 	    }
 	  print_msymbol_info (p->msymbol);
-- 
1.7.7.6


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-11-27  7:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-26  9:24 [PATCH] Fix -Wformat-extra-args warning Yao Qi
2012-11-26  9:37 ` Joel Brobecker
2012-11-27  7:26   ` Yao Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox