This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch to gcc/function] PR 58362


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 (DECL_SOURCE_LOCATION (decl), OPT_Wunused_parameter,
+		  "unused parameter %qD", decl);

no?  Unless I misunderstand what %q+D should do.
The question is how exactly is %q+D defined, if it is
warning_at (location_of (decl), OPT_Wunused_parameter, "unused parameter %qD", decl); in this case, or
DECL_SOURCE_LOCATION (decl) instead.
It can't be 'location_of' because that's a C++ FE speciality but
warning_at and %q+D are diagnostic machinery level.
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 an inaccurate location when we *really* want the location of the parameter (exactly as I explained for C++).

Paolo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]