1 /* A plugin example that shows which function definitions are caught by PLUGIN_START_FUNCTION and PLUGIN_FINISH_FUNCTION */
3 #include "gcc-plugin.h"
11 #include "diagnostic.h"
13 int plugin_is_GPL_compatible
;
15 /* Callback function to invoke when GCC starts a function definition*/
17 void plugin_start_parse_function (void *event_data
, void *data
)
19 tree fndef
= (tree
) event_data
;
20 warning (0, G_("Start fndef %s"),
21 IDENTIFIER_POINTER (DECL_NAME (fndef
)));
24 /* Callback function to invoke after GCC finishes a function definition. */
26 void plugin_finish_parse_function (void *event_data
, void *data
)
28 tree fndef
= (tree
) event_data
;
29 warning (0, G_("Finish fndef %s"),
30 IDENTIFIER_POINTER (DECL_NAME (fndef
)));
34 plugin_init (struct plugin_name_args
*plugin_info
,
35 struct plugin_gcc_version
*version
)
37 const char *plugin_name
= plugin_info
->base_name
;
39 register_callback (plugin_name
, PLUGIN_START_PARSE_FUNCTION
,
40 plugin_start_parse_function
, NULL
);
42 register_callback (plugin_name
, PLUGIN_FINISH_PARSE_FUNCTION
,
43 plugin_finish_parse_function
, NULL
);