[Spice-devel,client,3/3] spice-gtk: Use spice-protocol's SPICE_GNUC_DEPRECATED* macros

Submitted by Francois Gouget on Aug. 11, 2016, 2:30 p.m.

Details

Message ID f071eeba123b852a30bddae965bc90b33309edbd.1470923775.git.fgouget@free.fr
State New
Headers show
Series "Fixing the *_DEPRECATED set of macros" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Francois Gouget Aug. 11, 2016, 2:30 p.m.
- spice-protocol's macros have been improved to automatically work with
  GLib if available so there is no longer any justification for
  duplicating them in spice-gtk.
- This gets rid of spice-gtk's SPICE_DEPRECATED macro which was causing
  a naming conflict with the corresponding spice-protocol compilation
  directive.
- Finally replace SPICE_NO_DEPRECATED with spice-protocol's
  SPICE_DEPRECATED macro which has the exact same meaning despite the
  missing NO.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
---
 src/Makefile.am          |  2 +-
 src/channel-main.h       |  8 ++++----
 src/spice-audio.h        |  2 +-
 src/spice-channel.h      |  5 +++--
 src/spice-util.h         | 20 ++------------------
 src/usb-device-manager.h |  2 +-
 6 files changed, 12 insertions(+), 27 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/Makefile.am b/src/Makefile.am
index a820259..dddf9e3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -77,7 +77,7 @@  KEYMAP_GEN = $(srcdir)/keymap-gen.pl
 SPICE_COMMON_CPPFLAGS =						\
 	-DSPICE_COMPILATION					\
 	-DG_LOG_DOMAIN=\"GSpice\"				\
-	-DSPICE_NO_DEPRECATED					\
+	-DSPICE_DEPRECATED					\
 	-DSPICE_GTK_LOCALEDIR=\"${SPICE_GTK_LOCALEDIR}\"	\
 	-DPNP_IDS=\""$(PNP_IDS)"\"				\
 	-DUSB_IDS=\""$(USB_IDS)"\"				\
diff --git a/src/channel-main.h b/src/channel-main.h
index 3fe8df1..3d17793 100644
--- a/src/channel-main.h
+++ b/src/channel-main.h
@@ -101,13 +101,13 @@  gboolean spice_main_file_copy_finish(SpiceMainChannel *channel,
 void spice_main_request_mouse_mode(SpiceMainChannel *channel, int mode);
 
 #ifndef SPICE_DISABLE_DEPRECATED
-SPICE_DEPRECATED_FOR(spice_main_clipboard_selection_grab)
+SPICE_GNUC_DEPRECATED_FOR(spice_main_clipboard_selection_grab)
 void spice_main_clipboard_grab(SpiceMainChannel *channel, guint32 *types, int ntypes);
-SPICE_DEPRECATED_FOR(spice_main_clipboard_selection_release)
+SPICE_GNUC_DEPRECATED_FOR(spice_main_clipboard_selection_release)
 void spice_main_clipboard_release(SpiceMainChannel *channel);
-SPICE_DEPRECATED_FOR(spice_main_clipboard_selection_notify)
+SPICE_GNUC_DEPRECATED_FOR(spice_main_clipboard_selection_notify)
 void spice_main_clipboard_notify(SpiceMainChannel *channel, guint32 type, const guchar *data, size_t size);
-SPICE_DEPRECATED_FOR(spice_main_clipboard_selection_request)
+SPICE_GNUC_DEPRECATED_FOR(spice_main_clipboard_selection_request)
 void spice_main_clipboard_request(SpiceMainChannel *channel, guint32 type);
 #endif
 
diff --git a/src/spice-audio.h b/src/spice-audio.h
index 01f564a..6bd9a55 100644
--- a/src/spice-audio.h
+++ b/src/spice-audio.h
@@ -104,7 +104,7 @@  GType spice_audio_get_type(void);
 SpiceAudio* spice_audio_get(SpiceSession *session, GMainContext *context);
 
 #ifndef SPICE_DISABLE_DEPRECATED
-SPICE_DEPRECATED_FOR(spice_audio_get)
+SPICE_GNUC_DEPRECATED_FOR(spice_audio_get)
 SpiceAudio* spice_audio_new(SpiceSession *session, GMainContext *context, const char *name);
 #endif
 
diff --git a/src/spice-channel.h b/src/spice-channel.h
index 3b0bffb..aa0d9cb 100644
--- a/src/spice-channel.h
+++ b/src/spice-channel.h
@@ -24,6 +24,7 @@ 
 
 #include <gio/gio.h>
 
+#include <spice/macros.h>
 #include "spice-types.h"
 #include "spice-glib-enums.h"
 #include "spice-util.h"
@@ -136,9 +137,9 @@  gboolean spice_channel_test_common_capability(SpiceChannel *channel, guint32 cap
 void spice_channel_flush_async(SpiceChannel *channel, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
 gboolean spice_channel_flush_finish(SpiceChannel *channel, GAsyncResult *result, GError **error);
 #ifndef SPICE_DISABLE_DEPRECATED
-SPICE_DEPRECATED
+SPICE_GNUC_DEPRECATED
 void spice_channel_set_capability(SpiceChannel *channel, guint32 cap);
-SPICE_DEPRECATED
+SPICE_GNUC_DEPRECATED
 void spice_channel_destroy(SpiceChannel *channel);
 #endif
 
diff --git a/src/spice-util.h b/src/spice-util.h
index 88e3a57..7fc4c25 100644
--- a/src/spice-util.h
+++ b/src/spice-util.h
@@ -20,6 +20,8 @@ 
 
 #include <glib-object.h>
 
+#include <spice/macros.h>
+
 G_BEGIN_DECLS
 
 void spice_util_set_debug(gboolean enabled);
@@ -40,24 +42,6 @@  gchar* spice_uuid_to_string(const guint8 uuid[16]);
 
 #define SPICE_RESERVED_PADDING (10 * sizeof(void*))
 
-/* need to be in a public header */
-#ifndef SPICE_GNUC_DEPRECATED_FOR
-#if    __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
-#define SPICE_GNUC_DEPRECATED_FOR(f)                        \
-  __attribute__((deprecated("Use " #f " instead")))
-#else
-#define SPICE_GNUC_DEPRECATED_FOR(f)        G_GNUC_DEPRECATED
-#endif /* __GNUC__ */
-#endif
-
-#ifndef SPICE_NO_DEPRECATED
-#define SPICE_DEPRECATED_FOR(f)  SPICE_GNUC_DEPRECATED_FOR(f)
-#define SPICE_DEPRECATED  G_GNUC_DEPRECATED
-#else
-#define SPICE_DEPRECATED_FOR(f)
-#define SPICE_DEPRECATED
-#endif
-
 G_END_DECLS
 
 #endif /* SPICE_UTIL_H */
diff --git a/src/usb-device-manager.h b/src/usb-device-manager.h
index 6a8d0ac..219fe44 100644
--- a/src/usb-device-manager.h
+++ b/src/usb-device-manager.h
@@ -131,7 +131,7 @@  gboolean spice_usb_device_manager_disconnect_device_finish(
     SpiceUsbDeviceManager *self, GAsyncResult *res, GError **err);
 
 #ifndef SPICE_DISABLE_DEPRECATED
-SPICE_DEPRECATED
+SPICE_GNUC_DEPRECATED
 void spice_usb_device_manager_disconnect_device(SpiceUsbDeviceManager *manager,
                                                 SpiceUsbDevice *device);
 #endif