build: Enable -Werror=shadow and fix related issues

Mostly renames or removing already defined types

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3378>
This commit is contained in:
Bilal Elmoussaoui
2023-11-09 15:29:38 +01:00
committed by Bilal Elmoussaoui
parent e509fc7f00
commit fc623c1ed1
49 changed files with 157 additions and 183 deletions

View File

@ -655,7 +655,7 @@ init_gpus (MetaBackendNative *native,
for (l = devices; l; l = l->next)
{
GUdevDevice *device = l->data;
GError *local_error = NULL;
GError *device_error = NULL;
if (should_ignore_device (native, device))
{
@ -664,25 +664,25 @@ init_gpus (MetaBackendNative *native,
continue;
}
if (!add_drm_device (native, device, &local_error))
if (!add_drm_device (native, device, &device_error))
{
if (meta_backend_is_headless (backend) &&
g_error_matches (local_error, G_IO_ERROR,
g_error_matches (device_error, G_IO_ERROR,
G_IO_ERROR_PERMISSION_DENIED))
{
meta_topic (META_DEBUG_BACKEND,
"Ignoring unavailable gpu '%s': %s'",
g_udev_device_get_device_file (device),
local_error->message);
device_error->message);
}
else
{
g_warning ("Failed to open gpu '%s': %s",
g_udev_device_get_device_file (device),
local_error->message);
device_error->message);
}
g_clear_error (&local_error);
g_clear_error (&device_error);
continue;
}
}

View File

@ -475,15 +475,15 @@ update_filter_cb (MetaKmsImpl *impl,
for (i = 0; i < crtc_states->len; i++)
{
CrtcStateImpl *crtc_state_impl = g_ptr_array_index (crtc_states, i);
MetaKmsCrtc *crtc = crtc_state_impl->crtc;
MetaKmsCrtc *state_crtc = crtc_state_impl->crtc;
MetaDrmBuffer *old_buffer = NULL;
if (meta_kms_crtc_get_device (crtc) !=
if (meta_kms_crtc_get_device (state_crtc) !=
meta_kms_update_get_device (update))
continue;
update = maybe_update_cursor_plane (cursor_manager_impl,
crtc, update, &old_buffer);
state_crtc, update, &old_buffer);
if (old_buffer)
old_buffers = g_list_prepend (old_buffers, old_buffer);
}

View File

@ -672,7 +672,7 @@ process_plane_assignment (MetaKmsImplDevice *impl_device,
struct {
MetaKmsPlaneProp prop;
uint64_t value;
} props[] = {
} cursor_props[] = {
{
.prop = META_KMS_PLANE_PROP_HOTSPOT_X,
.value = plane_assignment->cursor_hotspot.is_valid ?
@ -687,12 +687,12 @@ process_plane_assignment (MetaKmsImplDevice *impl_device,
},
};
for (i = 0; i < G_N_ELEMENTS (props); i++)
for (i = 0; i < G_N_ELEMENTS (cursor_props); i++)
{
if (!add_plane_property (impl_device,
plane, req,
props[i].prop,
props[i].value,
cursor_props[i].prop,
cursor_props[i].value,
error))
return FALSE;
}

View File

@ -785,7 +785,6 @@ retry_page_flips (gpointer user_data)
if (impl_device_simple->pending_page_flip_retries)
{
GList *l;
uint64_t earliest_retry_time_us = 0;
for (l = impl_device_simple->pending_page_flip_retries; l; l = l->next)

View File

@ -164,10 +164,10 @@ meta_monitor_manager_native_ensure_initial_config (MetaMonitorManager *manager)
static void
apply_crtc_assignments (MetaMonitorManager *manager,
MetaCrtcAssignment **crtcs,
unsigned int n_crtcs,
MetaOutputAssignment **outputs,
unsigned int n_outputs)
MetaCrtcAssignment **crtc_assignments,
unsigned int n_crtc_assignments,
MetaOutputAssignment **output_assignments,
unsigned int n_output_assignments)
{
MetaBackend *backend = meta_monitor_manager_get_backend (manager);
g_autoptr (GList) to_configure_outputs = NULL;
@ -200,9 +200,9 @@ apply_crtc_assignments (MetaMonitorManager *manager,
to_configure_crtcs = g_list_append (to_configure_crtcs, crtc);
}
for (i = 0; i < n_crtcs; i++)
for (i = 0; i < n_crtc_assignments; i++)
{
MetaCrtcAssignment *crtc_assignment = crtcs[i];
MetaCrtcAssignment *crtc_assignment = crtc_assignments[i];
MetaCrtc *crtc = crtc_assignment->crtc;
to_configure_crtcs = g_list_remove (to_configure_crtcs, crtc);
@ -231,8 +231,8 @@ apply_crtc_assignments (MetaMonitorManager *manager,
to_configure_outputs = g_list_remove (to_configure_outputs,
output);
output_assignment = meta_find_output_assignment (outputs,
n_outputs,
output_assignment = meta_find_output_assignment (output_assignments,
n_output_assignments,
output);
meta_output_assign_crtc (output, crtc, output_assignment);
}

View File

@ -94,12 +94,12 @@ can_blit_buffer (ContextData *context_data,
for (i = 0; i < context_data->buffer_support->len; i++)
{
BufferTypeSupport *support =
BufferTypeSupport *other_support =
&g_array_index (context_data->buffer_support, BufferTypeSupport, i);
if (support->drm_format == drm_format &&
support->drm_modifier == drm_modifier)
return support->can_blit;
if (other_support->drm_format == drm_format &&
other_support->drm_modifier == drm_modifier)
return other_support->can_blit;
}
if (!meta_egl_has_extensions (egl, egl_display, NULL,

View File

@ -863,12 +863,12 @@ meta_thread_flush_callbacks (MetaThread *thread)
g_mutex_lock (&priv->callbacks_mutex);
for (i = 0; i < main_thread_sources->len; i++)
{
MetaThreadCallbackSource *source =
MetaThreadCallbackSource *callback_source =
g_ptr_array_index (main_thread_sources, i);
pending_callbacks =
g_list_concat (pending_callbacks,
g_steal_pointer (&source->callbacks));
g_steal_pointer (&callback_source->callbacks));
}
callback_sources = g_hash_table_get_values (priv->callback_sources);