Patchwork Print column information in dump_loc

login
register
mail settings
Submitter Easwaran Raman
Date May 14, 2013, 4:58 p.m.
Message ID <CAPK5YPZ0axpUipBm6BLiFr2k=s6WK5Zx-h+BVo5+7E+juM3pWA@mail.gmail.com>
Download mbox | patch
Permalink /patch/243790/
State New
Headers show

Comments

Easwaran Raman - May 14, 2013, 4:58 p.m.
This patch dumps the column number as part of dump_loc making the
output similar to inform(). This allows these messages to be pattern
matched by dg_message. Bootstraps with this change. Ok for trunk?

- Easwaran
---------

2013-05-14  Easwaran Raman  <eraman@google.com>

* dumpfile.c (dump_loc): Print column number.
Richard Guenther - May 15, 2013, 8:30 a.m.
On Tue, May 14, 2013 at 6:58 PM, Easwaran Raman <eraman@google.com> wrote:
> This patch dumps the column number as part of dump_loc making the
> output similar to inform(). This allows these messages to be pattern
> matched by dg_message. Bootstraps with this change. Ok for trunk?

Eh, column numbers are mostly noise for these messages.  Why not
improve dg_message instead?  Btw, I think that note:'s are ignored in
most harnesses - at least vect.exp passes with -fopt-info-vec-optimized
for example.

Richard.

> - Easwaran
> ---------
>
> 2013-05-14  Easwaran Raman  <eraman@google.com>
>
> * dumpfile.c (dump_loc): Print column number.
>
> Index: gcc/dumpfile.c
> ===================================================================
> --- gcc/dumpfile.c (revision 198852)
> +++ gcc/dumpfile.c (working copy)
> @@ -261,12 +261,13 @@ dump_loc (int dump_kind, FILE *dfile, source_locat
>    if (dump_kind)
>      {
>        if (LOCATION_LOCUS (loc) > BUILTINS_LOCATION)
> -        fprintf (dfile, "\n%s:%d: note: ", LOCATION_FILE (loc),
> -                 LOCATION_LINE (loc));
> +        fprintf (dfile, "\n%s:%d:%d: note: ", LOCATION_FILE (loc),
> +                 LOCATION_LINE (loc), LOCATION_COLUMN (loc));
>        else if (current_function_decl)
> -        fprintf (dfile, "\n%s:%d: note: ",
> +        fprintf (dfile, "\n%s:%d:%d: note: ",
>                   DECL_SOURCE_FILE (current_function_decl),
> -                 DECL_SOURCE_LINE (current_function_decl));
> +                 DECL_SOURCE_LINE (current_function_decl),
> +                 DECL_SOURCE_COLUMN (current_function_decl));
>      }
>  }

Patch

Index: gcc/dumpfile.c
===================================================================
--- gcc/dumpfile.c (revision 198852)
+++ gcc/dumpfile.c (working copy)
@@ -261,12 +261,13 @@  dump_loc (int dump_kind, FILE *dfile, source_locat
   if (dump_kind)
     {
       if (LOCATION_LOCUS (loc) > BUILTINS_LOCATION)
-        fprintf (dfile, "\n%s:%d: note: ", LOCATION_FILE (loc),
-                 LOCATION_LINE (loc));
+        fprintf (dfile, "\n%s:%d:%d: note: ", LOCATION_FILE (loc),
+                 LOCATION_LINE (loc), LOCATION_COLUMN (loc));
       else if (current_function_decl)
-        fprintf (dfile, "\n%s:%d: note: ",
+        fprintf (dfile, "\n%s:%d:%d: note: ",
                  DECL_SOURCE_FILE (current_function_decl),
-                 DECL_SOURCE_LINE (current_function_decl));
+                 DECL_SOURCE_LINE (current_function_decl),
+                 DECL_SOURCE_COLUMN (current_function_decl));
     }
 }