summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2011-10-06 10:26:31 +0100
committerEmmanuele Bassi <ebassi@gnome.org>2011-10-06 10:26:31 +0100
commite2961c1149b99e2e25ee6207c35b81322237a3dd (patch)
tree4d04aabc18b7ecc564cdc9f69d77b0b96c75edd1
parentbd5bddc0d2501953987ab4f57c49d0c0a01dcca1 (diff)
downloadclutter-gtk-e2961c1149b99e2e25ee6207c35b81322237a3dd.tar.gz
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.
-rw-r--r--clutter-gtk/gtk-clutter-util.h4
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