Re: [Patch to gcc/function] PR 58362

2013-09-09 Thread Gabriel Dos Reis
On Mon, Sep 9, 2013 at 5:41 AM, Jakub Jelinek wrote: > On Mon, Sep 09, 2013 at 12:38:46PM +0200, Paolo Carlini wrote: >> On 09/09/2013 11:37 AM, Richard Biener wrote: >> >That said, grepping for %q+D reveals quite some uses and it looks like >> >all of them expect the location being used to be tha

Re: [Patch to gcc/function] PR 58362

2013-09-09 Thread Gabriel Dos Reis
On Mon, Sep 9, 2013 at 5:38 AM, Paolo Carlini wrote: > On 09/09/2013 11:37 AM, Richard Biener wrote: >> >> That said, grepping for %q+D reveals quite some uses and it looks like >> all of them expect the location being used to be that of the decl passed >> to the diagnostic call, not some random o

Re: [Patch to gcc/function] PR 58362

2013-09-09 Thread Gabriel Dos Reis
On Mon, Sep 9, 2013 at 5:13 AM, Richard Biener wrote: > On Mon, 9 Sep 2013, Paolo Carlini wrote: > >> On 09/09/2013 12:04 PM, Richard Biener wrote: >> > On Mon, 9 Sep 2013, Jakub Jelinek wrote: >> > >> > > On Mon, Sep 09, 2013 at 11:45:08AM +0200, Richard Biener wrote: >> > > > Well, in this case

Re: [Patch to gcc/function] PR 58362

