miniobject, memory, uri: warn on unused return value of some funcs

Make compiler issue a warning for common beginner mistakes such as:

  ...
  gst_buffer_make_writable (buf);
  gst_buffer_map (buf, &map, GST_MAP_WRITE);
  ...

and similar. Only do this for some functions for now.
This commit is contained in:
Tim-Philipp Müller 2016-03-05 14:27:35 +00:00
parent 3dff1c101f
commit 9df4bda65d
3 changed files with 8 additions and 8 deletions

View file

@ -351,13 +351,13 @@ void gst_memory_resize (GstMemory *mem, gssize offset, gsize siz
#define gst_memory_make_writable(m) GST_MEMORY_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (m)))
/* retrieving data */
GstMemory * gst_memory_make_mapped (GstMemory *mem, GstMapInfo *info, GstMapFlags flags);
GstMemory * gst_memory_make_mapped (GstMemory *mem, GstMapInfo *info, GstMapFlags flags) G_GNUC_WARN_UNUSED_RESULT;
gboolean gst_memory_map (GstMemory *mem, GstMapInfo *info, GstMapFlags flags);
void gst_memory_unmap (GstMemory *mem, GstMapInfo *info);
/* copy and subregions */
GstMemory * gst_memory_copy (GstMemory *mem, gssize offset, gssize size);
GstMemory * gst_memory_share (GstMemory *mem, gssize offset, gssize size);
GstMemory * gst_memory_copy (GstMemory *mem, gssize offset, gssize size) G_GNUC_WARN_UNUSED_RESULT;
GstMemory * gst_memory_share (GstMemory *mem, gssize offset, gssize size) G_GNUC_WARN_UNUSED_RESULT;
/* span memory */
gboolean gst_memory_is_span (GstMemory *mem1, GstMemory *mem2, gsize *offset);

View file

@ -237,10 +237,10 @@ gboolean gst_mini_object_lock (GstMiniObject *object, GstLockF
void gst_mini_object_unlock (GstMiniObject *object, GstLockFlags flags);
gboolean gst_mini_object_is_writable (const GstMiniObject *mini_object);
GstMiniObject * gst_mini_object_make_writable (GstMiniObject *mini_object);
GstMiniObject * gst_mini_object_make_writable (GstMiniObject *mini_object) G_GNUC_WARN_UNUSED_RESULT;
/* copy */
GstMiniObject * gst_mini_object_copy (const GstMiniObject *mini_object) G_GNUC_MALLOC;
GstMiniObject * gst_mini_object_copy (const GstMiniObject *mini_object) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
void gst_mini_object_set_qdata (GstMiniObject *object, GQuark quark,
@ -251,7 +251,7 @@ gpointer gst_mini_object_steal_qdata (GstMiniObject *object, GQuark q
gboolean gst_mini_object_replace (GstMiniObject **olddata, GstMiniObject *newdata);
gboolean gst_mini_object_take (GstMiniObject **olddata, GstMiniObject *newdata);
GstMiniObject * gst_mini_object_steal (GstMiniObject **olddata);
GstMiniObject * gst_mini_object_steal (GstMiniObject **olddata) G_GNUC_WARN_UNUSED_RESULT;
/**
* GST_DEFINE_MINI_OBJECT_TYPE:

View file

@ -209,11 +209,11 @@ GstUri * gst_uri_from_string_with_base (GstUri * base,
gboolean gst_uri_equal (const GstUri * first,
const GstUri * second);
GstUri * gst_uri_join (GstUri * base_uri,
GstUri * ref_uri);
GstUri * ref_uri) G_GNUC_WARN_UNUSED_RESULT;
gchar * gst_uri_join_strings (const gchar * base_uri,
const gchar * ref_uri) G_GNUC_MALLOC;
gboolean gst_uri_is_writable (const GstUri * uri);
GstUri * gst_uri_make_writable (GstUri * uri);
GstUri * gst_uri_make_writable (GstUri * uri) G_GNUC_WARN_UNUSED_RESULT;
gchar * gst_uri_to_string (const GstUri * uri) G_GNUC_MALLOC;
gboolean gst_uri_is_normalized (const GstUri * uri);
gboolean gst_uri_normalize (GstUri * uri);