Patchwork Small color diagnostics tweak

login
register
mail settings
Submitter Jakub Jelinek
Date May 14, 2013, 6:52 p.m.
Message ID <20130514185248.GU1377@tucnak.redhat.com>
Download mbox | patch
Permalink /patch/243801/
State New
Headers show

Comments

Jakub Jelinek - May 14, 2013, 6:52 p.m.
Hi!

A few spots which print file:line or file:line:column info, but weren't
using locus color for it.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
also tested with ./xg++ -B ./ -S -fdiagnostics-color=auto test.ii on:
# 1 "test.c"
# 1 "<command-line>"
# 1 "test.c"
# 1 "test1.h" 1
# 1 "test2.h" 1
void foo (void) __attribute__((deprecated ("foo")));
int i;
void baz (void)
{
  i = i / 0;
}
# 1 "test1.h" 2
# 2 "test.c" 2
void
bar (void)
{
  foo ();
}

Ok for trunk?

2013-05-14  Jakub Jelinek  <jakub@redhat.com>

	* tree.c (warn_deprecated_use): Print file:line using locus color.
	* diagnostic.c (diagnostic_report_current_module): Print file:line
	and file:line:column using locus color.


	Jakub
Gabriel Dos Reis - May 14, 2013, 7:19 p.m.
OK.

