diff options
author | espindola <espindola@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-29 13:20:53 +0000 |
---|---|---|
committer | espindola <espindola@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-29 13:20:53 +0000 |
commit | e8ad34e4a69a29cb786009ded39aa33ab13cf6bf (patch) | |
tree | bc30f317d77a84e251fb2c5a1c24dff6ffcfd42a /gcc/plugin.c | |
parent | b7edc5bbf7f1095d6bef337a223cf400adde46f1 (diff) | |
download | gcc-e8ad34e4a69a29cb786009ded39aa33ab13cf6bf.tar.gz |
2009-04-29 Rafael Avila de Espindola <espindola@google.com>
* Makefile.in (PLUGIN_VERSION_H): New.
(OBJS-common): Remove plugin-version.o.
(plugin.o): Depend on (PLUGIN_VERSION_H).
(plugin-version.o): Remove.
* configure: Regenerate
* configure.ac: Create plugin-version.h.
* gcc-plugin.h (plugin_gcc_version): Remove.
(plugin_default_version_check): Change signature.
* plugin-version.c: Remove.
* plugin.c: Include plugin-version.h.
(str_plugin_gcc_version_name): Remove.
(try_init_one_plugin): Pass gcc version to plugin_init.
(plugin_default_version_check): Both gcc and plugin versions are now
arguments.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146962 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/plugin.c')
-rw-r--r-- | gcc/plugin.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/gcc/plugin.c b/gcc/plugin.c index c406c38b5f3..3b7cc78a193 100644 --- a/gcc/plugin.c +++ b/gcc/plugin.c @@ -38,6 +38,7 @@ along with GCC; see the file COPYING3. If not see #include "intl.h" #include "plugin.h" #include "timevar.h" +#include "plugin-version.h" /* Event names as strings. Keep in sync with enum plugin_event. */ const char *plugin_event_name[] = @@ -99,7 +100,6 @@ static struct pass_list_node *prev_added_pass_node; /* Each plugin should define an initialization function with exactly this name. */ static const char *str_plugin_init_func_name = "plugin_init"; -static const char *str_plugin_gcc_version_name = "plugin_gcc_version"; #endif /* Helper function for the hash table that compares the base_name of the @@ -567,10 +567,8 @@ try_init_one_plugin (struct plugin_name_args *plugin) { void *dl_handle; plugin_init_func plugin_init; - struct plugin_gcc_version *version; char *err; PTR_UNION_TYPE (plugin_init_func) plugin_init_union; - PTR_UNION_TYPE (struct plugin_gcc_version*) version_union; dl_handle = dlopen (plugin->full_name, RTLD_NOW); if (!dl_handle) @@ -593,12 +591,9 @@ try_init_one_plugin (struct plugin_name_args *plugin) return false; } - PTR_UNION_AS_VOID_PTR (version_union) = - dlsym (dl_handle, str_plugin_gcc_version_name); - version = PTR_UNION_AS_CAST_PTR (version_union); - /* Call the plugin-provided initialization routine with the arguments. */ - if ((*plugin_init) (plugin->base_name, version, plugin->argc, plugin->argv)) + if ((*plugin_init) (plugin->base_name, &gcc_version, plugin->argc, + plugin->argv)) { error ("Fail to initialize plugin %s", plugin->full_name); return false; @@ -816,22 +811,23 @@ debug_active_plugins (void) /* The default version check. Compares every field in VERSION. */ bool -plugin_default_version_check(struct plugin_gcc_version *version) +plugin_default_version_check (struct plugin_gcc_version *gcc_version, + struct plugin_gcc_version *plugin_version) { /* version is NULL if the plugin was not linked with plugin-version.o */ - if (!version) + if (!gcc_version || !plugin_version) return false; - if (strcmp (version->basever, plugin_gcc_version.basever)) + if (strcmp (gcc_version->basever, plugin_version->basever)) return false; - if (strcmp (version->datestamp, plugin_gcc_version.datestamp)) + if (strcmp (gcc_version->datestamp, plugin_version->datestamp)) return false; - if (strcmp (version->devphase, plugin_gcc_version.devphase)) + if (strcmp (gcc_version->devphase, plugin_version->devphase)) return false; - if (strcmp (version->revision, plugin_gcc_version.revision)) + if (strcmp (gcc_version->revision, plugin_version->revision)) return false; - if (strcmp (version->configuration_arguments, - plugin_gcc_version.configuration_arguments)) + if (strcmp (gcc_version->configuration_arguments, + plugin_version->configuration_arguments)) return false; return true; } |