diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-04-29 09:01:56 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-04-29 09:01:56 +0000 |
commit | a3f551d2aa2897518373ac025e3ebac5284aab36 (patch) | |
tree | c18099c8f924d3a704cd687045a9ca83b40a4f28 /gcc/plugin.h | |
parent | 0cddb138341aafca38ae8d099c98750b5b34b8b2 (diff) | |
download | gcc-a3f551d2aa2897518373ac025e3ebac5284aab36.tar.gz |
2010-04-29 Brian Hackett <bhackett1024@gmail.com>
* plugin.h (invoke_plugin_callbacks): New inline function.
* plugin.c (flag_plugin_added): New global flag.
(add_new_plugin): Initialize above flag.
(invoke_plugin_callbacks): Rename to ...
(invoke_plugin_callbacks_full): ... this.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158896 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/plugin.h')
-rw-r--r-- | gcc/plugin.h | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/gcc/plugin.h b/gcc/plugin.h index 1e1dd594937..13628ec910b 100644 --- a/gcc/plugin.h +++ b/gcc/plugin.h @@ -1,5 +1,5 @@ /* Header file for internal GCC plugin mechanism. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010 Free Software Foundation, Inc. This file is part of GCC. @@ -26,7 +26,7 @@ struct attribute_spec; extern void add_new_plugin (const char *); extern void parse_plugin_arg_opt (const char *); -extern int invoke_plugin_callbacks (int, void *); +extern int invoke_plugin_callbacks_full (int, void *); extern void initialize_plugins (void); extern bool plugins_active_p (void); extern void dump_active_plugins (FILE *); @@ -35,6 +35,28 @@ extern void print_plugins_versions (FILE *file, const char *indent); extern void print_plugins_help (FILE *file, const char *indent); extern void finalize_plugins (void); +/* Called from inside GCC. Invoke all plugin callbacks registered with + the specified event. + Return PLUGEVT_SUCCESS if at least one callback was called, + PLUGEVT_NO_CALLBACK if there was no callback. + + EVENT - the event identifier + GCC_DATA - event-specific data provided by the compiler */ + +static inline int +invoke_plugin_callbacks (int event, void *gcc_data) +{ +#ifdef ENABLE_PLUGIN + /* True iff at least one plugin has been added. */ + extern bool flag_plugin_added; + + if (flag_plugin_added) + return invoke_plugin_callbacks_full (event, gcc_data); +#endif + + return PLUGEVT_NO_CALLBACK; +} + /* In attribs.c. */ extern void register_attribute (const struct attribute_spec *attr); |