[clutter-gtk] Add G_GNUC_WARN_UNUSED_RESULT annotation to init functions
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter-gtk] Add G_GNUC_WARN_UNUSED_RESULT annotation to init functions
- Date: Thu, 6 Oct 2011 09:32:31 +0000 (UTC)
commit e2961c1149b99e2e25ee6207c35b81322237a3dd
Author: Emmanuele Bassi <ebassi gnome org>
Date: Thu Oct 6 10:26:31 2011 +0100
Add G_GNUC_WARN_UNUSED_RESULT annotation to init functions
This has started to be a problem; applications using clutter-gtk just
assume that clutter-gtk will abort() if the initialization does not
succeed, just like gtk+ does. Clutter, on the other hand, has a non
fatal init - it'll return an error code for you to trap. This is more
of an historical accident, but we cannot change the semantics now. If
Clutter fails to initialize, any subsequent call to Clutter or Cogl
functions will have undefined results - most likely they'll end up in
a segfault somewhere down the line, but all bets are off.
Clutter started annotating its init functions to generate a compile
time warning if the return value is not being assigned; clutter-gtk
ought to do the same, to avoid mystery segfault bugs being filed.
clutter-gtk/gtk-clutter-util.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/clutter-gtk/gtk-clutter-util.h b/clutter-gtk/gtk-clutter-util.h
index b7b57b7..6621a2a 100644
--- a/clutter-gtk/gtk-clutter-util.h
+++ b/clutter-gtk/gtk-clutter-util.h
@@ -32,13 +32,13 @@
G_BEGIN_DECLS
ClutterInitError gtk_clutter_init (int *argc,
- char ***argv);
+ char ***argv) G_GNUC_WARN_UNUSED_RESULT;
ClutterInitError gtk_clutter_init_with_args (int *argc,
char ***argv,
const char *parameter_string,
GOptionEntry *entries,
const char *translation_domain,
- GError **error);
+ GError **error) G_GNUC_WARN_UNUSED_RESULT;
GOptionGroup *gtk_clutter_get_option_group (void);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]