From 548767cadb370e5f59f907dd946d76e7b3884947 Mon Sep 17 00:00:00 2001 From: Stefan Becker Date: Sat, 27 Aug 2011 00:11:59 +0300 Subject: [PATCH] purple: add simple source upward compatibility path Lower one GCC error to a warning around the purple plugin callback table. If a newer libpurple API adds more entries to this table then the source code will still compile, i.e. an older pidgin-sipe release will most likely still be compilable against a newer Pidgin release. A compromise between strict error checking and user friendliness. --- src/purple/purple-plugin.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/purple/purple-plugin.c b/src/purple/purple-plugin.c index b9733e29..be2a9d52 100644 --- a/src/purple/purple-plugin.c +++ b/src/purple/purple-plugin.c @@ -464,6 +464,25 @@ static PurpleMediaCaps sipe_purple_get_media_caps(SIPE_UNUSED_PARAMETER PurpleAc #endif #endif +/* + * Simplistic source upward compatibility path for newer libpurple APIs + * + * Usually we compile with -Werror=missing-field-initializers if GCC supports + * it. But that means that the compilation of this structure can fail if the + * newer API has added additional plugin callbacks. For the benefit of the + * user we downgrade it to a warning here. + * + * Diagnostic #pragma was added in GCC 4.2.0 + * Diagnostic push/pop was added in GCC 4.6.0 + */ +#ifdef __GNUC__ +#if (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 2) +#if __GNUC_MINOR__ >= 6 +#pragma GCC diagnostic push +#endif +#pragma GCC diagnostic warning "-Wmissing-field-initializers" +#endif +#endif static PurplePluginProtocolInfo sipe_prpl_info = { OPT_PROTO_CHAT_TOPIC, @@ -558,6 +577,12 @@ static PurplePluginProtocolInfo sipe_prpl_info = #endif #endif }; +#ifdef __GNUC__ +#if (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 6) +#pragma GCC diagnostic pop +#endif +#endif +/* Original GCC error checking restored from here on... (see above) */ /* PurplePluginInfo function calls & data structure */ static gboolean sipe_purple_plugin_load(SIPE_UNUSED_PARAMETER PurplePlugin *plugin) -- 2.11.4.GIT