Be careful about comdat boundary in ICF (PR ipa/82352).
[official-gcc.git] / gcc / testsuite / g++.dg / plugin / def_plugin.c
blob63983c5f183869b002c30fcc5c7fccf9710d93eb
1 /* A plugin example that shows which function definitions are caught by PLUGIN_START_FUNCTION and PLUGIN_FINISH_FUNCTION */
3 #include "gcc-plugin.h"
4 #include <stdlib.h>
5 #include "config.h"
6 #include "system.h"
7 #include "coretypes.h"
8 #include "tree.h"
9 #include "tree-pass.h"
10 #include "intl.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)));
33 int
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);
44 return 0;