Re: RFC: warnings on ignoring return value on some list operations



On Thu, 2005-12-01 at 12:39 +0100, Tim Janik wrote:

> and there were no strong objections after that. so it'd be nice if you provided
> a patch that covered all list functions. i think that can get commit approval
> right away then.

What about this one.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's an underprivileged drug-addicted cat burglar moving from town to town, 
helping folk in trouble. She's a sharp-shooting hypochondriac advertising 
executive with a flame-thrower. They fight crime! 
? a
? glib-display-filenames.patch
? gobject-memuse.patch
? glib/gettext-filenames-try1.patch
? glib/gettext-filenames.patch
? glib/gettext-files.patch
Index: glib/glist.h
===================================================================
RCS file: /cvs/gnome/glib/glib/glist.h,v
retrieving revision 1.8
diff -u -p -r1.8 glist.h
--- glib/glist.h	8 Nov 2002 18:47:54 -0000	1.8
+++ glib/glist.h	1 Dec 2005 17:38:27 -0000
@@ -44,34 +44,34 @@ struct _GList
  */
 void     g_list_push_allocator (GAllocator       *allocator);
 void     g_list_pop_allocator  (void);
-GList*   g_list_alloc          (void);
+GList*   g_list_alloc          (void) G_GNUC_WARN_UNUSED_RESULT;
 void     g_list_free           (GList            *list);
 void     g_list_free_1         (GList            *list);
 GList*   g_list_append         (GList            *list,
-				gpointer          data);
+				gpointer          data) G_GNUC_WARN_UNUSED_RESULT;
 GList*   g_list_prepend        (GList            *list,
-				gpointer          data);
+				gpointer          data) G_GNUC_WARN_UNUSED_RESULT;
 GList*   g_list_insert         (GList            *list,
 				gpointer          data,
-				gint              position);
+				gint              position) G_GNUC_WARN_UNUSED_RESULT;
 GList*   g_list_insert_sorted  (GList            *list,
 				gpointer          data,
-				GCompareFunc      func);
+				GCompareFunc      func) G_GNUC_WARN_UNUSED_RESULT;
 GList*   g_list_insert_before  (GList            *list,
 				GList            *sibling,
-				gpointer          data);
+				gpointer          data) G_GNUC_WARN_UNUSED_RESULT;
 GList*   g_list_concat         (GList            *list1,
-				GList            *list2);
+				GList            *list2) G_GNUC_WARN_UNUSED_RESULT;
 GList*   g_list_remove         (GList            *list,
-				gconstpointer     data);
+				gconstpointer     data) G_GNUC_WARN_UNUSED_RESULT;
 GList*   g_list_remove_all     (GList            *list,
-				gconstpointer     data);
+				gconstpointer     data) G_GNUC_WARN_UNUSED_RESULT;
 GList*   g_list_remove_link    (GList            *list,
-				GList            *llink);
+				GList            *llink) G_GNUC_WARN_UNUSED_RESULT;
 GList*   g_list_delete_link    (GList            *list,
-				GList            *link_);
-GList*   g_list_reverse        (GList            *list);
-GList*   g_list_copy           (GList            *list);
+				GList            *link_) G_GNUC_WARN_UNUSED_RESULT;
+GList*   g_list_reverse        (GList            *list) G_GNUC_WARN_UNUSED_RESULT;
+GList*   g_list_copy           (GList            *list) G_GNUC_WARN_UNUSED_RESULT;
 GList*   g_list_nth            (GList            *list,
 				guint             n);
 GList*   g_list_nth_prev       (GList            *list,
@@ -92,10 +92,10 @@ void     g_list_foreach        (GList   
 				GFunc             func,
 				gpointer          user_data);
 GList*   g_list_sort           (GList            *list,
-				GCompareFunc      compare_func);
+				GCompareFunc      compare_func)  G_GNUC_WARN_UNUSED_RESULT;
 GList*   g_list_sort_with_data (GList            *list,
 				GCompareDataFunc  compare_func,
-				gpointer          user_data);
+				gpointer          user_data)  G_GNUC_WARN_UNUSED_RESULT;
 gpointer g_list_nth_data       (GList            *list,
 				guint             n);
 
Index: glib/gmacros.h
===================================================================
RCS file: /cvs/gnome/glib/glib/gmacros.h,v
retrieving revision 1.26
diff -u -p -r1.26 gmacros.h
--- glib/gmacros.h	8 Mar 2005 05:41:42 -0000	1.26
+++ glib/gmacros.h	1 Dec 2005 17:38:27 -0000
@@ -95,6 +95,13 @@
 #define G_GNUC_DEPRECATED
 #endif /* __GNUC__ */
 
