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]

[C++, diagnostic Patch] PR 58362


Hi all, hi Gaby,

thus a more sensible try at fixing this issue: function.c:do_warn_unused_parameter uses "%q+D" for the error call. That means that cp/error.c:cp_printer does:

  if (set_locus && t != NULL)
    *text->locus = location_of (t);

and it's important that location_of (t) is correct. However, for PARM_DECLs, location_of (still) does:

  if (TREE_CODE (t) == PARM_DECL && DECL_CONTEXT (t))
    t = DECL_CONTEXT (t);
  else if ...
  ...

which means that for those we end up with the location of a FUNCTION_DECL or anyway not exactly the location of the PARM_DECL itself. I went through the C++ front-end and currently there are very few cases if any where location_of may be fed a PARM_DECL, and the very few seem Ok to me. The testsuite passes on x86_64-linux of course, thus I'm proposing the below. IMHO now that we are in Stage 1 the risk of breaking locations somewhere else is low enough. By the way, as discussed today elsewhere, the C front-end is already Ok.

Thanks!
Paolo.

//////////////////////////

Attachment: CL_58362_2
Description: Text document

Attachment: patch_58362_2
Description: Text document


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