2013-09-09 Thread Gabriel Dos Reis
On Mon, Sep 9, 2013 at 5:04 AM, Richard Biener wrote: > On Mon, 9 Sep 2013, Jakub Jelinek wrote: > >> On Mon, Sep 09, 2013 at 11:45:08AM +0200, Richard Biener wrote: >> > Well, in this case the patch should IMHO be a no-op. >> > >> > - warning (OPT_Wunused_parameter, "unused parameter %q+D",

Re: [Patch to gcc/function] PR 58362

2013-09-09 Thread Gabriel Dos Reis
On Mon, Sep 9, 2013 at 4:46 AM, Jakub Jelinek wrote: > On Mon, Sep 09, 2013 at 11:45:08AM +0200, Richard Biener wrote: >> Well, in this case the patch should IMHO be a no-op. >> >> - warning (OPT_Wunused_parameter, "unused parameter %q+D", decl); >> + warning_at (DECL_SOURCE_LOCATION (de

Re: [Patch to gcc/function] PR 58362

2013-09-09 Thread Paolo Carlini
On 09/09/2013 12:44 PM, Paolo Carlini wrote: I understand that. It seems to me a much bigger project and must be done for the C front-end too (I don't know the name of the equivalent of location_of, but the location is wrong for it too, there must be the equivalent of t = DECL_CONTEXT (t) for i

Re: [Patch to gcc/function] PR 58362

2013-09-09 Thread Paolo Carlini
On 09/09/2013 12:41 PM, Jakub Jelinek wrote: On Mon, Sep 09, 2013 at 12:38:46PM +0200, Paolo Carlini wrote: On 09/09/2013 11:37 AM, Richard Biener wrote: That said, grepping for %q+D reveals quite some uses and it looks like all of them expect the location being used to be that of the decl pass

Re: [Patch to gcc/function] PR 58362

2013-09-09 Thread Jakub Jelinek
On Mon, Sep 09, 2013 at 12:38:46PM +0200, Paolo Carlini wrote: > On 09/09/2013 11:37 AM, Richard Biener wrote: > >That said, grepping for %q+D reveals quite some uses and it looks like > >all of them expect the location being used to be that of the decl passed > >to the diagnostic call, not some ra

Re: [Patch to gcc/function] PR 58362

2013-09-09 Thread Paolo Carlini
On 09/09/2013 11:37 AM, Richard Biener wrote: That said, grepping for %q+D reveals quite some uses and it looks like all of them expect the location being used to be that of the decl passed to the diagnostic call, not some random other location. If the decl is *not* a PARM_DECL, I expect %q+D to

Re: [Patch to gcc/function] PR 58362

2013-09-09 Thread Paolo Carlini
Hi, On 09/09/2013 12:13 PM, Richard Biener wrote: Everything happens via call backs. Thus from the generic diagnostic machinery, you go to cp_printer for C++, thus location_of for C++. In C is different, but again there is, evidently, a mechanism which uses DECL_CONTEXT for PARM_DECLs which lead

Re: [Patch to gcc/function] PR 58362

2013-09-09 Thread Richard Biener
On Mon, 9 Sep 2013, Paolo Carlini wrote: > On 09/09/2013 12:04 PM, Richard Biener wrote: > > On Mon, 9 Sep 2013, Jakub Jelinek wrote: > > > > > On Mon, Sep 09, 2013 at 11:45:08AM +0200, Richard Biener wrote: > > > > Well, in this case the patch should IMHO be a no-op. > > > > > > > > - warn

Re: [Patch to gcc/function] PR 58362

2013-09-09 Thread Paolo Carlini
On 09/09/2013 12:08 PM, Paolo Carlini wrote: Everything happens via call backs. Thus from the generic diagnostic machinery, you go to cp_printer for C++, thus location_of for C++. In C is different, but again there is, evidently, a mechanism which uses DECL_CONTEXT for PARM_DECLs which leads to

Re: [Patch to gcc/function] PR 58362

2013-09-09 Thread Paolo Carlini
On 09/09/2013 12:04 PM, Richard Biener wrote: On Mon, 9 Sep 2013, Jakub Jelinek wrote: On Mon, Sep 09, 2013 at 11:45:08AM +0200, Richard Biener wrote: Well, in this case the patch should IMHO be a no-op. - warning (OPT_Wunused_parameter, "unused parameter %q+D", decl); + warning_at

Re: [Patch to gcc/function] PR 58362

2013-09-09 Thread Richard Biener
On Mon, 9 Sep 2013, Jakub Jelinek wrote: > On Mon, Sep 09, 2013 at 11:45:08AM +0200, Richard Biener wrote: > > Well, in this case the patch should IMHO be a no-op. > > > > - warning (OPT_Wunused_parameter, "unused parameter %q+D", decl); > > + warning_at (DECL_SOURCE_LOCATION (decl), OP

Re: [Patch to gcc/function] PR 58362

2013-09-09 Thread Paolo Carlini
Hi, On 09/09/2013 11:45 AM, Richard Biener wrote: Well, in this case the patch should IMHO be a no-op. - warning (OPT_Wunused_parameter, "unused parameter %q+D", decl); + warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wunused_parameter, + "unused parameter %qD", decl);

Re: [Patch to gcc/function] PR 58362

2013-09-09 Thread Jakub Jelinek
On Mon, Sep 09, 2013 at 11:45:08AM +0200, Richard Biener wrote: > Well, in this case the patch should IMHO be a no-op. > > - warning (OPT_Wunused_parameter, "unused parameter %q+D", decl); > + warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wunused_parameter, > + "unused param

Re: [Patch to gcc/function] PR 58362

2013-09-09 Thread Paolo Carlini
Hi, On 09/09/2013 11:33 AM, Richard Biener wrote: How is '+' in %q+D defined? I failed to find documentation of the diagnostic formats (but only searched for like two minutes). You see, this is an issue ;) No seriously, in C++ I understand it by looking at error.c:3438: when '+' is there, cp_p

Re: [Patch to gcc/function] PR 58362

2013-09-09 Thread Richard Biener
On Mon, 9 Sep 2013, Jakub Jelinek wrote: > On Mon, Sep 09, 2013 at 11:37:31AM +0200, Richard Biener wrote: > > > > > > this patchlet fixes the column # of the unused parameter warnings > > > > > > emitted > > > > > > by > > > > > > do_warn_unused_parameter by explicitly passing DECL_SOURCE_LOCATI

Re: [Patch to gcc/function] PR 58362

2013-09-09 Thread Jakub Jelinek
On Mon, Sep 09, 2013 at 11:37:31AM +0200, Richard Biener wrote: > > > > > this patchlet fixes the column # of the unused parameter warnings > > > > > emitted > > > > > by > > > > > do_warn_unused_parameter by explicitly passing DECL_SOURCE_LOCATION > > > > > (decl) > > > > > instead of wrongly re

Re: [Patch to gcc/function] PR 58362

2013-09-09 Thread Richard Biener
On Mon, 9 Sep 2013, Richard Biener wrote: > On Mon, 9 Sep 2013, Paolo Carlini wrote: > > > Hi Richard, > > > > On 09/09/2013 09:46 AM, Richard Biener wrote: > > > On Sun, 8 Sep 2013, Paolo Carlini wrote: > > > > > > > Hi, > > > > > > > > this patchlet fixes the column # of the unused parameter

Re: [Patch to gcc/function] PR 58362

2013-09-09 Thread Richard Biener
On Mon, 9 Sep 2013, Paolo Carlini wrote: > Hi Richard, > > On 09/09/2013 09:46 AM, Richard Biener wrote: > > On Sun, 8 Sep 2013, Paolo Carlini wrote: > > > > > Hi, > > > > > > this patchlet fixes the column # of the unused parameter warnings emitted > > > by > > > do_warn_unused_parameter by ex

Re: [Patch to gcc/function] PR 58362

2013-09-09 Thread Paolo Carlini
Hi Richard, On 09/09/2013 09:46 AM, Richard Biener wrote: On Sun, 8 Sep 2013, Paolo Carlini wrote: Hi, this patchlet fixes the column # of the unused parameter warnings emitted by do_warn_unused_parameter by explicitly passing DECL_SOURCE_LOCATION (decl) instead of wrongly relying on '+', whi

Re: [Patch to gcc/function] PR 58362

2013-09-09 Thread Richard Biener
On Sun, 8 Sep 2013, Paolo Carlini wrote: > Hi, > > this patchlet fixes the column # of the unused parameter warnings emitted by > do_warn_unused_parameter by explicitly passing DECL_SOURCE_LOCATION (decl) > instead of wrongly relying on '+', which in this case ends up meaning the > location of th