From 071ccc99d384ad2321b6402622f92e185d9e07c1 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Tue, 27 Jan 2009 17:17:31 +0000 Subject: [PATCH] Misc warning fixes * giscanner/scannerparser.y: Fix the "Ignoring non-UTF-8 constant string" error to print the right value. * tests/scanner/annotation.c (backslash_parsing_tester) (backslash_parsing_tester_2): make these non-static to avoid a warning. (annotation_object_string_out) (annotation_string_zero_terminated): fix return values * tests/scanner/annotation.h (annotation_object_with_voidp): prototype this * tests/scanner/gtkfrob.c: * tests/scanner/gtkfrob.h (gtk_frob_language_manager_get_default): fix prototype. (s/()/(void)/). * tools/compiler.c (format_output): fix signed/unsigned warning. Output a prototype for register_typelib() to avoid warnings later. svn path=/trunk/; revision=1071 --- ChangeLog | 23 +++++++++++++++++++++++ giscanner/scannerparser.y | 2 +- tests/scanner/annotation.c | 7 +++---- tests/scanner/annotation.h | 2 ++ tests/scanner/gtkfrob.c | 2 +- tests/scanner/gtkfrob.h | 2 +- tools/compiler.c | 5 ++++- 7 files changed, 35 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8a3f0a7..a1f1bbb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2009-01-27 Dan Winship + + Misc warning fixes + + * giscanner/scannerparser.y: Fix the "Ignoring non-UTF-8 constant + string" error to print the right value. + + * tests/scanner/annotation.c (backslash_parsing_tester) + (backslash_parsing_tester_2): make these non-static to avoid a + warning. + (annotation_object_string_out) + (annotation_string_zero_terminated): fix return values + + * tests/scanner/annotation.h (annotation_object_with_voidp): + prototype this + + * tests/scanner/gtkfrob.c: + * tests/scanner/gtkfrob.h (gtk_frob_language_manager_get_default): + fix prototype. (s/()/(void)/). + + * tools/compiler.c (format_output): fix signed/unsigned warning. + Output a prototype for register_typelib() to avoid warnings later. + 2009-01-26 Johan Dahlin * tests/everything/everything.c (test_callback): diff --git a/giscanner/scannerparser.y b/giscanner/scannerparser.y index dffe90e..b2ce2cd 100644 --- a/giscanner/scannerparser.y +++ b/giscanner/scannerparser.y @@ -185,7 +185,7 @@ strings $$->const_string = g_strcompress (yytext + 1); if (!g_utf8_validate ($$->const_string, -1, NULL)) { - g_warning ("Ignoring non-UTF-8 constant string %s", $$->ident); + g_warning ("Ignoring non-UTF-8 constant string \"%s\"", yytext + 1); g_free($$->const_string); $$->const_string = NULL; } diff --git a/tests/scanner/annotation.c b/tests/scanner/annotation.c index 235f616..20c2729 100644 --- a/tests/scanner/annotation.c +++ b/tests/scanner/annotation.c @@ -1,6 +1,6 @@ #include "annotation.h" -static char backslash_parsing_tester = '\\'; +char backslash_parsing_tester = '\\'; G_DEFINE_TYPE (AnnotationObject, annotation_object, G_TYPE_OBJECT); @@ -408,7 +408,7 @@ gboolean annotation_object_string_out(AnnotationObject *object, char **str_out) { - + return FALSE; } /** @@ -553,7 +553,6 @@ annotation_string_zero_terminated (void) void annotation_string_zero_terminated_out (char ***out) { - return NULL; } /** @@ -567,4 +566,4 @@ annotation_versioned (void) } -static char backslash_parsing_tester_2 = '\\'; +char backslash_parsing_tester_2 = '\\'; diff --git a/tests/scanner/annotation.h b/tests/scanner/annotation.h index 70cf3c7..6904f15 100644 --- a/tests/scanner/annotation.h +++ b/tests/scanner/annotation.h @@ -67,6 +67,8 @@ gint annotation_object_calleesowns (AnnotationObject *object, GObject **toown2); GList* annotation_object_get_strings (AnnotationObject *object); GHashTable*annotation_object_get_hash (AnnotationObject *object); +void annotation_object_with_voidp (AnnotationObject *object, + void *data); GSList* annotation_object_get_objects (AnnotationObject *object); void annotation_object_use_buffer (AnnotationObject *object, diff --git a/tests/scanner/gtkfrob.c b/tests/scanner/gtkfrob.c index eb1977a..286e448 100644 --- a/tests/scanner/gtkfrob.c +++ b/tests/scanner/gtkfrob.c @@ -1,6 +1,6 @@ #include "gtkfrob.h" void -gtk_frob_language_manager_get_default () +gtk_frob_language_manager_get_default (void) { } diff --git a/tests/scanner/gtkfrob.h b/tests/scanner/gtkfrob.h index 64141ee..06a282d 100644 --- a/tests/scanner/gtkfrob.h +++ b/tests/scanner/gtkfrob.h @@ -6,6 +6,6 @@ /* A global function */ -void gtk_frob_language_manager_get_default (); +void gtk_frob_language_manager_get_default (void); #endif /* __GTKFROB_H__ */ diff --git a/tools/compiler.c b/tools/compiler.c index 69b49bd..d4de9cd 100644 --- a/tools/compiler.c +++ b/tools/compiler.c @@ -49,7 +49,7 @@ static gchar * format_output (GTypelib *typelib) { GString *result; - gint i; + guint i; result = g_string_sized_new (6 * typelib->len); @@ -76,6 +76,9 @@ format_output (GTypelib *typelib) if (!no_init) { g_string_append_printf (result, + "__attribute__((constructor)) void " + "register_typelib (void);\n\n"); + g_string_append_printf (result, "__attribute__((constructor)) void\n" "register_typelib (void)\n" "{\n" -- 2.7.4