gst: add GST_DEPRECATED_FOR() and also export deprecated symbols
authorTim-Philipp Müller <tim@centricular.com>
Wed, 10 May 2017 12:07:31 +0000 (13:07 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Mon, 15 May 2017 22:14:20 +0000 (23:14 +0100)
Can't use a #ifndef GST_DISABLE_DEPRECATED guard around deprecated
functions any more, as they won't get exported then. Besides, we
get a nicer error message from the compiler telling us what function
to use instead this way.

gst/gstconfig.h.in
gst/gstobject.c
gst/gstobject.h
gst/gstsegment.c
gst/gstsegment.h

index 1b2ca64..801fa40 100644 (file)
 # endif
 #endif
 
+/* These macros are used to mark deprecated functions in GStreamer headers,
+ * and thus have to be exposed in installed headers. But please
+ * do *not* use them in other projects. Instead, use G_DEPRECATED
+ * or define your own wrappers around it. */
+#ifdef GST_DISABLE_DEPRECATED
+#define GST_DEPRECATED GST_EXPORT
+#define GST_DEPRECATED_FOR(f) GST_EXPORT
+#else
+#define GST_DEPRECATED G_DEPRECATED GST_EXPORT
+#define GST_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) GST_EXPORT
+#endif
+
 #endif /* __GST_CONFIG_H__ */
index 04daaac..32a406d 100644 (file)
@@ -835,11 +835,7 @@ gst_object_has_as_ancestor (GstObject * object, GstObject * ancestor)
  *
  * MT safe. Grabs and releases @object's locks.
  */
-/* FIXME 2.0: remove */
 #ifndef GST_REMOVE_DEPRECATED
-#ifdef GST_DISABLE_DEPRECATED
-gboolean gst_object_has_ancestor (GstObject * object, GstObject * ancestor);
-#endif
 gboolean
 gst_object_has_ancestor (GstObject * object, GstObject * ancestor)
 {
index 76a6800..4021a26 100644 (file)
@@ -239,10 +239,8 @@ gboolean   gst_object_has_as_parent                (GstObject *object, GstObject *parent);
 GST_EXPORT
 gboolean       gst_object_has_as_ancestor      (GstObject *object, GstObject *ancestor);
 
-#ifndef GST_DISABLE_DEPRECATED
-GST_EXPORT
+GST_DEPRECATED_FOR(gst_object_has_as_ancestor)
 gboolean       gst_object_has_ancestor         (GstObject *object, GstObject *ancestor);
-#endif
 
 GST_EXPORT
 void            gst_object_default_deep_notify  (GObject *object, GstObject *orig,
index 8db09df..21d8d9a 100644 (file)
@@ -1081,10 +1081,6 @@ gst_segment_position_from_running_time_full (const GstSegment * segment,
  * Deprecated. Use gst_segment_position_from_running_time() instead.
  */
 #ifndef GST_REMOVE_DEPRECATED
-#ifdef GST_DISABLE_DEPRECATED
-guint64 gst_segment_to_position (const GstSegment * segment, GstFormat format,
-    guint64 running_time);
-#endif
 guint64
 gst_segment_to_position (const GstSegment * segment, GstFormat format,
     guint64 running_time)
index fef6108..aab0a72 100644 (file)
@@ -245,10 +245,10 @@ guint64      gst_segment_to_running_time     (const GstSegment *segment, GstForm
 GST_EXPORT
 gint         gst_segment_to_running_time_full (const GstSegment *segment, GstFormat format, guint64 position,
                                                guint64 * running_time);
-#ifndef GST_DISABLE_DEPRECATED
-GST_EXPORT
+
+GST_DEPRECATED_FOR(gst_segment_position_from_running_time)
 guint64      gst_segment_to_position         (const GstSegment *segment, GstFormat format, guint64 running_time);
-#endif
+
 GST_EXPORT
 gint         gst_segment_position_from_running_time_full (const GstSegment *segment, GstFormat format, guint64 running_time, guint64 * position);