diff mbox

patch PLUGIN_HEADER_FILE event for tracing of header inclusions.

Message ID 1384898261.11868.24.camel@glinka.lesours
State New
Headers show

Commit Message

Basile Starynkevitch Nov. 19, 2013, 9:57 p.m. UTC
On Tue, 2013-11-19 at 20:33 +0100, Dominique Dhumieres wrote:
> > Thanks: Committed revision 205038.
> 
> This seems to break several g++ tests: see http://gcc.gnu.org/ml/gcc-testresults/2013-11/msg01482.html
> On x86_64-apple-darwin13, the ICE is
> 
> cc1: error: cannot load plugin ./one_time_plugin.so

Actually, when we add hard coded plugin events we should never forget,
like I just did, to edit invoke_plugin_callbacks_full.

Diego and all, can I add the following patch to the trunk. One is just a
comment inside plugin.def to recall that invoke_plugin_callbacks_full
should be edited, and another is the tiny fix on that function in
plugin.c

### gcc/ChangeLog entry
2013-11-19  Basile Starynkevitch  <basile@starynkevitch.net>

        * plugin.def: Add comment about register_callback and
	  invoke_plugin_callbacks_full.

        * plugin.c (register_callback, invoke_plugin_callbacks_full): 
	  Handle PLUGIN_INCLUDE_FILE event.
### 

Apologies for my mistake. Hope this will be approved quickly before 4.9
stage 3! (I will later submit a documentation patch)


BTW, I am not very happy about some events in plugin.def not being real
events.  IMHO I would prefer that PLUGIN_PASS_MANAGER_SETUP,
PLUGIN_REGISTER_GGC_ROOTS, PLUGIN_REGISTER_GGC_CACHES be removed,
because they are not real events (and they should have their own public
functions in plugin.h, e.g. add functions like
plugin_pass_manager_setup, plugin_register_ggc_roots,
plugin_register_ggc_caches in gcc/gcc-plugin.h). Unfortunately, we don't
have time for such an improvement for 4.9
 
Regards.

Comments

Richard Biener Nov. 20, 2013, 2:17 p.m. UTC | #1
On Tue, Nov 19, 2013 at 10:57 PM, Basile Starynkevitch
<basile@starynkevitch.net> wrote:
> On Tue, 2013-11-19 at 20:33 +0100, Dominique Dhumieres wrote:
>> > Thanks: Committed revision 205038.
>>
>> This seems to break several g++ tests: see http://gcc.gnu.org/ml/gcc-testresults/2013-11/msg01482.html
>> On x86_64-apple-darwin13, the ICE is
>>
>> cc1: error: cannot load plugin ./one_time_plugin.so
>
> Actually, when we add hard coded plugin events we should never forget,
> like I just did, to edit invoke_plugin_callbacks_full.
>
> Diego and all, can I add the following patch to the trunk. One is just a
> comment inside plugin.def to recall that invoke_plugin_callbacks_full
> should be edited, and another is the tiny fix on that function in
> plugin.c
>
> ### gcc/ChangeLog entry
> 2013-11-19  Basile Starynkevitch  <basile@starynkevitch.net>
>
>         * plugin.def: Add comment about register_callback and
>           invoke_plugin_callbacks_full.
>
>         * plugin.c (register_callback, invoke_plugin_callbacks_full):
>           Handle PLUGIN_INCLUDE_FILE event.
> ###
>
> Apologies for my mistake. Hope this will be approved quickly before 4.9
> stage 3! (I will later submit a documentation patch)

Ok.

Thanks,
Richard.

>
> BTW, I am not very happy about some events in plugin.def not being real
> events.  IMHO I would prefer that PLUGIN_PASS_MANAGER_SETUP,
> PLUGIN_REGISTER_GGC_ROOTS, PLUGIN_REGISTER_GGC_CACHES be removed,
> because they are not real events (and they should have their own public
> functions in plugin.h, e.g. add functions like
> plugin_pass_manager_setup, plugin_register_ggc_roots,
> plugin_register_ggc_caches in gcc/gcc-plugin.h). Unfortunately, we don't
> have time for such an improvement for 4.9
>
> Regards.
> --
> Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
> email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
> 8, rue de la Faiencerie, 92340 Bourg La Reine, France
> *** opinions {are only mine, sont seulement les miennes} ***
>
diff mbox

Patch

Index: gcc/plugin.c
===================================================================
--- gcc/plugin.c	(revision 205052)
+++ gcc/plugin.c	(working copy)
@@ -452,6 +452,7 @@  register_callback (const char *plugin_name,
       case PLUGIN_EARLY_GIMPLE_PASSES_START:
       case PLUGIN_EARLY_GIMPLE_PASSES_END:
       case PLUGIN_NEW_PASS:
+      case PLUGIN_INCLUDE_FILE:
         {
           struct callback_info *new_callback;
           if (!callback)
@@ -529,6 +530,7 @@  invoke_plugin_callbacks_full (int event, void *gcc
       case PLUGIN_EARLY_GIMPLE_PASSES_START:
       case PLUGIN_EARLY_GIMPLE_PASSES_END:
       case PLUGIN_NEW_PASS:
+      case PLUGIN_INCLUDE_FILE:
         {
           /* Iterate over every callback registered with this event and
              call it.  */
Index: gcc/plugin.def
===================================================================
--- gcc/plugin.def	(revision 205052)
+++ gcc/plugin.def	(working copy)
@@ -97,6 +97,9 @@  DEFEVENT (PLUGIN_NEW_PASS)
    as a const char* pointer.  */
 DEFEVENT (PLUGIN_INCLUDE_FILE)
 
+/* When adding a new hard-coded plugin event, don't forget to edit in
+   file plugin.c the functions register_callback and
+   invoke_plugin_callbacks_full accordingly!  */
 
 /* After the hard-coded events above, plugins can dynamically allocate events
    at run time.