On Tue, May 14, 2013 at 1:52 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> A few spots which print file:line or file:line:column info, but weren't
> using locus color for it.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
> also tested with ./xg++ -B ./ -S -fdiagnostics-color=auto test.ii on:
> # 1 "test.c"
> # 1 "<command-line>"
> # 1 "test.c"
> # 1 "test1.h" 1
> # 1 "test2.h" 1
> void foo (void) __attribute__((deprecated ("foo")));
> int i;
> void baz (void)
> {
>   i = i / 0;
> }
> # 1 "test1.h" 2
> # 2 "test.c" 2
> void
> bar (void)
> {
>   foo ();
> }
>
> Ok for trunk?
>
> 2013-05-14  Jakub Jelinek  <jakub@redhat.com>
>
>         * tree.c (warn_deprecated_use): Print file:line using locus color.
>         * diagnostic.c (diagnostic_report_current_module): Print file:line
>         and file:line:column using locus color.
>
> --- gcc/tree.c.jj       2013-05-13 12:50:10.000000000 +0200
> +++ gcc/tree.c  2013-05-14 17:54:46.835156217 +0200
> @@ -11715,12 +11715,12 @@ warn_deprecated_use (tree node, tree att
>        expanded_location xloc = expand_location (DECL_SOURCE_LOCATION (node));
>        if (msg)
>         warning (OPT_Wdeprecated_declarations,
> -                "%qD is deprecated (declared at %s:%d): %s",
> -                node, xloc.file, xloc.line, msg);
> +                "%qD is deprecated (declared at %r%s:%d%R): %s",
> +                node, "locus", xloc.file, xloc.line, msg);
>        else
>         warning (OPT_Wdeprecated_declarations,
> -                "%qD is deprecated (declared at %s:%d)",
> -                node, xloc.file, xloc.line);
> +                "%qD is deprecated (declared at %r%s:%d%R)",
> +                node, "locus", xloc.file, xloc.line);
>      }
>    else if (TYPE_P (node))
>      {
> @@ -11744,23 +11744,23 @@ warn_deprecated_use (tree node, tree att
>             {
>               if (msg)
>                 warning (OPT_Wdeprecated_declarations,
> -                        "%qE is deprecated (declared at %s:%d): %s",
> -                        what, xloc.file, xloc.line, msg);
> +                        "%qE is deprecated (declared at %r%s:%d%R): %s",
> +                        what, "locus", xloc.file, xloc.line, msg);
>               else
>                 warning (OPT_Wdeprecated_declarations,
> -                        "%qE is deprecated (declared at %s:%d)", what,
> -                        xloc.file, xloc.line);
> +                        "%qE is deprecated (declared at %r%s:%d%R)",
> +                        what, "locus", xloc.file, xloc.line);
>             }
>           else
>             {
>               if (msg)
>                 warning (OPT_Wdeprecated_declarations,
> -                        "type is deprecated (declared at %s:%d): %s",
> -                        xloc.file, xloc.line, msg);
> +                        "type is deprecated (declared at %r%s:%d%R): %s",
> +                        "locus", xloc.file, xloc.line, msg);
>               else
>                 warning (OPT_Wdeprecated_declarations,
> -                        "type is deprecated (declared at %s:%d)",
> -                        xloc.file, xloc.line);
> +                        "type is deprecated (declared at %r%s:%d%R)",
> +                        "locus", xloc.file, xloc.line);
>             }
>         }
>        else
> --- gcc/diagnostic.c.jj 2013-04-26 08:54:05.000000000 +0200
> +++ gcc/diagnostic.c    2013-05-14 17:58:51.976769978 +0200
> @@ -517,18 +517,18 @@ diagnostic_report_current_module (diagno
>           map = INCLUDED_FROM (line_table, map);
>           if (context->show_column)
>             pp_verbatim (context->printer,
> -                        "In file included from %s:%d:%d",
> +                        "In file included from %r%s:%d:%d%R", "locus",
>                          LINEMAP_FILE (map),
>                          LAST_SOURCE_LINE (map), LAST_SOURCE_COLUMN (map));
>           else
>             pp_verbatim (context->printer,
> -                        "In file included from %s:%d",
> +                        "In file included from %r%s:%d%R", "locus",
>                          LINEMAP_FILE (map), LAST_SOURCE_LINE (map));
>           while (! MAIN_FILE_P (map))
>             {
>               map = INCLUDED_FROM (line_table, map);
>               pp_verbatim (context->printer,
> -                          ",\n                 from %s:%d",
> +                          ",\n                 from %r%s:%d%R", "locus",
>                            LINEMAP_FILE (map), LAST_SOURCE_LINE (map));
>             }
>           pp_verbatim (context->printer, ":");
>
>         Jakub

Patch

--- gcc/tree.c.jj	2013-05-13 12:50:10.000000000 +0200
+++ gcc/tree.c	2013-05-14 17:54:46.835156217 +0200
@@ -11715,12 +11715,12 @@  warn_deprecated_use (tree node, tree att
       expanded_location xloc = expand_location (DECL_SOURCE_LOCATION (node));
       if (msg)
 	warning (OPT_Wdeprecated_declarations,
-		 "%qD is deprecated (declared at %s:%d): %s",
-		 node, xloc.file, xloc.line, msg);
+		 "%qD is deprecated (declared at %r%s:%d%R): %s",
+		 node, "locus", xloc.file, xloc.line, msg);
       else
 	warning (OPT_Wdeprecated_declarations,
-		 "%qD is deprecated (declared at %s:%d)",
-		 node, xloc.file, xloc.line);
+		 "%qD is deprecated (declared at %r%s:%d%R)",
+		 node, "locus", xloc.file, xloc.line);
     }
   else if (TYPE_P (node))
     {
@@ -11744,23 +11744,23 @@  warn_deprecated_use (tree node, tree att
 	    {
 	      if (msg)
 		warning (OPT_Wdeprecated_declarations,
-			 "%qE is deprecated (declared at %s:%d): %s",
-			 what, xloc.file, xloc.line, msg);
+			 "%qE is deprecated (declared at %r%s:%d%R): %s",
+			 what, "locus", xloc.file, xloc.line, msg);
 	      else
 		warning (OPT_Wdeprecated_declarations,
-			 "%qE is deprecated (declared at %s:%d)", what,
-			 xloc.file, xloc.line);
+			 "%qE is deprecated (declared at %r%s:%d%R)",
+			 what, "locus", xloc.file, xloc.line);
 	    }
 	  else
 	    {
 	      if (msg)
 		warning (OPT_Wdeprecated_declarations,
-			 "type is deprecated (declared at %s:%d): %s",
-			 xloc.file, xloc.line, msg);
+			 "type is deprecated (declared at %r%s:%d%R): %s",
+			 "locus", xloc.file, xloc.line, msg);
 	      else
 		warning (OPT_Wdeprecated_declarations,
-			 "type is deprecated (declared at %s:%d)",
-			 xloc.file, xloc.line);
+			 "type is deprecated (declared at %r%s:%d%R)",
+			 "locus", xloc.file, xloc.line);
 	    }
 	}
       else
--- gcc/diagnostic.c.jj	2013-04-26 08:54:05.000000000 +0200
+++ gcc/diagnostic.c	2013-05-14 17:58:51.976769978 +0200
@@ -517,18 +517,18 @@  diagnostic_report_current_module (diagno
 	  map = INCLUDED_FROM (line_table, map);
 	  if (context->show_column)
 	    pp_verbatim (context->printer,
-			 "In file included from %s:%d:%d",
+			 "In file included from %r%s:%d:%d%R", "locus",
 			 LINEMAP_FILE (map),
 			 LAST_SOURCE_LINE (map), LAST_SOURCE_COLUMN (map));
 	  else
 	    pp_verbatim (context->printer,
-			 "In file included from %s:%d",
+			 "In file included from %r%s:%d%R", "locus",
 			 LINEMAP_FILE (map), LAST_SOURCE_LINE (map));
 	  while (! MAIN_FILE_P (map))
 	    {
 	      map = INCLUDED_FROM (line_table, map);
 	      pp_verbatim (context->printer,
-			   ",\n                 from %s:%d",
+			   ",\n                 from %r%s:%d%R", "locus",
 			   LINEMAP_FILE (map), LAST_SOURCE_LINE (map));
 	    }
 	  pp_verbatim (context->printer, ":");