aboutsummaryrefslogtreecommitdiff
path: root/gcc/plugin.h
diff options
context:
space:
mode:
authorBrian Hackett <bhackett1024@gmail.com>2010-04-29 09:01:56 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2010-04-29 09:01:56 +0000
commitefda38075b9e028be7e6b99c0632c5bbb27a799b (patch)
treec18099c8f924d3a704cd687045a9ca83b40a4f28 /gcc/plugin.h
parent2942c502ee147819b7e57dca78f7a2cf4831279f (diff)
downloadgcc-efda38075b9e028be7e6b99c0632c5bbb27a799b.zip
gcc-efda38075b9e028be7e6b99c0632c5bbb27a799b.tar.gz
gcc-efda38075b9e028be7e6b99c0632c5bbb27a799b.tar.bz2
plugin.h (invoke_plugin_callbacks): New inline function.
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. From-SVN: r158896
Diffstat (limited to 'gcc/plugin.h')
-rw-r--r--gcc/plugin.h26
1 files changed, 24 insertions, 2 deletions
diff --git a/gcc/plugin.h b/gcc/plugin.h
index 1e1dd59..13628ec9 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);