2008-10-16 Tommi Komulainen <tommi.komulainen@iki.fi>
+ Bug 556543 – reduce compiler warnings
+
+ * girepository/ginfo.c:
+ * girepository/girepository.c (register_internal,
+ count_interfaces, find_interface, find_namespace_version,
+ parse_version, g_irepository_require):
+ * girepository/girmodule.c (g_ir_module_build_typelib):
+ * girepository/girnode.c (init_stats, dump_stats,
+ _g_irnode_init_stats, _g_irnode_dump_stats,
+ g_ir_node_can_have_member):
+ * girepository/girparser.c (firstpass_end_element_handler,
+ locate_gir, parse_basic, parse_type_internal, resolve_aliases,
+ start_alias, start_type, end_type_top, parse_include, cleanup,
+ post_filter):
+ * girepository/gtypelib.c (validate_function_blob, validate_enum_blob):
+ * giscanner/giscannermodule.c (directive_get_options,
+ type_get_child_list):
+ * giscanner/scannerlexer.l (parse_gtkdoc):
+ * giscanner/scannerparser.y (ctype_free):
+ * giscanner/sourcescanner.c:
+ * giscanner/sourcescanner.h (gi_source_scanner_parse_macros):
+ * tests/types/gitesttypes.c:
+ * tools/compiler.c (main):
+ * tools/generate.c (write_repository): Remove unused variables
+ and code, add missing includes, declarations and case
+ statements.
+
+2008-10-16 Tommi Komulainen <tommi.komulainen@iki.fi>
+
Bug 556541 – access union members through UnionBlob rather than
StructBlob
*/
#include <stdlib.h>
+#include <string.h>
#include <glib.h>
#include <glib-object.h>
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
#include <glib.h>
#include <glib/gprintf.h>
Header *header;
const gchar *namespace;
const gchar *version;
- gboolean was_loaded;
- gboolean currently_lazy;
g_return_val_if_fail (typelib != NULL, FALSE);
return get_repository (NULL);
}
-static void
-count_interfaces (gpointer key,
- gpointer value,
- gpointer data)
-{
- guchar *typelib = ((GTypelib *) value)->data;
- gint *n_interfaces = (gint *)data;
-
- *n_interfaces += ((Header *)typelib)->n_local_entries;
-}
-
/**
* g_irepository_get_n_infos
* @repository: A #GIRepository, may be %NULL for the default
IfaceData *iface_data = (IfaceData *)data;
gint index;
gint n_entries;
- guint32 offset;
const gchar *name;
const gchar *type;
DirEntry *entry;
for (ldir = search_path; ldir; ldir = ldir->next)
{
- Header *header;
char *path = g_build_filename (ldir->data, fname, NULL);
mfile = g_mapped_file_new (path, FALSE, &error);
int *minor)
{
const char *dot;
- const char *end;
+ char *end;
*major = strtol (version, &end, 10);
dot = strchr (version, '.');
GIRepositoryLoadFlags flags,
GError **error)
{
- const char *dir;
GMappedFile *mfile;
gboolean ret = FALSE;
- GError *error1 = NULL;
Header *header;
GTypelib *typelib = NULL;
- const gchar *typelib_namespace, *typelib_version, *shlib_fname;
- GModule *module;
- guint32 shlib;
+ const gchar *typelib_namespace, *typelib_version;
gboolean allow_lazy = (flags & G_IREPOSITORY_LOAD_FLAG_LAZY) > 0;
gboolean is_lazy;
char *version_conflict = NULL;
if (mfile == NULL)
{
- const char *error_fmt;
if (version != NULL)
g_set_error (error, G_IREPOSITORY_ERROR,
G_IREPOSITORY_ERROR_TYPELIB_NOT_FOUND,
#include "girmodule.h"
#include "girnode.h"
+void _g_irnode_init_stats (void);
+void _g_irnode_dump_stats (void);
+
#define ALIGN_VALUE(this, boundary) \
(( ((unsigned long)(this)) + (((unsigned long)(boundary)) -1)) & (~(((unsigned long)(boundary))-1)))
}
restart:
- init_stats ();
+ _g_irnode_init_stats ();
strings = g_hash_table_new (g_str_hash, g_str_equal);
types = g_hash_table_new (g_str_hash, g_str_equal);
n_entries = g_list_length (module->entries);
entry++;
}
- dump_stats ();
+ _g_irnode_dump_stats ();
header->annotations = offset2;
static gulong unique_types_count = 0;
void
-init_stats (void)
+_g_irnode_init_stats (void)
{
string_count = 0;
unique_string_count = 0;
}
void
-dump_stats (void)
+_g_irnode_dump_stats (void)
{
g_message ("%lu strings (%lu before sharing), %lu bytes (%lu before sharing)",
unique_string_count, string_count, unique_string_size, string_size);
case G_IR_NODE_STRUCT:
case G_IR_NODE_UNION:
return TRUE;
+ /* list others individually rather than with default: so that compiler
+ * warns if new node types are added without adding them to the switch
+ */
+ case G_IR_NODE_INVALID:
+ case G_IR_NODE_FUNCTION:
+ case G_IR_NODE_CALLBACK:
+ case G_IR_NODE_ENUM:
+ case G_IR_NODE_FLAGS:
+ case G_IR_NODE_CONSTANT:
+ case G_IR_NODE_ERROR_DOMAIN:
+ case G_IR_NODE_PARAM:
+ case G_IR_NODE_TYPE:
+ case G_IR_NODE_PROPERTY:
+ case G_IR_NODE_SIGNAL:
+ case G_IR_NODE_VALUE:
+ case G_IR_NODE_VFUNC:
+ case G_IR_NODE_FIELD:
+ case G_IR_NODE_XREF:
+ return FALSE;
};
return FALSE;
}
gpointer user_data,
GError **error)
{
- ParseContext *ctx = user_data;
-
}
static GMarkupParser firstpass_parser =
const gchar *const *dir;
char *girname;
char *path = NULL;
- GSList *link;
- gboolean firstpass = TRUE;
datadirs = g_get_system_data_dirs ();
{
gint i;
gint n_basic = G_N_ELEMENTS (basic_types);
- gchar *temporary_type = NULL;
- const gchar *start;
- const gchar *end;
for (i = 0; i < n_basic; i++)
{
g_free (temporary_type);
return type;
- error:
+/* error: */
g_ir_node_free ((GIrNode *)type);
g_free (temporary_type);
return NULL;
seen_values = g_slist_prepend (seen_values, (char*)type);
while (g_hash_table_lookup_extended (ctx->aliases, type, &orig, &value))
{
- g_debug ("Resolved: %s => %s", type, value);
+ g_debug ("Resolved: %s => %s", type, (char*)value);
type = value;
if (g_slist_find_custom (seen_values, type,
(GCompareFunc)strcmp) != NULL)
static GIrNodeType *
parse_type (ParseContext *ctx, const gchar *type)
{
- gchar *str;
GIrNodeType *node;
const BasicTypeInfo *basic;
gboolean in_glib, in_gobject;
- gboolean matched_special = FALSE;
in_glib = strcmp (ctx->namespace, "GLib") == 0;
in_gobject = strcmp (ctx->namespace, "GObject") == 0;
{
const gchar *name;
const gchar *target;
- const gchar *type;
char *key;
char *value;
vfunc->is_varargs = TRUE;
}
break;
+ /* list others individually rather than with default: so that compiler
+ * warns if new node types are added without adding them to the switch
+ */
+ case G_IR_NODE_INVALID:
+ case G_IR_NODE_ENUM:
+ case G_IR_NODE_FLAGS:
+ case G_IR_NODE_CONSTANT:
+ case G_IR_NODE_ERROR_DOMAIN:
+ case G_IR_NODE_PARAM:
+ case G_IR_NODE_TYPE:
+ case G_IR_NODE_PROPERTY:
+ case G_IR_NODE_SIGNAL:
+ case G_IR_NODE_VALUE:
+ case G_IR_NODE_FIELD:
+ case G_IR_NODE_XREF:
+ case G_IR_NODE_STRUCT:
+ case G_IR_NODE_BOXED:
+ case G_IR_NODE_OBJECT:
+ case G_IR_NODE_INTERFACE:
+ case G_IR_NODE_UNION:
+ g_assert_not_reached ();
+ break;
}
}
ctx->type_stack = NULL;
{
const char *zero;
const char *len;
- int i;
typenode = (GIrNodeType *)g_ir_node_new (G_IR_NODE_TYPE);
static void
end_type_recurse (ParseContext *ctx)
{
- GList *types;
GIrNodeType *parent;
GIrNodeType *param = NULL;
GError **error)
{
ParseContext sub_ctx = { 0 };
- GMarkupParseContext *sub_context;
gchar *buffer;
gsize length;
char *girpath;
{
ParseContext *ctx = user_data;
GList *m;
- int line_number, char_number;
for (m = ctx->modules; m; m = m->next)
g_ir_module_free (m->data);
iter = module->entries;
while (iter)
{
- GList *link = iter;
GIrNode *node = iter->data;
iter = iter->next;
blob->signature,
error);
InterfaceTypeBlob *iface_type;
- InterfaceBlob *iface;
if (!simple)
return FALSE;
{
GTypelib *typelib = ctx->typelib;
EnumBlob *blob;
- ValueBlob *v1, *v2;
- gint i, j;
+ gint i;
if (typelib->len < offset + sizeof (EnumBlob))
{
directive_get_options (PyGISourceDirective *self,
void *context)
{
- GSList *l, *symbols;
+ GSList *l;
PyObject *list;
int i = 0;
type_get_child_list (PyGISourceType *self,
void *context)
{
- GList *l, *symbols;
+ GList *l;
PyObject *list;
int i = 0;
char *ptr = g_strdup (parts[1]);
char *start;
char *end;
- char **option_parts, **option_part;
options = NULL;
start = strchr (ptr, '(');
extern int yylex (GISourceScanner *scanner);
static void yyerror (GISourceScanner *scanner, const char *str);
+extern void ctype_free (GISourceType * type);
+
static int last_enum_value = -1;
static GHashTable *const_table = NULL;
%}
*/
#include "sourcescanner.h"
+#include <string.h>
GISourceSymbol *
gi_source_symbol_new (GISourceSymbolType type)
const gchar *filename);
gboolean gi_source_scanner_parse_file (GISourceScanner *igenerator,
FILE *file);
+void gi_source_scanner_parse_macros (GISourceScanner *scanner,
+ GList *filenames);
void gi_source_scanner_set_macro_scan (GISourceScanner *scanner,
gboolean macro_scan);
GSList * gi_source_scanner_get_symbols (GISourceScanner *scanner);
#include <gitesttypes.h>
+#include <string.h>
/* basic types */
gboolean test_boolean (gboolean in)
{
GOptionContext *context;
GError *error = NULL;
- GList *c, *m, *modules;
+ GList *m, *modules;
gint i;
g_typelib_check_sanity ();
gboolean needs_prefix)
{
FILE *ofile;
- gchar *ns;
gint i, j;
char **dependencies;
GIRepository *repository;