This is the mail archive of the 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]

PLUGIN_HEADER_FILE event for tracing of header inclusions.

Hello All,

I strongly believe that plugins should be able to be notified of
included headers. Notice that end-users already can be notified with the
-H option of gcc.

This is useful e.g. for plugins which are interfacing to some IDE (like
Eclispe, Geany, ...), because the editor really wants to know when a
header file is used.

MELT [see] certainly will be very happy if a
PLUGIN_HEADER_FILE event existed for that purpose. It would make its
probe (or the future "monitor" of MELT) much simpler, because every
included file would easily be passed to the MELT plugin and to the
probe. (Currently MELT deals with that by constructing a set of files
for the locations, but that is painful).

In principle the patch should be quite simple; add in function
linemap_add of libcpp/line-map.c, near line 380, for reason == LC_ENTER
just before testing set->trace_includes, some lines like

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

but that requires a #include "plugin.h" in that file libcpp/line-map.c,
and then GCC machinery (autodependencies for make, etc...) is unhappy 
(because this requires -I$(srcdir)/../gcc to be added in the
of libcpp/)

What would be the good way to add such a plugin event to GCC 4.9?


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]