* [PATCH] Print column numbers in inclusion trace consistently.
@ 2016-06-03 11:24 Marcin Baczyński
2016-06-22 3:09 ` Jeff Law
0 siblings, 1 reply; 3+ messages in thread
From: Marcin Baczyński @ 2016-06-03 11:24 UTC (permalink / raw)
To: gcc-patches; +Cc: Marcin Baczyński
Hi,
the patch below fixes PR/42014. Although the fix itself seems easy enough,
I have a problem with the test. Is there a way to match the output before
the "warning:" line? dg-{begin,end}-multiline-output doesn't do the job, or
at least I don't know how to convince it.
Bootstrapped on x86_64 linux.
Thanks,
Marcin
gcc/ChangeLog:
PR/42014
* diagnostic.c (diagnostic_report_current_module): Print column numbers
for all mentioned files if context->show_column.
gcc/testsuite/ChangeLog:
PR/42014
* gcc.dg/inclusion-trace-column.i: New test.
---
gcc/diagnostic.c | 12 +++++++++---
gcc/testsuite/gcc.dg/inclusion-trace-column.i | 16 ++++++++++++++++
2 files changed, 25 insertions(+), 3 deletions(-)
create mode 100644 gcc/testsuite/gcc.dg/inclusion-trace-column.i
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index 8106172..05037ba 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -537,9 +537,15 @@ diagnostic_report_current_module (diagnostic_context *context, location_t where)
while (! MAIN_FILE_P (map))
{
map = INCLUDED_FROM (line_table, map);
- pp_verbatim (context->printer,
- ",\n from %r%s:%d%R", "locus",
- LINEMAP_FILE (map), LAST_SOURCE_LINE (map));
+ if (context->show_column)
+ pp_verbatim (context->printer,
+ ",\n from %r%s:%d:%d%R", "locus",
+ LINEMAP_FILE (map),
+ LAST_SOURCE_LINE (map), LAST_SOURCE_COLUMN (map));
+ else
+ pp_verbatim (context->printer,
+ ",\n from %r%s:%d%R", "locus",
+ LINEMAP_FILE (map), LAST_SOURCE_LINE (map));
}
pp_verbatim (context->printer, ":");
pp_newline (context->printer);
diff --git a/gcc/testsuite/gcc.dg/inclusion-trace-column.i b/gcc/testsuite/gcc.dg/inclusion-trace-column.i
new file mode 100644
index 0000000..1fb8923
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/inclusion-trace-column.i
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-fshow-column -Wreturn-type" } */
+/* { dg-begin-multiline-output "" }
+In file included from b.h:1:0,
+ from a.h:1:0,
+ from t.c:1:0:
+ { dg-end-multiline-output "" } */
+/* PR 42014 */
+# 1 "t.c"
+# 1 "a.h" 1
+# 1 "b.h" 1
+# 1 "c.h" 1
+double f () {} /* { dg-warning "reaches end" "no return" { target *-*-* } 1 } */
+# 1 "b.h" 2
+# 1 "a.h" 2
+# 1 "t.c" 2
--
2.8.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Print column numbers in inclusion trace consistently.
2016-06-03 11:24 [PATCH] Print column numbers in inclusion trace consistently Marcin Baczyński
@ 2016-06-22 3:09 ` Jeff Law
2016-06-23 14:32 ` David Malcolm
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Law @ 2016-06-22 3:09 UTC (permalink / raw)
To: Marcin Baczyński, gcc-patches
On 06/03/2016 05:24 AM, Marcin BaczyÅski wrote:
> Hi,
> the patch below fixes PR/42014. Although the fix itself seems easy enough,
> I have a problem with the test. Is there a way to match the output before
> the "warning:" line? dg-{begin,end}-multiline-output doesn't do the job, or
> at least I don't know how to convince it.
>
> Bootstrapped on x86_64 linux.
>
> Thanks,
> Marcin
>
>
> gcc/ChangeLog:
>
> PR/42014
>
> * diagnostic.c (diagnostic_report_current_module): Print column numbers
> for all mentioned files if context->show_column.
>
> gcc/testsuite/ChangeLog:
>
> PR/42014
>
> * gcc.dg/inclusion-trace-column.i: New test.
The change itself seems reasonable. You might contact David Malcolm
(dmalcolm@redhat.com) directly to see if he's got any ideas on how to
convince the multi-line test to do what you want. Let's hold off
installing the fix until we've got the testsuite issue sorted out.
Thanks,
jeff
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Print column numbers in inclusion trace consistently.
2016-06-22 3:09 ` Jeff Law
@ 2016-06-23 14:32 ` David Malcolm
0 siblings, 0 replies; 3+ messages in thread
From: David Malcolm @ 2016-06-23 14:32 UTC (permalink / raw)
To: Jeff Law, Marcin Baczyński, gcc-patches
On Tue, 2016-06-21 at 21:09 -0600, Jeff Law wrote:
> On 06/03/2016 05:24 AM, Marcin BaczyÅski wrote:
> > Hi,
> > the patch below fixes PR/42014. Although the fix itself seems easy
> > enough,
> > I have a problem with the test. Is there a way to match the output
> > before
> > the "warning:" line? dg-{begin,end}-multiline-output doesn't do the
> > job, or
> > at least I don't know how to convince it.
> >
> > Bootstrapped on x86_64 linux.
> >
> > Thanks,
> > Marcin
> >
> >
> > gcc/ChangeLog:
> >
> > PR/42014
> >
> > * diagnostic.c (diagnostic_report_current_module): Print column
> > numbers
> > for all mentioned files if context->show_column.
> >
> > gcc/testsuite/ChangeLog:
> >
> > PR/42014
> >
> > * gcc.dg/inclusion-trace-column.i: New test.
> The change itself seems reasonable. You might contact David Malcolm
> (dmalcolm@redhat.com) directly to see if he's got any ideas on how to
> convince the multi-line test to do what you want. Let's hold off
> installing the fix until we've got the testsuite issue sorted out.
You could turn up the verbosity level to debug things, by running
something like:
make check-gcc RUNTESTFLAGS="-v -v -v -v dg.exp=inclusion-trace-column.i"
(multiline.exp prints various things at verbosity level 3 and 4, iirc;
in particular, it can show you the regexp it's looking for).
Maybe a tabs vs spaces issue?
Dave
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-06-23 14:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-03 11:24 [PATCH] Print column numbers in inclusion trace consistently Marcin Baczyński
2016-06-22 3:09 ` Jeff Law
2016-06-23 14:32 ` David Malcolm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).