mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-17 01:36:15 +01:00
Bug 556543 – reduce compiler warnings
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. svn path=/trunk/; revision=730
This commit is contained in:
parent
e8c772bdb6
commit
4fb5b001bb
1
ginfo.c
1
ginfo.c
@ -19,6 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <glib/gprintf.h>
|
#include <glib/gprintf.h>
|
||||||
@ -261,8 +262,6 @@ register_internal (GIRepository *repository,
|
|||||||
Header *header;
|
Header *header;
|
||||||
const gchar *namespace;
|
const gchar *namespace;
|
||||||
const gchar *version;
|
const gchar *version;
|
||||||
gboolean was_loaded;
|
|
||||||
gboolean currently_lazy;
|
|
||||||
|
|
||||||
g_return_val_if_fail (typelib != NULL, FALSE);
|
g_return_val_if_fail (typelib != NULL, FALSE);
|
||||||
|
|
||||||
@ -418,17 +417,6 @@ g_irepository_get_default (void)
|
|||||||
return get_repository (NULL);
|
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
|
* g_irepository_get_n_infos
|
||||||
* @repository: A #GIRepository, may be %NULL for the default
|
* @repository: A #GIRepository, may be %NULL for the default
|
||||||
@ -478,7 +466,6 @@ find_interface (gpointer key,
|
|||||||
IfaceData *iface_data = (IfaceData *)data;
|
IfaceData *iface_data = (IfaceData *)data;
|
||||||
gint index;
|
gint index;
|
||||||
gint n_entries;
|
gint n_entries;
|
||||||
guint32 offset;
|
|
||||||
const gchar *name;
|
const gchar *name;
|
||||||
const gchar *type;
|
const gchar *type;
|
||||||
DirEntry *entry;
|
DirEntry *entry;
|
||||||
@ -804,7 +791,6 @@ find_namespace_version (const gchar *namespace,
|
|||||||
|
|
||||||
for (ldir = search_path; ldir; ldir = ldir->next)
|
for (ldir = search_path; ldir; ldir = ldir->next)
|
||||||
{
|
{
|
||||||
Header *header;
|
|
||||||
char *path = g_build_filename (ldir->data, fname, NULL);
|
char *path = g_build_filename (ldir->data, fname, NULL);
|
||||||
|
|
||||||
mfile = g_mapped_file_new (path, FALSE, &error);
|
mfile = g_mapped_file_new (path, FALSE, &error);
|
||||||
@ -827,7 +813,7 @@ parse_version (const char *version,
|
|||||||
int *minor)
|
int *minor)
|
||||||
{
|
{
|
||||||
const char *dot;
|
const char *dot;
|
||||||
const char *end;
|
char *end;
|
||||||
|
|
||||||
*major = strtol (version, &end, 10);
|
*major = strtol (version, &end, 10);
|
||||||
dot = strchr (version, '.');
|
dot = strchr (version, '.');
|
||||||
@ -1012,15 +998,11 @@ g_irepository_require (GIRepository *repository,
|
|||||||
GIRepositoryLoadFlags flags,
|
GIRepositoryLoadFlags flags,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
const char *dir;
|
|
||||||
GMappedFile *mfile;
|
GMappedFile *mfile;
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
GError *error1 = NULL;
|
|
||||||
Header *header;
|
Header *header;
|
||||||
GTypelib *typelib = NULL;
|
GTypelib *typelib = NULL;
|
||||||
const gchar *typelib_namespace, *typelib_version, *shlib_fname;
|
const gchar *typelib_namespace, *typelib_version;
|
||||||
GModule *module;
|
|
||||||
guint32 shlib;
|
|
||||||
gboolean allow_lazy = (flags & G_IREPOSITORY_LOAD_FLAG_LAZY) > 0;
|
gboolean allow_lazy = (flags & G_IREPOSITORY_LOAD_FLAG_LAZY) > 0;
|
||||||
gboolean is_lazy;
|
gboolean is_lazy;
|
||||||
char *version_conflict = NULL;
|
char *version_conflict = NULL;
|
||||||
@ -1056,7 +1038,6 @@ g_irepository_require (GIRepository *repository,
|
|||||||
|
|
||||||
if (mfile == NULL)
|
if (mfile == NULL)
|
||||||
{
|
{
|
||||||
const char *error_fmt;
|
|
||||||
if (version != NULL)
|
if (version != NULL)
|
||||||
g_set_error (error, G_IREPOSITORY_ERROR,
|
g_set_error (error, G_IREPOSITORY_ERROR,
|
||||||
G_IREPOSITORY_ERROR_TYPELIB_NOT_FOUND,
|
G_IREPOSITORY_ERROR_TYPELIB_NOT_FOUND,
|
||||||
|
@ -24,6 +24,9 @@
|
|||||||
#include "girmodule.h"
|
#include "girmodule.h"
|
||||||
#include "girnode.h"
|
#include "girnode.h"
|
||||||
|
|
||||||
|
void _g_irnode_init_stats (void);
|
||||||
|
void _g_irnode_dump_stats (void);
|
||||||
|
|
||||||
#define ALIGN_VALUE(this, boundary) \
|
#define ALIGN_VALUE(this, boundary) \
|
||||||
(( ((unsigned long)(this)) + (((unsigned long)(boundary)) -1)) & (~(((unsigned long)(boundary))-1)))
|
(( ((unsigned long)(this)) + (((unsigned long)(boundary)) -1)) & (~(((unsigned long)(boundary))-1)))
|
||||||
|
|
||||||
@ -111,7 +114,7 @@ g_ir_module_build_typelib (GIrModule *module,
|
|||||||
}
|
}
|
||||||
|
|
||||||
restart:
|
restart:
|
||||||
init_stats ();
|
_g_irnode_init_stats ();
|
||||||
strings = g_hash_table_new (g_str_hash, g_str_equal);
|
strings = g_hash_table_new (g_str_hash, g_str_equal);
|
||||||
types = 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);
|
n_entries = g_list_length (module->entries);
|
||||||
@ -243,7 +246,7 @@ g_ir_module_build_typelib (GIrModule *module,
|
|||||||
entry++;
|
entry++;
|
||||||
}
|
}
|
||||||
|
|
||||||
dump_stats ();
|
_g_irnode_dump_stats ();
|
||||||
|
|
||||||
header->annotations = offset2;
|
header->annotations = offset2;
|
||||||
|
|
||||||
|
23
girnode.c
23
girnode.c
@ -34,7 +34,7 @@ static gulong types_count = 0;
|
|||||||
static gulong unique_types_count = 0;
|
static gulong unique_types_count = 0;
|
||||||
|
|
||||||
void
|
void
|
||||||
init_stats (void)
|
_g_irnode_init_stats (void)
|
||||||
{
|
{
|
||||||
string_count = 0;
|
string_count = 0;
|
||||||
unique_string_count = 0;
|
unique_string_count = 0;
|
||||||
@ -45,7 +45,7 @@ init_stats (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
dump_stats (void)
|
_g_irnode_dump_stats (void)
|
||||||
{
|
{
|
||||||
g_message ("%lu strings (%lu before sharing), %lu bytes (%lu before sharing)",
|
g_message ("%lu strings (%lu before sharing), %lu bytes (%lu before sharing)",
|
||||||
unique_string_count, string_count, unique_string_size, string_size);
|
unique_string_count, string_count, unique_string_size, string_size);
|
||||||
@ -870,6 +870,25 @@ g_ir_node_can_have_member (GIrNode *node)
|
|||||||
case G_IR_NODE_STRUCT:
|
case G_IR_NODE_STRUCT:
|
||||||
case G_IR_NODE_UNION:
|
case G_IR_NODE_UNION:
|
||||||
return TRUE;
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
41
girparser.c
41
girparser.c
@ -116,8 +116,6 @@ firstpass_end_element_handler (GMarkupParseContext *context,
|
|||||||
gpointer user_data,
|
gpointer user_data,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
ParseContext *ctx = user_data;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static GMarkupParser firstpass_parser =
|
static GMarkupParser firstpass_parser =
|
||||||
@ -136,8 +134,6 @@ locate_gir (const char *name, const char *version, const char * const* extra_pat
|
|||||||
const gchar *const *dir;
|
const gchar *const *dir;
|
||||||
char *girname;
|
char *girname;
|
||||||
char *path = NULL;
|
char *path = NULL;
|
||||||
GSList *link;
|
|
||||||
gboolean firstpass = TRUE;
|
|
||||||
|
|
||||||
datadirs = g_get_system_data_dirs ();
|
datadirs = g_get_system_data_dirs ();
|
||||||
|
|
||||||
@ -267,9 +263,6 @@ parse_basic (const char *str)
|
|||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
gint n_basic = G_N_ELEMENTS (basic_types);
|
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++)
|
for (i = 0; i < n_basic; i++)
|
||||||
{
|
{
|
||||||
@ -414,7 +407,7 @@ parse_type_internal (const gchar *str, char **next, gboolean in_glib,
|
|||||||
g_free (temporary_type);
|
g_free (temporary_type);
|
||||||
return type;
|
return type;
|
||||||
|
|
||||||
error:
|
/* error: */
|
||||||
g_ir_node_free ((GIrNode *)type);
|
g_ir_node_free ((GIrNode *)type);
|
||||||
g_free (temporary_type);
|
g_free (temporary_type);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -430,7 +423,7 @@ resolve_aliases (ParseContext *ctx, const gchar *type)
|
|||||||
seen_values = g_slist_prepend (seen_values, (char*)type);
|
seen_values = g_slist_prepend (seen_values, (char*)type);
|
||||||
while (g_hash_table_lookup_extended (ctx->aliases, type, &orig, &value))
|
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;
|
type = value;
|
||||||
if (g_slist_find_custom (seen_values, type,
|
if (g_slist_find_custom (seen_values, type,
|
||||||
(GCompareFunc)strcmp) != NULL)
|
(GCompareFunc)strcmp) != NULL)
|
||||||
@ -444,11 +437,9 @@ resolve_aliases (ParseContext *ctx, const gchar *type)
|
|||||||
static GIrNodeType *
|
static GIrNodeType *
|
||||||
parse_type (ParseContext *ctx, const gchar *type)
|
parse_type (ParseContext *ctx, const gchar *type)
|
||||||
{
|
{
|
||||||
gchar *str;
|
|
||||||
GIrNodeType *node;
|
GIrNodeType *node;
|
||||||
const BasicTypeInfo *basic;
|
const BasicTypeInfo *basic;
|
||||||
gboolean in_glib, in_gobject;
|
gboolean in_glib, in_gobject;
|
||||||
gboolean matched_special = FALSE;
|
|
||||||
|
|
||||||
in_glib = strcmp (ctx->namespace, "GLib") == 0;
|
in_glib = strcmp (ctx->namespace, "GLib") == 0;
|
||||||
in_gobject = strcmp (ctx->namespace, "GObject") == 0;
|
in_gobject = strcmp (ctx->namespace, "GObject") == 0;
|
||||||
@ -944,7 +935,6 @@ start_alias (GMarkupParseContext *context,
|
|||||||
{
|
{
|
||||||
const gchar *name;
|
const gchar *name;
|
||||||
const gchar *target;
|
const gchar *target;
|
||||||
const gchar *type;
|
|
||||||
char *key;
|
char *key;
|
||||||
char *value;
|
char *value;
|
||||||
|
|
||||||
@ -1474,6 +1464,28 @@ start_type (GMarkupParseContext *context,
|
|||||||
vfunc->is_varargs = TRUE;
|
vfunc->is_varargs = TRUE;
|
||||||
}
|
}
|
||||||
break;
|
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;
|
ctx->type_stack = NULL;
|
||||||
@ -1496,7 +1508,6 @@ start_type (GMarkupParseContext *context,
|
|||||||
{
|
{
|
||||||
const char *zero;
|
const char *zero;
|
||||||
const char *len;
|
const char *len;
|
||||||
int i;
|
|
||||||
|
|
||||||
typenode = (GIrNodeType *)g_ir_node_new (G_IR_NODE_TYPE);
|
typenode = (GIrNodeType *)g_ir_node_new (G_IR_NODE_TYPE);
|
||||||
|
|
||||||
@ -1604,7 +1615,6 @@ end_type_top (ParseContext *ctx)
|
|||||||
static void
|
static void
|
||||||
end_type_recurse (ParseContext *ctx)
|
end_type_recurse (ParseContext *ctx)
|
||||||
{
|
{
|
||||||
GList *types;
|
|
||||||
GIrNodeType *parent;
|
GIrNodeType *parent;
|
||||||
GIrNodeType *param = NULL;
|
GIrNodeType *param = NULL;
|
||||||
|
|
||||||
@ -2051,7 +2061,6 @@ parse_include (GMarkupParseContext *context,
|
|||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
ParseContext sub_ctx = { 0 };
|
ParseContext sub_ctx = { 0 };
|
||||||
GMarkupParseContext *sub_context;
|
|
||||||
gchar *buffer;
|
gchar *buffer;
|
||||||
gsize length;
|
gsize length;
|
||||||
char *girpath;
|
char *girpath;
|
||||||
@ -2748,7 +2757,6 @@ cleanup (GMarkupParseContext *context,
|
|||||||
{
|
{
|
||||||
ParseContext *ctx = user_data;
|
ParseContext *ctx = user_data;
|
||||||
GList *m;
|
GList *m;
|
||||||
int line_number, char_number;
|
|
||||||
|
|
||||||
for (m = ctx->modules; m; m = m->next)
|
for (m = ctx->modules; m; m = m->next)
|
||||||
g_ir_module_free (m->data);
|
g_ir_module_free (m->data);
|
||||||
@ -2800,7 +2808,6 @@ post_filter (GIrModule *module)
|
|||||||
iter = module->entries;
|
iter = module->entries;
|
||||||
while (iter)
|
while (iter)
|
||||||
{
|
{
|
||||||
GList *link = iter;
|
|
||||||
GIrNode *node = iter->data;
|
GIrNode *node = iter->data;
|
||||||
|
|
||||||
iter = iter->next;
|
iter = iter->next;
|
||||||
|
@ -808,7 +808,6 @@ validate_function_blob (ValidateContext *ctx,
|
|||||||
blob->signature,
|
blob->signature,
|
||||||
error);
|
error);
|
||||||
InterfaceTypeBlob *iface_type;
|
InterfaceTypeBlob *iface_type;
|
||||||
InterfaceBlob *iface;
|
|
||||||
|
|
||||||
if (!simple)
|
if (!simple)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -1281,8 +1280,7 @@ validate_enum_blob (ValidateContext *ctx,
|
|||||||
{
|
{
|
||||||
GTypelib *typelib = ctx->typelib;
|
GTypelib *typelib = ctx->typelib;
|
||||||
EnumBlob *blob;
|
EnumBlob *blob;
|
||||||
ValueBlob *v1, *v2;
|
gint i;
|
||||||
gint i, j;
|
|
||||||
|
|
||||||
if (typelib->len < offset + sizeof (EnumBlob))
|
if (typelib->len < offset + sizeof (EnumBlob))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user