1*e4b17023SJohn Marino /* Header file for internal GCC plugin mechanism.
2*e4b17023SJohn Marino Copyright (C) 2009, 2010 Free Software Foundation, Inc.
3*e4b17023SJohn Marino
4*e4b17023SJohn Marino This file is part of GCC.
5*e4b17023SJohn Marino
6*e4b17023SJohn Marino GCC is free software; you can redistribute it and/or modify
7*e4b17023SJohn Marino it under the terms of the GNU General Public License as published by
8*e4b17023SJohn Marino the Free Software Foundation; either version 3, or (at your option)
9*e4b17023SJohn Marino any later version.
10*e4b17023SJohn Marino
11*e4b17023SJohn Marino GCC is distributed in the hope that it will be useful,
12*e4b17023SJohn Marino but WITHOUT ANY WARRANTY; without even the implied warranty of
13*e4b17023SJohn Marino MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14*e4b17023SJohn Marino GNU General Public License for more details.
15*e4b17023SJohn Marino
16*e4b17023SJohn Marino You should have received a copy of the GNU General Public License
17*e4b17023SJohn Marino along with GCC; see the file COPYING3. If not see
18*e4b17023SJohn Marino <http://www.gnu.org/licenses/>. */
19*e4b17023SJohn Marino
20*e4b17023SJohn Marino #ifndef PLUGIN_H
21*e4b17023SJohn Marino #define PLUGIN_H
22*e4b17023SJohn Marino
23*e4b17023SJohn Marino #include "gcc-plugin.h"
24*e4b17023SJohn Marino
25*e4b17023SJohn Marino struct attribute_spec;
26*e4b17023SJohn Marino
27*e4b17023SJohn Marino extern void add_new_plugin (const char *);
28*e4b17023SJohn Marino extern void parse_plugin_arg_opt (const char *);
29*e4b17023SJohn Marino extern int invoke_plugin_callbacks_full (int, void *);
30*e4b17023SJohn Marino extern void initialize_plugins (void);
31*e4b17023SJohn Marino extern bool plugins_active_p (void);
32*e4b17023SJohn Marino extern void dump_active_plugins (FILE *);
33*e4b17023SJohn Marino extern void debug_active_plugins (void);
34*e4b17023SJohn Marino extern void warn_if_plugins (void);
35*e4b17023SJohn Marino extern void plugins_internal_error_function (diagnostic_context *,
36*e4b17023SJohn Marino const char *, va_list *);
37*e4b17023SJohn Marino extern void print_plugins_versions (FILE *file, const char *indent);
38*e4b17023SJohn Marino extern void print_plugins_help (FILE *file, const char *indent);
39*e4b17023SJohn Marino extern void finalize_plugins (void);
40*e4b17023SJohn Marino
41*e4b17023SJohn Marino extern bool flag_plugin_added;
42*e4b17023SJohn Marino
43*e4b17023SJohn Marino /* Called from inside GCC. Invoke all plugin callbacks registered with
44*e4b17023SJohn Marino the specified event.
45*e4b17023SJohn Marino Return PLUGEVT_SUCCESS if at least one callback was called,
46*e4b17023SJohn Marino PLUGEVT_NO_CALLBACK if there was no callback.
47*e4b17023SJohn Marino
48*e4b17023SJohn Marino EVENT - the event identifier
49*e4b17023SJohn Marino GCC_DATA - event-specific data provided by the compiler */
50*e4b17023SJohn Marino
51*e4b17023SJohn Marino static inline int
invoke_plugin_callbacks(int event ATTRIBUTE_UNUSED,void * gcc_data ATTRIBUTE_UNUSED)52*e4b17023SJohn Marino invoke_plugin_callbacks (int event ATTRIBUTE_UNUSED,
53*e4b17023SJohn Marino void *gcc_data ATTRIBUTE_UNUSED)
54*e4b17023SJohn Marino {
55*e4b17023SJohn Marino #ifdef ENABLE_PLUGIN
56*e4b17023SJohn Marino /* True iff at least one plugin has been added. */
57*e4b17023SJohn Marino if (flag_plugin_added)
58*e4b17023SJohn Marino return invoke_plugin_callbacks_full (event, gcc_data);
59*e4b17023SJohn Marino #endif
60*e4b17023SJohn Marino
61*e4b17023SJohn Marino return PLUGEVT_NO_CALLBACK;
62*e4b17023SJohn Marino }
63*e4b17023SJohn Marino
64*e4b17023SJohn Marino /* In attribs.c. */
65*e4b17023SJohn Marino
66*e4b17023SJohn Marino extern void register_attribute (const struct attribute_spec *attr);
67*e4b17023SJohn Marino
68*e4b17023SJohn Marino #endif /* PLUGIN_H */
69