Fix few -Wformat-diag warnings.

Message ID 5b07a3ce-9688-7f94-98e4-f6ed628735e9@suse.cz
State New
Headers show
Series
  • Fix few -Wformat-diag warnings.
Related show

Commit Message

Martin Liška June 11, 2020, 8:43 a.m.
Ready for master?

Thanks,
Martin

gcc/ChangeLog:

	* cgraphunit.c (process_symver_attribute): Wrap weakref keyword.
	* dbgcnt.c (dbg_cnt_set_limit_by_index): Do not print extra new
	line.
	* lto-wrapper.c (merge_and_complain): Wrap option names.
---
  gcc/cgraphunit.c  |  2 +-
  gcc/dbgcnt.c      |  2 +-
  gcc/lto-wrapper.c | 12 ++++++------
  3 files changed, 8 insertions(+), 8 deletions(-)

-- 
2.26.2

Comments

Bill Schmidt via Gcc-patches June 11, 2020, 4:34 p.m. | #1
On 6/11/20 2:43 AM, Martin Liška wrote:
> Ready for master?


I've been meaning to do some of this to resolve pr94982.  Thanks
a lot for taking the lead on it!  I'll try to get to it soon!

Martin

> 

> Thanks,

> Martin

> 

> gcc/ChangeLog:

> 

>      * cgraphunit.c (process_symver_attribute): Wrap weakref keyword.

>      * dbgcnt.c (dbg_cnt_set_limit_by_index): Do not print extra new

>      line.

>      * lto-wrapper.c (merge_and_complain): Wrap option names.

> ---

>   gcc/cgraphunit.c  |  2 +-

>   gcc/dbgcnt.c      |  2 +-

>   gcc/lto-wrapper.c | 12 ++++++------

>   3 files changed, 8 insertions(+), 8 deletions(-)

> 

> diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c

> index 01b3f82a4b2..ea9a34bda6f 100644

> --- a/gcc/cgraphunit.c

> +++ b/gcc/cgraphunit.c

> @@ -762,7 +762,7 @@ process_symver_attribute (symtab_node *n)

>     if (n->weakref)

>       {

>         error_at (DECL_SOURCE_LOCATION (n->decl),

> -        "weakref cannot be versioned");

> +        "%<weakref%> cannot be versioned");

>         return;

>       }

>     if (!TREE_PUBLIC (n->decl))

> diff --git a/gcc/dbgcnt.c b/gcc/dbgcnt.c

> index b0dd893ed49..ae98a281d63 100644

> --- a/gcc/dbgcnt.c

> +++ b/gcc/dbgcnt.c

> @@ -126,7 +126,7 @@ dbg_cnt_set_limit_by_index (enum debug_counter 

> index, const char *name,

>         if (t1.first <= t2.second)

>       {

>         error ("Interval overlap of %<-fdbg-cnt=%s%>: [%u, %u] and "

> -         "[%u, %u]\n", name, t2.first, t2.second, t1.first, t1.second);

> +         "[%u, %u]", name, t2.first, t2.second, t1.first, t1.second);

>         return false;

>       }

>       }

> diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c

> index d565b0861f5..8fbca7cabc4 100644

> --- a/gcc/lto-wrapper.c

> +++ b/gcc/lto-wrapper.c

