Bug 41757

Summary: Add PLUGIN_FINISH_DECL
Product: gcc Reporter: Taras Glek <tglek>
Component: pluginsAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal CC: bhackett1024, devurandom, gcc-bugs, jeffreyalaw, pageexec, pawel_sikora
Priority: P3    
Version: 4.5.0   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:

Description Taras Glek 2009-10-19 20:20:27 UTC
The GCC plugin API has a PLUGIN_FINISH_TYPE callback which provides an easy way for plugins to enumerate instantiated types in GCC. Unfortunately no such equivalent exists for decls. 

Would be great to get a way to get notified when global variable, struct member and static method DECLs are completed in the parser.
Comment 1 Diego Novillo 2009-12-22 19:47:50 UTC
Proposed patch at http://gcc.gnu.org/ml/gcc-patches/2009-12/msg01032.html
Comment 2 Pawel Sikora 2010-10-15 20:11:57 UTC
ping, ping.

please, can we finally get this useful hook in 4.5/4.6?
Comment 3 Diego Novillo 2010-10-19 20:02:45 UTC
We still have not received copyright assignment paperwork from Brian, so we are not able to accept the patch unfortunately.
Comment 4 Brian Hackett 2010-11-29 20:53:17 UTC
What paperwork still needs to be done for this (9 line) patch?  The FSF should have my personal copyright assignment, but I could not get one from my employer when I wrote the patch, Stanford University (according to Stanford's policies they would not claim copyright on this patch).  I now work for Mozilla, which I think has a company wide copyright assignment.

The last time I tried to add this hook (http://gcc.gnu.org/ml/gcc-patches/2010-04/msg00780.html), the copyright issue seemed OK but the patch was blocked on account of adding a function call to every finish_decl.  That issue has since been fixed by making invoke_plugin_callbacks a static inline function.
Comment 5 PaX Team 2012-05-22 11:49:47 UTC
this feature seems to have been implemented already in gcc 4.7.x, can it be backported to 4.5.x and 4.6.x perhaps? it would make life easier for plugin writers who would like to provide the same features for all the plugin capable gcc series.
Comment 6 devurandom 2014-03-08 15:06:15 UTC
(In reply to PaX Team from comment #5)
> this feature seems to have been implemented already in gcc 4.7.x, can it be
> backported to 4.5.x and 4.6.x perhaps?

I would like to see that happen, too. E.g. gcc-lua-cdecl and Gentoo's hardened-sources would benefit from this.
Comment 7 Jeffrey A. Law 2015-11-18 23:06:34 UTC
Fixed for 4.7.  There are no plans to backport the change to older compilers.