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] Adjust function name dumping


On Wed, 23 Aug 2017, Richard Biener wrote:

> On Wed, 23 Aug 2017, Arnaud Charlet wrote:
> 
> > Richard,
> > 
> > > When enabling free-lang-data the lang_hooks.decl_printable_name hook
> > > gets reset.  The following patch reduces the noise from that by
> > > using verbosity 1 (do not print arguments) from the places where
> > > we dump the function name and then follow by arguments manually.
> > > 
> > > This makes dumping consistent with calls in the IL so you can
> > > cut&paste & search in dumps easier (Ada dumps had case differences
> > > for example).  This requires a few changes in the testsuite dump scans
> > > (but not too many to make the change controversical).
> > > 
> > > Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
> > > 
> > > Richard.
> > > 
> > > 2017-08-23  Richard Biener  <rguenther@suse.de>
> > > 
> > > 	* function.c (fndecl_name): Use verbosity 1 (no arguments) for
> > > 	lang_hooks.decl_printable_name.
> > > 	* print-rtl-function.c (print_rtx_function): Likewise.
> > > 	* tree-pretty-print.c (dump_function_header): Likewise.
> > > 
> > > 	* g++.dg/cpp1y/constexpr-instantiate.C: Adjust.
> > > 	* g++.dg/tree-ssa/pr45605.C: Likewise.
> > > 	* gnat.dg/noinline2.ad: Likewise.b
> > > 	* gnat.dg/renaming6.ad: Likewise.b
> > > 	* gnat.dg/renaming6.ad: Likewise.s
> > > 	* gnat.dg/specs/noinline3.ad: Likewise.s
> > 
> > You have typos in the a bove changelog BTW, the "b" and "s" should be
> > part of the filenames (e.g. gnat.dg/noinline2.adb: Likewise.)
> 
> Ooops.  Will fix.
> 
> > I do not understand the changes in the ada testsuite: cana you explain why
> > you renames some variables?
> 
> Because the scan for not 'j' now breaks as the dump contains get_j
> vs Get_J before.  Rather than changing it for expected n times
> I chose to rename the variable that shouldn't appear.

So it is

static const char *
gnat_printable_name (tree decl, int verbosity)
{
  const char *coded_name = IDENTIFIER_POINTER (DECL_NAME (decl));
  char *ada_name = (char *) ggc_alloc_atomic (strlen (coded_name) * 2 + 
60);

  __gnat_decode (coded_name, ada_name, 0);

  if (verbosity == 2 && !DECL_IS_BUILTIN (decl))
    {
      Set_Identifier_Casing (ada_name, DECL_SOURCE_FILE (decl));
      return ggc_strdup (Name_Buffer);

this unexpected behavior with verbosity == 2, the docs say
"2: and any other information that might be interesting, such as function 
parameter types in C++." -- that doesn't suggest to change casing
(we dump variable names with verbosity 1 so you see 'j' instead of
correct(?) 'J').

Thus, this makes things more consistent in dumps.


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