Bug 39679 - Some absent attributes in the tree-dump should be added
Summary: Some absent attributes in the tree-dump should be added
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.3.3
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-07 14:10 UTC by Andrey Ponomarenko
Modified: 2017-08-20 02:02 UTC (History)
1 user (show)

See Also:
Host: independent
Target:
Build: independent
Known to work:
Known to fail:
Last reconfirmed:


Attachments
This patch add some absent function attributes to the tree-dump (322 bytes, patch)
2009-04-07 14:13 UTC, Andrey Ponomarenko
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Ponomarenko 2009-04-07 14:10:45 UTC
Hi, I'am one of the lead developers from "Linux Verification Center" (http://www.linuxtesting.org/) at ISPRAS in Russia. Last several years we make instruments for linux testing along with the "Linux Foundation" (http://linuxfoundation.org/) under the LSB-Infrastructure project. Some our instruments use gcc as a parser through the command "g++ -fdump-translation-unit". Dump that gcc creates by this command doesn't contain some necessary things and we have to add some changes to the sources of gcc and recompile it. We consider that some of these changes may be useful for other users of gcc. Following patch for file dump.c from gcc sources contains a few additional code that adds to the resulting dump useful function attributes: inline, volatile, const.


--- dump.c	2007-08-02 14:36:13.000000000 +0400
+++ dump.c	2009-04-07 14:34:14.000000000 +0400
@@ -297,6 +297,15 @@
     case FUNCTION_DECL:
       if (!DECL_THUNK_P (t))
 	{
+      /* Dump whether function is const. */
+      if (DECL_CONST_MEMFUNC_P(t))
+          dump_string_field(di, "qual", "c");
+      /* Dump whether function is volatile. */
+      if (DECL_VOLATILE_MEMFUNC_P(t))
+          dump_string_field(di, "qual", "v");
+      /* Dump whether function is inline. */
+      if (DECL_DECLARED_INLINE_P(t))
+          dump_string_field (di, "note", "inline");  
 	  if (DECL_OVERLOADED_OPERATOR_P (t)) {
 	    dump_string_field (di, "note", "operator");
 	    dump_op (di, t);
Comment 1 Andrey Ponomarenko 2009-04-07 14:13:49 UTC
Created attachment 17600 [details]
This patch add some absent function attributes to the tree-dump
Comment 2 Andrew Pinski 2009-04-07 18:28:47 UTC
this dump file is only supposed to be used to debug gcc.
Comment 3 Dodji Seketeli 2009-04-08 09:53:35 UTC
Subject: Re:  Some absent attributes in the tree-dump should
 be added

pinskia at gcc dot gnu dot org a écrit :
> ------- Comment #2 from pinskia at gcc dot gnu dot org  2009-04-07 18:28 -------
> this dump file is only supposed to be used to debug gcc.

True.

For what it is worth, you might want to post your patch to
gcc-patches@gcc.gnu.org so that it has more exposure and triggers more
discussion. For patches, the gcc-patches mailing list tends to get more exposure
to the GCC hackers than the bugzilla.

Comment 4 Paolo Carlini 2011-09-28 23:57:07 UTC
Did you send the patch to the gcc-patches mailing list?
Comment 5 Paolo Carlini 2012-05-24 11:56:37 UTC
Hi Gaby. What do you think about this? I suppose, if we like the idea, we could apply the patch even without a Copyright assignment, because it's so small, and resolve the issue.
Comment 6 Eric Gallager 2017-08-20 02:02:39 UTC
g++ no longer supports the -fdump-translation-unit flag:

$ /usr/local/bin/g++ -c -fdump-translation-unit -fsyntax-only -std=gnu++98 53360.cc
cc1plus: error: unrecognized command line option ‘-fdump-translation-unit’
$

I think I remember some debate on gcc-patches about removing it for gcc8 but I forget the link to the thread... closing as WONTFIX since the flag probably won't be coming back