> @@ -508,24 +508,24 @@ merge_and_complain (struct cl_decoded_option 

> **decoded_options,

>         break;

>       else if (i < *decoded_options_count && j == fdecoded_options_count)

>         {

> -        warning (0, "Extra option to -Xassembler: %s,"

> -             " dropping all -Xassembler and -Wa options.",

> +        warning (0, "Extra option to %<-Xassembler%>: %s,"

> +             " dropping all %<-Xassembler%> and %<-Wa%> options.",

>                (*decoded_options)[i].arg);

>           xassembler_options_error = true;

>           break;

>         }

>       else if (i == *decoded_options_count && j < fdecoded_options_count)

>         {

> -        warning (0, "Extra option to -Xassembler: %s,"

> -             " dropping all -Xassembler and -Wa options.",

> +        warning (0, "Extra option to %<-Xassembler%>: %s,"

> +             " dropping all %<-Xassembler%> and %<-Wa%> options.",

>                fdecoded_options[j].arg);

>           xassembler_options_error = true;

>           break;

>         }

>       else if (strcmp ((*decoded_options)[i].arg, fdecoded_options[j].arg))

>         {

> -        warning (0, "Options to Xassembler do not match: %s, %s,"

> -             " dropping all -Xassembler and -Wa options.",

> +        warning (0, "Options to %<-Xassembler%> do not match: %s, %s,"

> +             " dropping all %<-Xassembler%> and %<-Wa%> options.",

>                (*decoded_options)[i].arg, fdecoded_options[j].arg);

>           xassembler_options_error = true;

>           break;
Bill Schmidt via Gcc-patches June 12, 2020, 3:15 a.m. | #2
On Thu, 2020-06-11 at 10:43 +0200, Martin Liška wrote:
> Ready for master?

> 

> Thanks,

> Martin

> 

> gcc/ChangeLog:

> 

> 	* cgraphunit.c (process_symver_attribute): Wrap weakref keyword.

> 	* dbgcnt.c (dbg_cnt_set_limit_by_index): Do not print extra new

> 	line.

> 	* lto-wrapper.c (merge_and_complain): Wrap option names.

OK.  And I think we should consider other changes of similar nature as pre-
approved.  Just run them through the usual regression testing.

Jeff
>

Patch

diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 01b3f82a4b2..ea9a34bda6f 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -762,7 +762,7 @@  process_symver_attribute (symtab_node *n)
    if (n->weakref)
      {
        error_at (DECL_SOURCE_LOCATION (n->decl),
-		"weakref cannot be versioned");
+		"%<weakref%> cannot be versioned");
        return;
      }
    if (!TREE_PUBLIC (n->decl))
diff --git a/gcc/dbgcnt.c b/gcc/dbgcnt.c
index b0dd893ed49..ae98a281d63 100644
--- a/gcc/dbgcnt.c
+++ b/gcc/dbgcnt.c
@@ -126,7 +126,7 @@  dbg_cnt_set_limit_by_index (enum debug_counter index, const char *name,
        if (t1.first <= t2.second)
  	{
  	  error ("Interval overlap of %<-fdbg-cnt=%s%>: [%u, %u] and "
-		 "[%u, %u]\n", name, t2.first, t2.second, t1.first, t1.second);
+		 "[%u, %u]", name, t2.first, t2.second, t1.first, t1.second);
  	  return false;
  	}
      }
diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
index d565b0861f5..8fbca7cabc4 100644
--- a/gcc/lto-wrapper.c
+++ b/gcc/lto-wrapper.c
@@ -508,24 +508,24 @@  merge_and_complain (struct cl_decoded_option **decoded_options,
  	  break;
  	else if (i < *decoded_options_count && j == fdecoded_options_count)
  	  {
-	    warning (0, "Extra option to -Xassembler: %s,"
-		     " dropping all -Xassembler and -Wa options.",
+	    warning (0, "Extra option to %<-Xassembler%>: %s,"
+		     " dropping all %<-Xassembler%> and %<-Wa%> options.",
  		     (*decoded_options)[i].arg);
  	    xassembler_options_error = true;
  	    break;
  	  }
  	else if (i == *decoded_options_count && j < fdecoded_options_count)
  	  {
-	    warning (0, "Extra option to -Xassembler: %s,"
-		     " dropping all -Xassembler and -Wa options.",
+	    warning (0, "Extra option to %<-Xassembler%>: %s,"
+		     " dropping all %<-Xassembler%> and %<-Wa%> options.",
  		     fdecoded_options[j].arg);
  	    xassembler_options_error = true;
  	    break;
  	  }
  	else if (strcmp ((*decoded_options)[i].arg, fdecoded_options[j].arg))
  	  {
-	    warning (0, "Options to Xassembler do not match: %s, %s,"
-		     " dropping all -Xassembler and -Wa options.",
+	    warning (0, "Options to %<-Xassembler%> do not match: %s, %s,"
+		     " dropping all %<-Xassembler%> and %<-Wa%> options.",
  		     (*decoded_options)[i].arg, fdecoded_options[j].arg);
  	    xassembler_options_error = true;
  	    break;