tests: Make forcing of class registers work without gcc warnings

This commit is contained in:
Benjamin Otte 2011-05-27 04:20:45 +02:00
parent d1a8d73871
commit 8c4653c4f2

View File

@ -626,17 +626,15 @@ create_tree_model (void)
GtkTreeStore *store;
gint i;
GType *t;
volatile GType dummy; /* G_GNUC_CONST makes the optimizer remove
* get_type calls if you don't do something
* like this
*/
/* Make the tree more interesting */
dummy = gtk_scrolled_window_get_type ();
dummy = gtk_label_get_type ();
dummy = gtk_hscrollbar_get_type ();
dummy = gtk_vscrollbar_get_type ();
dummy = pango_layout_get_type ();
/* - we need this magic here so we are sure the type ends up being
* registered and gcc doesn't optimize away the code */
g_type_class_unref (g_type_class_ref (gtk_scrolled_window_get_type ()));
g_type_class_unref (g_type_class_ref (gtk_label_get_type ()));
g_type_class_unref (g_type_class_ref (gtk_hscrollbar_get_type ()));
g_type_class_unref (g_type_class_ref (gtk_vscrollbar_get_type ()));
g_type_class_unref (g_type_class_ref (pango_layout_get_type ()));
t = get_model_types ();