int main(void)
{
- g_type_init ();
-
- int the_answer = 42;
+ Str *test_good, *test_bad;
char *stupid_pointer = "ug";
+ int the_answer = 42;
+
+ g_type_init ();
/* This works fine. */
- Str *test_good = (Str *) (str_new ("%d", the_answer));
+ test_good = (Str *) (str_new ("%d", the_answer));
test_good = test_good;
/* This gets a warning thanks to our function attribute. */
- Str *test_bad = (Str *) (str_new ("%d", stupid_pointer));
+ test_bad = (Str *) (str_new ("%d", stupid_pointer));
test_bad = test_bad;
return 0;
AT_CHECK([test x"$total" = x"2"])
TEST_COMPILE_GOBJECT([main.c], [0], [], [stderr])
-AT_CHECK([$AWK -F : '$1 == "main.c" && $2 == "16" { exit 42 }' stderr], [42])
+AT_CHECK([$AWK -F : '$1 == "main.c" && $2 == "17" { exit 42 }' stderr], [42])
AT_CHECK([$CC $CFLAGS $LDFLAGS $LIBGOBJECT_LIBS -o main str.o main.o])
#include "test.h"
int main(void)
{
+ g_type_init();
test_register_type(NULL);
}
]])
guint handler;
Test *t;
+ g_type_init();
+
/* should fail, suppress internal glib logging... */
handler = g_log_set_handler("GLib-GObject", G_LOG_LEVEL_MASK, devnull, 0);
t = g_object_new(test_get_type(), NULL);
int main(void)
{
- GObject *go = g_object_new(test_get_type(), NULL);
+ GObject *go;
+
+ g_type_init();
+ go = g_object_new(test_get_type(), NULL);
printf("%d\n", test_get_x(go));
printf("%d\n", (test_set_x(go, 123), test_get_x(go)));
{
GObject *go;
+ g_type_init();
g_type_module_use(g_object_new(test_mod_get_type(), NULL));
go = g_object_new(test_get_type(), NULL);