summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2018-07-29 15:56:35 +0200
committerChristoph Reiter <reiter.christoph@gmail.com>2018-07-29 18:57:03 +0200
commitea8d9cd9b5daf701ef25a03727b08a583ee8589a (patch)
treeffb1e0210961266d60e7acf968413d79a428c8cf
parentb76ffdcce297ef55330839ddfe3053163e3b9abb (diff)
downloadgobject-introspection-ea8d9cd9b5daf701ef25a03727b08a583ee8589a.tar.gz
build: enable -Wshadow
-rw-r--r--configure.ac2
-rw-r--r--girepository/girepository.c20
-rw-r--r--girepository/girnode.c18
-rw-r--r--girepository/girparser.c3
-rw-r--r--girepository/gitypelib.c8
-rw-r--r--tools/generate.c2
6 files changed, 27 insertions, 26 deletions
diff --git a/configure.ac b/configure.ac
index 52536129..c8148c25 100644
--- a/configure.ac
+++ b/configure.ac
@@ -65,7 +65,7 @@ AX_COMPILER_FLAGS(,, [yes])
# These get triggered a lot, not worth it imo, but feel free to fix them
AX_APPEND_COMPILE_FLAGS([-Wno-duplicated-branches -Wno-switch-enum])
# FIXME: Fix the warnings and remove the flags
-AX_APPEND_COMPILE_FLAGS([-Wno-redundant-decls -Wno-switch-default -Wno-shadow -Wno-deprecated-declarations -Wno-type-limits])
+AX_APPEND_COMPILE_FLAGS([-Wno-redundant-decls -Wno-switch-default -Wno-deprecated-declarations -Wno-type-limits])
AX_APPEND_COMPILE_FLAGS([-Wno-implicit-fallthrough -Wno-sign-compare])
WARN_CFLAGS_PYTHON="$WARN_CFLAGS"
diff --git a/girepository/girepository.c b/girepository/girepository.c
index 6ffb3aa8..819f8e76 100644
--- a/girepository/girepository.c
+++ b/girepository/girepository.c
@@ -56,7 +56,7 @@
static GIRepository *default_repository = NULL;
-static GSList *search_path = NULL;
+static GSList *typelib_search_path = NULL;
struct _GIRepositoryPrivate
{
@@ -160,7 +160,7 @@ init_globals (void)
if (default_repository == NULL)
default_repository = g_object_new (G_TYPE_IREPOSITORY, NULL);
- if (search_path == NULL)
+ if (typelib_search_path == NULL)
{
const char *libdir;
char *typelib_dir;
@@ -172,7 +172,7 @@ init_globals (void)
*/
type_lib_path_env = g_getenv ("GI_TYPELIB_PATH");
- search_path = NULL;
+ typelib_search_path = NULL;
if (type_lib_path_env)
{
gchar **custom_dirs;
@@ -183,7 +183,7 @@ init_globals (void)
d = custom_dirs;
while (*d)
{
- search_path = g_slist_prepend (search_path, *d);
+ typelib_search_path = g_slist_prepend (typelib_search_path, *d);
d++;
}
@@ -195,9 +195,9 @@ init_globals (void)
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);
@@ -216,7 +216,7 @@ void
g_irepository_prepend_search_path (const char *directory)
{
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 *
g_irepository_get_search_path (void)
{
- return search_path;
+ return typelib_search_path;
}
static char *
@@ -1388,7 +1388,7 @@ g_irepository_enumerate_versions (GIRepository *repository,
const gchar *loaded_version;
init_globals ();
- candidates = enumerate_namespace_versions (namespace_, search_path);
+ candidates = enumerate_namespace_versions (namespace_, typelib_search_path);
for (link = candidates; link; link = link->next)
{
@@ -1555,7 +1555,7 @@ g_irepository_require (GIRepository *repository,
init_globals ();
typelib = require_internal (repository, namespace, version, flags,
- search_path, error);
+ typelib_search_path, error);
return typelib;
}
diff --git a/girepository/girnode.c b/girepository/girnode.c
index 4d439a64..fb21c288 100644
--- a/girepository/girnode.c
+++ b/girepository/girnode.c
@@ -1182,14 +1182,14 @@ get_index_of_member_type (GIrNodeInterface *node,
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;
index++;
- if (strcmp (node->name, name) == 0)
+ if (strcmp (member_node->name, name) == 0)
break;
}
@@ -1543,13 +1543,13 @@ _g_ir_node_build_typelib (GIrNode *node,
case GI_TYPE_TAG_ERROR:
{
- ErrorTypeBlob *blob = (ErrorTypeBlob *)&data[*offset2];
+ ErrorTypeBlob *error_blob = (ErrorTypeBlob *)&data[*offset2];
- blob->pointer = 1;
- blob->reserved = 0;
- blob->tag = type->tag;
- blob->reserved2 = 0;
- blob->n_domains = 0;
+ error_blob->pointer = 1;
+ error_blob->reserved = 0;
+ error_blob->tag = type->tag;
+ error_blob->reserved2 = 0;
+ error_blob->n_domains = 0;
*offset2 += sizeof (ErrorTypeBlob);
}
diff --git a/girepository/girparser.c b/girepository/girparser.c
index 4c43e0ae..dfc75c96 100644
--- a/girepository/girparser.c
+++ b/girepository/girparser.c
@@ -2761,7 +2761,6 @@ start_element_handler (GMarkupParseContext *context,
GError **error)
{
ParseContext *ctx = user_data;
- gint line_number, char_number;
if (logged_levels & G_LOG_LEVEL_DEBUG)
{
@@ -3097,6 +3096,7 @@ start_element_handler (GMarkupParseContext *context,
if (*error == NULL && ctx->state != STATE_PASSTHROUGH)
{
+ gint line_number, char_number;
g_markup_parse_context_get_position (context, &line_number, &char_number);
if (!g_str_has_prefix (element_name, "c:"))
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:
if (*error)
{
+ gint 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);
diff --git a/girepository/gitypelib.c b/girepository/gitypelib.c
index 1e33c6af..dbc7261e 100644
--- a/girepository/gitypelib.c
+++ b/girepository/gitypelib.c
@@ -1500,7 +1500,7 @@ validate_struct_blob (ValidateContext *ctx,
field_offset = offset + sizeof (StructBlob);
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,
field_offset,
@@ -1508,7 +1508,7 @@ validate_struct_blob (ValidateContext *ctx,
return FALSE;
field_offset += sizeof (FieldBlob);
- if (blob->has_embedded_type)
+ if (field_blob->has_embedded_type)
field_offset += sizeof (CallbackBlob);
}
@@ -1778,14 +1778,14 @@ validate_object_blob (ValidateContext *ctx,
n_field_callbacks = 0;
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))
return FALSE;
offset2 += sizeof (FieldBlob);
/* Special case fields which are callbacks. */
- if (blob->has_embedded_type) {
+ if (field_blob->has_embedded_type) {
offset2 += sizeof (CallbackBlob);
n_field_callbacks++;
}
diff --git a/tools/generate.c b/tools/generate.c
index f35893c3..36e1d05a 100644
--- a/tools/generate.c
+++ b/tools/generate.c
@@ -80,11 +80,11 @@ main (int argc, char *argv[])
for (i = 0; input[i]; i++)
{
- GError *error = NULL;
const char *namespace;
GMappedFile *mfile;
GITypelib *typelib;
+ error = NULL;
mfile = g_mapped_file_new (input[i], FALSE, &error);
if (!mfile)
g_error ("failed to read '%s': %s", input[i], error->message);