Skip to content

Commit

Permalink
Add prototypes for all plugin symbols
Browse files Browse the repository at this point in the history
This allows the compilers to check that the plugin's symbols have the
proper prototype.  Doing so can avoid subtle and hard-to-find bugs in
case a plugin's symbol has incorrect signature as dlsym() can't check
if the signature is actually the one we expect.

As a bonus, it helps when using -Wmissing-prototypes as it provides the
prototypes.
  • Loading branch information
b4n committed Oct 20, 2014
1 parent c35dedf commit d4135c9
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions src/plugindata.h
Expand Up @@ -157,15 +157,6 @@ GeanyPlugin;
}


#ifndef GEANY_PRIVATE

/* Prototypes for building plugins with -Wmissing-prototypes */
gint plugin_version_check(gint abi_ver);
void plugin_set_info(PluginInfo *info);

#endif


/** @deprecated - use plugin_set_key_group() instead.
* @see PLUGIN_KEY_GROUP() macro. */
typedef struct GeanyKeyGroupInfo
Expand Down Expand Up @@ -258,6 +249,23 @@ GeanyData;
#define geany geany_data /**< Simple macro for @c geany_data that reduces typing. */


#ifndef GEANY_PRIVATE

/* Prototypes for building plugins with -Wmissing-prototypes
* Also allows the compiler to check if the signature of the plugin's
* symbol properly matches what we expect. */
gint plugin_version_check(gint abi_ver);
void plugin_set_info(PluginInfo *info);

void plugin_init(GeanyData *data);
GtkWidget *plugin_configure(GtkDialog *dialog);
void plugin_configure_single(GtkWidget *parent);
void plugin_help(void);
void plugin_cleanup(void);

#endif


/** This contains pointers to functions owned by Geany for plugins to use.
* Functions from the core can be appended when needed by plugin authors, but may
* require some changes. */
Expand Down

0 comments on commit d4135c9

Please sign in to comment.