build: enable -Wshadow

This commit is contained in:
Christoph Reiter 2018-07-29 15:56:35 +02:00
parent 7cdf5d0d1d
commit 3a5b0c2ae2
4 changed files with 25 additions and 24 deletions

View File

@ -56,7 +56,7 @@
static GIRepository *default_repository = NULL; static GIRepository *default_repository = NULL;
static GSList *search_path = NULL; static GSList *typelib_search_path = NULL;
struct _GIRepositoryPrivate struct _GIRepositoryPrivate
{ {
@ -160,7 +160,7 @@ init_globals (void)
if (default_repository == NULL) if (default_repository == NULL)
default_repository = g_object_new (G_TYPE_IREPOSITORY, NULL); default_repository = g_object_new (G_TYPE_IREPOSITORY, NULL);
if (search_path == NULL) if (typelib_search_path == NULL)
{ {
const char *libdir; const char *libdir;
char *typelib_dir; char *typelib_dir;
@ -172,7 +172,7 @@ init_globals (void)
*/ */
type_lib_path_env = g_getenv ("GI_TYPELIB_PATH"); type_lib_path_env = g_getenv ("GI_TYPELIB_PATH");
search_path = NULL; typelib_search_path = NULL;
if (type_lib_path_env) if (type_lib_path_env)
{ {
gchar **custom_dirs; gchar **custom_dirs;
@ -183,7 +183,7 @@ init_globals (void)
d = custom_dirs; d = custom_dirs;
while (*d) while (*d)
{ {
search_path = g_slist_prepend (search_path, *d); typelib_search_path = g_slist_prepend (typelib_search_path, *d);
d++; d++;
} }
@ -195,9 +195,9 @@ init_globals (void)
typelib_dir = g_build_filename (libdir, "girepository-1.0", NULL); typelib_dir = g_build_filename (libdir, "girepository-1.0", NULL);
search_path = g_slist_prepend (search_path, typelib_dir); typelib_search_path = g_slist_prepend (typelib_search_path, typelib_dir);
search_path = g_slist_reverse (search_path); typelib_search_path = g_slist_reverse (typelib_search_path);
} }
g_once_init_leave (&initialized, 1); g_once_init_leave (&initialized, 1);
@ -216,7 +216,7 @@ void
g_irepository_prepend_search_path (const char *directory) g_irepository_prepend_search_path (const char *directory)
{ {
init_globals (); init_globals ();
search_path = g_slist_prepend (search_path, g_strdup (directory)); typelib_search_path = g_slist_prepend (typelib_search_path, g_strdup (directory));
} }
/** /**
@ -231,7 +231,7 @@ g_irepository_prepend_search_path (const char *directory)
GSList * GSList *
g_irepository_get_search_path (void) g_irepository_get_search_path (void)
{ {
return search_path; return typelib_search_path;
} }
static char * static char *
@ -1388,7 +1388,7 @@ g_irepository_enumerate_versions (GIRepository *repository,
const gchar *loaded_version; const gchar *loaded_version;
init_globals (); init_globals ();
candidates = enumerate_namespace_versions (namespace_, search_path); candidates = enumerate_namespace_versions (namespace_, typelib_search_path);
for (link = candidates; link; link = link->next) for (link = candidates; link; link = link->next)
{ {
@ -1555,7 +1555,7 @@ g_irepository_require (GIRepository *repository,
init_globals (); init_globals ();
typelib = require_internal (repository, namespace, version, flags, typelib = require_internal (repository, namespace, version, flags,
search_path, error); typelib_search_path, error);
return typelib; return typelib;
} }

View File

@ -1182,14 +1182,14 @@ get_index_of_member_type (GIrNodeInterface *node,
for (l = node->members; l; l = l->next) for (l = node->members; l; l = l->next)
{ {
GIrNode *node = l->data; GIrNode *member_node = l->data;
if (node->type != type) if (member_node->type != type)
continue; continue;
index++; index++;
if (strcmp (node->name, name) == 0) if (strcmp (member_node->name, name) == 0)
break; break;
} }
@ -1543,13 +1543,13 @@ _g_ir_node_build_typelib (GIrNode *node,
case GI_TYPE_TAG_ERROR: case GI_TYPE_TAG_ERROR:
{ {
ErrorTypeBlob *blob = (ErrorTypeBlob *)&data[*offset2]; ErrorTypeBlob *error_blob = (ErrorTypeBlob *)&data[*offset2];
blob->pointer = 1; error_blob->pointer = 1;
blob->reserved = 0; error_blob->reserved = 0;
blob->tag = type->tag; error_blob->tag = type->tag;
blob->reserved2 = 0; error_blob->reserved2 = 0;
blob->n_domains = 0; error_blob->n_domains = 0;
*offset2 += sizeof (ErrorTypeBlob); *offset2 += sizeof (ErrorTypeBlob);
} }

View File

@ -2761,7 +2761,6 @@ start_element_handler (GMarkupParseContext *context,
GError **error) GError **error)
{ {
ParseContext *ctx = user_data; ParseContext *ctx = user_data;
gint line_number, char_number;
if (logged_levels & G_LOG_LEVEL_DEBUG) if (logged_levels & G_LOG_LEVEL_DEBUG)
{ {
@ -3097,6 +3096,7 @@ start_element_handler (GMarkupParseContext *context,
if (*error == NULL && ctx->state != STATE_PASSTHROUGH) if (*error == NULL && ctx->state != STATE_PASSTHROUGH)
{ {
gint line_number, char_number;
g_markup_parse_context_get_position (context, &line_number, &char_number); g_markup_parse_context_get_position (context, &line_number, &char_number);
if (!g_str_has_prefix (element_name, "c:")) if (!g_str_has_prefix (element_name, "c:"))
g_printerr ("%s:%d:%d: warning: element %s from state %d is unknown, ignoring\n", g_printerr ("%s:%d:%d: warning: element %s from state %d is unknown, ignoring\n",
@ -3108,6 +3108,7 @@ start_element_handler (GMarkupParseContext *context,
out: out:
if (*error) if (*error)
{ {
gint line_number, char_number;
g_markup_parse_context_get_position (context, &line_number, &char_number); g_markup_parse_context_get_position (context, &line_number, &char_number);
g_printerr ("%s:%d:%d: error: %s\n", ctx->file_path, line_number, char_number, (*error)->message); g_printerr ("%s:%d:%d: error: %s\n", ctx->file_path, line_number, char_number, (*error)->message);

View File

@ -1500,7 +1500,7 @@ validate_struct_blob (ValidateContext *ctx,
field_offset = offset + sizeof (StructBlob); field_offset = offset + sizeof (StructBlob);
for (i = 0; i < blob->n_fields; i++) for (i = 0; i < blob->n_fields; i++)
{ {
FieldBlob *blob = (FieldBlob*) &typelib->data[field_offset]; FieldBlob *field_blob = (FieldBlob*) &typelib->data[field_offset];
if (!validate_field_blob (ctx, if (!validate_field_blob (ctx,
field_offset, field_offset,
@ -1508,7 +1508,7 @@ validate_struct_blob (ValidateContext *ctx,
return FALSE; return FALSE;
field_offset += sizeof (FieldBlob); field_offset += sizeof (FieldBlob);
if (blob->has_embedded_type) if (field_blob->has_embedded_type)
field_offset += sizeof (CallbackBlob); field_offset += sizeof (CallbackBlob);
} }
@ -1778,14 +1778,14 @@ validate_object_blob (ValidateContext *ctx,
n_field_callbacks = 0; n_field_callbacks = 0;
for (i = 0; i < blob->n_fields; i++) for (i = 0; i < blob->n_fields; i++)
{ {
FieldBlob *blob = (FieldBlob*) &typelib->data[offset2]; FieldBlob *field_blob = (FieldBlob*) &typelib->data[offset2];
if (!validate_field_blob (ctx, offset2, error)) if (!validate_field_blob (ctx, offset2, error))
return FALSE; return FALSE;
offset2 += sizeof (FieldBlob); offset2 += sizeof (FieldBlob);
/* Special case fields which are callbacks. */ /* Special case fields which are callbacks. */
if (blob->has_embedded_type) { if (field_blob->has_embedded_type) {
offset2 += sizeof (CallbackBlob); offset2 += sizeof (CallbackBlob);
n_field_callbacks++; n_field_callbacks++;
} }