[Spice-devel] [PATCH spice-gtk] G_GNUC_DEPRECATED_FOR must be defined publicly
Marc-André Lureau
marcandre.lureau at gmail.com
Fri Sep 7 07:59:31 PDT 2012
It's not enough to define G_GNUC_DEPRECATED_FOR in glib-compat.h,
since this header is not public. Instead, let's define our own
public SPICE_DEPRECATED_FOR macro, and clean-up double definition.
---
gtk/glib-compat.h | 16 ----------------
gtk/spice-util.h | 12 +++++++++++-
2 files changed, 11 insertions(+), 17 deletions(-)
diff --git a/gtk/glib-compat.h b/gtk/glib-compat.h
index a9efda3..909b4e1 100644
--- a/gtk/glib-compat.h
+++ b/gtk/glib-compat.h
@@ -67,13 +67,6 @@ type_name##_get_type (void) \
#define G_TYPE_ERROR (spice_error_get_type ())
GType spice_error_get_type (void) G_GNUC_CONST;
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
-#define G_GNUC_DEPRECATED_FOR(f) \
- __attribute__((deprecated("Use " #f " instead")))
-#else
-#define G_GNUC_DEPRECATED_FOR(f) G_GNUC_DEPRECATED
-#endif /* __GNUC__ */
-
#define G_PARAM_DEPRECATED (1 << 31)
#endif /* glib 2.26 */
@@ -126,13 +119,4 @@ GType spice_main_context_get_type (void) G_GNUC_CONST;
} G_STMT_END
#endif
-#ifndef G_GNUC_DEPRECATED_FOR
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
-#define G_GNUC_DEPRECATED_FOR(f) \
- __attribute__((deprecated("Use " #f " instead")))
-#else
-#define G_GNUC_DEPRECATED_FOR(f) G_GNUC_DEPRECATED
-#endif /* __GNUC__ */
-#endif
-
#endif /* GLIB_COMPAT_H */
diff --git a/gtk/spice-util.h b/gtk/spice-util.h
index 271f3be..6996e55 100644
--- a/gtk/spice-util.h
+++ b/gtk/spice-util.h
@@ -39,8 +39,18 @@ gulong spice_g_signal_connect_object(gpointer instance,
#define SPICE_RESERVED_PADDING (10 * sizeof(void*))
+/* need to be in a public header, glib-compat.h is private */
+#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) G_GNUC_DEPRECATED_FOR(f)
+#define SPICE_DEPRECATED_FOR(f) SPICE_GNUC_DEPRECATED_FOR(f)
#define SPICE_DEPRECATED G_GNUC_DEPRECATED
#else
#define SPICE_DEPRECATED_FOR(f)
--
1.7.11.4
More information about the Spice-devel
mailing list