This is the mail archive of the gcc@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: PLUGIN_HEADER_FILE event for tracing of header inclusions.


On Mon, 2013-11-18 at 13:17 +0000, Joseph S. Myers wrote:
> On Sun, 17 Nov 2013, Basile Starynkevitch wrote:
> 
> > What would be the good way to add such a plugin event to GCC 4.9?
> 
> See the cpp_callbacks structure, used to make diagnostics go through GCC's 
> diagnostics machinery, for example.  I'm not clear why the existing 
> callbacks (in particular the file_change one) wouldn't be enough.


Thanks for your reply (and your interest to my suggestion).

I am not sure to understand what you suggest (because I see several ways
to understand it).

The first would be to add inside file libcpp/directives.c in its
function _cpp_do_file_change (e.g. after line 1044 the statement

      /* Signal to plugins that a header file is included.  */
      invoke_plugin_callbacks (PLUGIN_HEADER_FILE,
                               ORDINARY_MAP_FILE_NAME (map));

The second would be to add a new way to invoke plugin callbacks which
would be to add the file libcpp/internals.h to the list of plugin
exported headers. At the very least, this means to add into the
PLUGIN_HEADERS variable of gcc/Makefile.in several files from
libcpp/includes/ and possibley even libcpp/internals.h

I find that the second way introduce a policy change w.r.t plugins. Up
to now, we tried hard to define the way plugins interact with GCC thru
the plugins.h and plugins.def file, but it looks that you want yet
another way.

I strongly prefer adding a new plugin event (PLUGIN_HEADER_FILE) and
just use it (and document it) to adding a new way of having plugins
modify the behavior of GCC (thru our various hooks, in that case the
file_change callback).

What do you practically suggest? Don't you feel that adding a new plugin
event (PLUGIN_HEADER_FILE) to plugins.def and adding a single call to
invoke_plugin_callbacks much lighter and simpler than having the plugin
need several additional files (into PLUGIN_HEADERS make variable)
etc...?

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} ***



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