Message ID | 0390b03b37fb75afba6a754964c2ae43f799727b.1536144068.git.ams@codesourcery.com |
---|---|
State | New |
Headers | show |
Series | AMD GCN Port | expand |
On Wed, 2018-09-05 at 12:49 +0100, ams@codesourcery.com wrote: > The plain "sorry" diagnostic only gives the "current" location, which > is > typically the last line of the function or translation unit by time > we get to > the back end. > > GCN uses "sorry" to report unsupported language features, such as > static > constructors, so it's useful to have a "sorry_at" variant. > > This patch implements "sorry_at" according to the pattern of the > other "at" > variants. > > 2018-09-05 Andrew Stubbs <ams@codesourcery.com> > > gcc/ > * diagnostic-core.h (sorry_at): New prototype. > * diagnostic.c (sorry_at): New function. > --- > gcc/diagnostic-core.h | 1 + > gcc/diagnostic.c | 11 +++++++++++ > 2 files changed, 12 insertions(+) OK, thanks.
On Wed, 2018-09-05 at 09:39 -0400, David Malcolm wrote: > On Wed, 2018-09-05 at 12:49 +0100, ams@codesourcery.com wrote: > > The plain "sorry" diagnostic only gives the "current" location, > > which > > is > > typically the last line of the function or translation unit by time > > we get to > > the back end. > > > > GCN uses "sorry" to report unsupported language features, such as > > static > > constructors, so it's useful to have a "sorry_at" variant. > > > > This patch implements "sorry_at" according to the pattern of the > > other "at" > > variants. > > > > 2018-09-05 Andrew Stubbs <ams@codesourcery.com> > > > > gcc/ > > * diagnostic-core.h (sorry_at): New prototype. > > * diagnostic.c (sorry_at): New function. > > --- > > gcc/diagnostic-core.h | 1 + > > gcc/diagnostic.c | 11 +++++++++++ > > 2 files changed, 12 insertions(+) > > OK, thanks. Actually, not quite: "sorry" has changed slightly on trunk since you copied it. Please add the: auto_diagnostic_group d; line to the top of the function. OK with that change.
On 05/09/18 14:41, David Malcolm wrote: > Please add the: > > auto_diagnostic_group d; > > line to the top of the function. > > OK with that change. Here's what I committed. Andrew Add sorry_at diagnostic function. The plain "sorry" diagnostic only gives the "current" location, which is typically the last line of the function or translation unit by time we get to the back end. GCN uses "sorry" to report unsupported language features, such as static constructors, so it's useful to have a "sorry_at" variant. This patch implements "sorry_at" according to the pattern of the other "at" variants. 2018-09-11 Andrew Stubbs <ams@codesourcery.com> gcc/ * diagnostic-core.h (sorry_at): New prototype. * diagnostic.c (sorry_at): New function. diff --git a/gcc/diagnostic-core.h b/gcc/diagnostic-core.h index e4ebe00..80ff395 100644 --- a/gcc/diagnostic-core.h +++ b/gcc/diagnostic-core.h @@ -96,6 +96,7 @@ extern bool permerror (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); extern bool permerror (rich_location *, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); extern void sorry (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2); +extern void sorry_at (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); extern void inform (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); extern void inform (rich_location *, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); extern void inform_n (location_t, unsigned HOST_WIDE_INT, const char *, diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index aae0934..8575065 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -1443,6 +1443,18 @@ sorry (const char *gmsgid, ...) va_end (ap); } +/* Same as above, but use location LOC instead of input_location. */ +void +sorry_at (location_t loc, const char *gmsgid, ...) +{ + auto_diagnostic_group d; + va_list ap; + va_start (ap, gmsgid); + rich_location richloc (line_table, loc); + diagnostic_impl (&richloc, -1, gmsgid, &ap, DK_SORRY); + va_end (ap); +} + /* Return true if an error or a "sorry" has been seen. Various processing is disabled after errors. */ bool
diff --git a/gcc/diagnostic-core.h b/gcc/diagnostic-core.h index e4ebe00..80ff395 100644 --- a/gcc/diagnostic-core.h +++ b/gcc/diagnostic-core.h @@ -96,6 +96,7 @@ extern bool permerror (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); extern bool permerror (rich_location *, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); extern void sorry (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2); +extern void sorry_at (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); extern void inform (location_t, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); extern void inform (rich_location *, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); extern void inform_n (location_t, unsigned HOST_WIDE_INT, const char *, diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index aae0934..56a1140 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -1443,6 +1443,17 @@ sorry (const char *gmsgid, ...) va_end (ap); } +/* Same as above, but use location LOC instead of input_location. */ +void +sorry_at (location_t loc, const char *gmsgid, ...) +{ + va_list ap; + va_start (ap, gmsgid); + rich_location richloc (line_table, loc); + diagnostic_impl (&richloc, -1, gmsgid, &ap, DK_SORRY); + va_end (ap); +} + /* Return true if an error or a "sorry" has been seen. Various processing is disabled after errors. */ bool