+#if    __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#define G_GNUC_WARN_UNUSED_RESULT 		\
+  __attribute__((warn_unused_result))
+#else
+#define G_GNUC_WARN_UNUSED_RESULT
+#endif /* __GNUC__ */
+
 /* Wrap the gcc __PRETTY_FUNCTION__ and __FUNCTION__ variables with
  * macros, so we can refer to them as strings unconditionally.
  * usage not-recommended since gcc-3.0
Index: glib/gslist.h
===================================================================
RCS file: /cvs/gnome/glib/glib/gslist.h,v
retrieving revision 1.6
diff -u -p -r1.6 gslist.h
--- glib/gslist.h	8 Nov 2002 18:47:54 -0000	1.6
+++ glib/gslist.h	1 Dec 2005 17:38:27 -0000
@@ -43,34 +43,34 @@ struct _GSList
  */
 void     g_slist_push_allocator (GAllocator       *allocator);
 void     g_slist_pop_allocator  (void);
-GSList*  g_slist_alloc          (void);
+GSList*  g_slist_alloc          (void)  G_GNUC_WARN_UNUSED_RESULT;
 void     g_slist_free           (GSList           *list);
 void     g_slist_free_1         (GSList           *list);
 GSList*  g_slist_append         (GSList           *list,
-				 gpointer          data);
+				 gpointer          data) G_GNUC_WARN_UNUSED_RESULT;
 GSList*  g_slist_prepend        (GSList           *list,
-				 gpointer          data);
+				 gpointer          data)  G_GNUC_WARN_UNUSED_RESULT;
 GSList*  g_slist_insert         (GSList           *list,
 				 gpointer          data,
-				 gint              position);
+				 gint              position) G_GNUC_WARN_UNUSED_RESULT;
 GSList*  g_slist_insert_sorted  (GSList           *list,
 				 gpointer          data,
-				 GCompareFunc      func);
+				 GCompareFunc      func)  G_GNUC_WARN_UNUSED_RESULT;
 GSList*  g_slist_insert_before  (GSList           *slist,
 				 GSList           *sibling,
-				 gpointer          data);
+				 gpointer          data) G_GNUC_WARN_UNUSED_RESULT;
 GSList*  g_slist_concat         (GSList           *list1,
-				 GSList           *list2);
+				 GSList           *list2) G_GNUC_WARN_UNUSED_RESULT;
 GSList*  g_slist_remove         (GSList           *list,
-				 gconstpointer     data);
+				 gconstpointer     data)  G_GNUC_WARN_UNUSED_RESULT;
 GSList*  g_slist_remove_all     (GSList           *list,
-				 gconstpointer     data);
+				 gconstpointer     data)  G_GNUC_WARN_UNUSED_RESULT;
 GSList*  g_slist_remove_link    (GSList           *list,
-				 GSList           *link_);
+				 GSList           *link_) G_GNUC_WARN_UNUSED_RESULT;
 GSList*  g_slist_delete_link    (GSList           *list,
-				 GSList           *link_);
-GSList*  g_slist_reverse        (GSList           *list);
-GSList*  g_slist_copy           (GSList           *list);
+				 GSList           *link_) G_GNUC_WARN_UNUSED_RESULT;
+GSList*  g_slist_reverse        (GSList           *list)  G_GNUC_WARN_UNUSED_RESULT;
+GSList*  g_slist_copy           (GSList           *list)  G_GNUC_WARN_UNUSED_RESULT;
 GSList*  g_slist_nth            (GSList           *list,
 				 guint             n);
 GSList*  g_slist_find           (GSList           *list,
@@ -88,10 +88,10 @@ void     g_slist_foreach        (GSList 
 				 GFunc             func,
 				 gpointer          user_data);
 GSList*  g_slist_sort           (GSList           *list,
-				 GCompareFunc      compare_func);
+				 GCompareFunc      compare_func)  G_GNUC_WARN_UNUSED_RESULT;
 GSList*  g_slist_sort_with_data (GSList           *list,
 				 GCompareDataFunc  compare_func,
-				 gpointer          user_data);
+				 gpointer          user_data)  G_GNUC_WARN_UNUSED_RESULT;
 gpointer g_slist_nth_data       (GSList           *list,
 				 guint             n);
 #define  g_slist_next(slist)	((slist) ? (((GSList *)(slist))->next) : NULL)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]