Message ID | 20100608083646.xy0ergvgroskoogk-nzlynne@webmail.spamcop.net |
---|---|
State | New |
Headers | show |
On Tue, Jun 8, 2010 at 2:36 PM, Joern Rennecke <amylaar@spamcop.net> wrote: > I have divided the patch set for this PR into two parts to allow separate > review: > This one, the first part, changes only gcc-plugin.h ; the purpose of this > file is quite obviously to provide a part of the plugin interface. > > Bootstrapped and regression tested in 160389 with --enable-build-with-cxx > > This patch by itself allows testsuite/gcc.dg/plugin/one_time_plugin.c to > be compiled with gcc into a functioning gcc plugin. > > I would consider this patch alone a possible fix for PR 44459, although I'd > prefer to have more functionality supported, as would be available by > combining > both parts of this patch set, or this part with a modified second part. Ok. Thanks, Richard. > > 2010-06-08 Joern Rennecke <joern.rennecke@embecosm.com> > > PR plugins/44459: > * gcc-plugin.h: Encapsulate all declarations in extern "C". > > Index: gcc-plugin.h > =================================================================== > --- gcc-plugin.h (revision 160389) > +++ gcc-plugin.h (working copy) > @@ -38,6 +38,12 @@ enum plugin_event > PLUGIN_EVENT_FIRST_DYNAMIC > }; > > +/* All globals declared here have C linkage to reduce link compatibility > + issues with implementation language choice and mangling. */ > +#ifdef __cplusplus > +extern "C" { > +#endif > + > extern const char **plugin_event_name; > > struct plugin_argument > @@ -96,16 +102,10 @@ extern bool plugin_default_version_check > typedef int (*plugin_init_func) (struct plugin_name_args *plugin_info, > struct plugin_gcc_version *version); > > -#ifdef __cplusplus > -extern "C" { > -#endif > /* Declaration for "plugin_init" function so that it doesn't need to be > duplicated in every plugin. */ > extern int plugin_init (struct plugin_name_args *plugin_info, > struct plugin_gcc_version *version); > -#ifdef __cplusplus > -} > -#endif > > /* Function type for a plugin callback routine. > > @@ -147,4 +147,8 @@ extern int unregister_callback (const ch > -iplugindir program argument to cc1. */ > extern const char* default_plugin_dir_name (void); > > +#ifdef __cplusplus > +} > +#endif > + > #endif /* GCC_PLUGIN_H */ > >
Index: gcc-plugin.h =================================================================== --- gcc-plugin.h (revision 160389) +++ gcc-plugin.h (working copy) @@ -38,6 +38,12 @@ enum plugin_event PLUGIN_EVENT_FIRST_DYNAMIC }; +/* All globals declared here have C linkage to reduce link compatibility + issues with implementation language choice and mangling. */ +#ifdef __cplusplus +extern "C" { +#endif + extern const char **plugin_event_name; struct plugin_argument @@ -96,16 +102,10 @@ extern bool plugin_default_version_check typedef int (*plugin_init_func) (struct plugin_name_args *plugin_info, struct plugin_gcc_version *version); -#ifdef __cplusplus -extern "C" { -#endif /* Declaration for "plugin_init" function so that it doesn't need to be duplicated in every plugin. */ extern int plugin_init (struct plugin_name_args *plugin_info, struct plugin_gcc_version *version); -#ifdef __cplusplus -} -#endif /* Function type for a plugin callback routine. @@ -147,4 +147,8 @@ extern int unregister_callback (const ch -iplugindir program argument to cc1. */ extern const char* default_plugin_dir_name (void); +#ifdef __cplusplus +} +#endif + #endif /* GCC_PLUGIN_H */