diff --git a/gdk/gdkgltexture.c b/gdk/gdkgltexture.c index 618aa45f4c..e110b6670b 100644 --- a/gdk/gdkgltexture.c +++ b/gdk/gdkgltexture.c @@ -91,10 +91,10 @@ gdk_gl_texture_download (GdkTexture *texture, } else { - GdkSurface *surface; + GdkSurface *gl_surface; - surface = gdk_gl_context_get_surface (self->context); - gdk_cairo_draw_from_gl (cr, surface, self->id, GL_TEXTURE, 1, + gl_surface = gdk_gl_context_get_surface (self->context); + gdk_cairo_draw_from_gl (cr, gl_surface, self->id, GL_TEXTURE, 1, area->x, area->y, area->width, area->height); } diff --git a/gdk/gdkvulkancontext.c b/gdk/gdkvulkancontext.c index 3aebd5717d..28a135ad06 100644 --- a/gdk/gdkvulkancontext.c +++ b/gdk/gdkvulkancontext.c @@ -786,12 +786,12 @@ gdk_display_create_vulkan_device (GdkDisplay *display, else { gint64 device_idx; - GError *error = NULL; + GError *error2 = NULL; - if (!g_ascii_string_to_signed (override, 10, 0, G_MAXINT, &device_idx, &error)) + if (!g_ascii_string_to_signed (override, 10, 0, G_MAXINT, &device_idx, &error2)) { - g_warning ("Failed to parse %s: %s", "GDK_VULKAN_DEVICE", error->message); - g_error_free (error); + g_warning ("Failed to parse %s: %s", "GDK_VULKAN_DEVICE", error2->message); + g_error_free (error2); device_idx = -1; } diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c index 0c870d8722..e6609559af 100644 --- a/gdk/wayland/gdkdisplay-wayland.c +++ b/gdk/wayland/gdkdisplay-wayland.c @@ -1789,7 +1789,7 @@ init_settings (GdkDisplay *display) { GVariant *ret; GError *error = NULL; - const char *schema; + const char *schema_str; GVariant *val; GVariantIter *iter; const char *patterns[] = { "org.gnome.*", NULL }; @@ -1829,7 +1829,7 @@ init_settings (GdkDisplay *display) g_variant_get (ret, "(a{sa{sv}})", &iter); - while (g_variant_iter_loop (iter, "{s@a{sv}}", &schema, &val)) + while (g_variant_iter_loop (iter, "{s@a{sv}}", &schema_str, &val)) { GVariantIter *iter2 = g_variant_iter_new (val); const char *key; @@ -1837,17 +1837,17 @@ init_settings (GdkDisplay *display) while (g_variant_iter_loop (iter2, "{sv}", &key, &v)) { - TranslationEntry *entry = find_translation_entry_by_schema (schema, key); + TranslationEntry *entry = find_translation_entry_by_schema (schema_str, key); if (entry) { char *a = g_variant_print (v, FALSE); - g_debug ("Using portal setting for %s %s: %s\n", schema, key, a); + g_debug ("Using portal setting for %s %s: %s\n", schema_str, key, a); g_free (a); apply_portal_setting (entry, v, display); } else { - g_debug ("Ignoring portal setting for %s %s", schema, key); + g_debug ("Ignoring portal setting for %s %s", schema_str, key); } } g_variant_iter_free (iter2); diff --git a/gdk/x11/gdkclipboard-x11.c b/gdk/x11/gdkclipboard-x11.c index 55d0440e1e..aeea1af1fe 100644 --- a/gdk/x11/gdkclipboard-x11.c +++ b/gdk/x11/gdkclipboard-x11.c @@ -259,10 +259,11 @@ gdk_x11_clipboard_request_targets_finish (GObject *source_object, GBytes *bytes; GError *error = NULL; + display = gdk_clipboard_get_display (GDK_CLIPBOARD (cb)); + bytes = g_input_stream_read_bytes_finish (stream, res, &error); if (bytes == NULL) { - GdkDisplay *display = gdk_clipboard_get_display (GDK_CLIPBOARD (cb)); GDK_DISPLAY_NOTE (display, CLIPBOARD, g_printerr ("%s: error reading TARGETS: %s\n", cb->selection, error->message)); g_error_free (error); @@ -292,7 +293,6 @@ gdk_x11_clipboard_request_targets_finish (GObject *source_object, g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes) / sizeof (Atom)); - display = gdk_clipboard_get_display (GDK_CLIPBOARD (cb)); formats = gdk_x11_clipboard_formats_from_atoms (display, g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes) / sizeof (Atom)); diff --git a/gdk/x11/gdkdrop-x11.c b/gdk/x11/gdkdrop-x11.c index 6a71b55cf3..050695bf9c 100644 --- a/gdk/x11/gdkdrop-x11.c +++ b/gdk/x11/gdkdrop-x11.c @@ -375,14 +375,14 @@ gdk_x11_drop_read_actions (GdkDrop *drop) if (GDK_DISPLAY_DEBUG_CHECK (display, DND)) { GString *action_str = g_string_new (NULL); - GdkDragAction actions = gdk_drop_get_actions (drop); - if (actions & GDK_ACTION_MOVE) + GdkDragAction drop_actions = gdk_drop_get_actions (drop); + if (drop_actions & GDK_ACTION_MOVE) g_string_append(action_str, "MOVE "); - if (actions & GDK_ACTION_COPY) + if (drop_actions & GDK_ACTION_COPY) g_string_append(action_str, "COPY "); - if (actions & GDK_ACTION_LINK) + if (drop_actions & GDK_ACTION_LINK) g_string_append(action_str, "LINK "); - if (actions & GDK_ACTION_ASK) + if (drop_actions & GDK_ACTION_ASK) g_string_append(action_str, "ASK "); g_message("Xdnd actions = %s", action_str->str); diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c index f83df090e8..70a10dbc33 100644 --- a/gdk/x11/gdkscreen-x11.c +++ b/gdk/x11/gdkscreen-x11.c @@ -676,7 +676,7 @@ init_no_multihead (GdkX11Screen *x11_screen, gboolean *changed) for (i = 0; i < x11_display->monitors->len; i++) { - GdkX11Monitor *monitor = x11_display->monitors->pdata[i]; + monitor = x11_display->monitors->pdata[i]; monitor->add = FALSE; monitor->remove = TRUE; } @@ -720,7 +720,7 @@ init_no_multihead (GdkX11Screen *x11_screen, gboolean *changed) for (i = x11_display->monitors->len - 1; i >= 0; i--) { - GdkX11Monitor *monitor = x11_display->monitors->pdata[i]; + monitor = x11_display->monitors->pdata[i]; if (monitor->add) { gdk_display_monitor_added (GDK_DISPLAY (x11_display), GDK_MONITOR (monitor)); diff --git a/gdk/x11/gdkselectionoutputstream-x11.c b/gdk/x11/gdkselectionoutputstream-x11.c index 5f35cdf6be..c43e513ab3 100644 --- a/gdk/x11/gdkselectionoutputstream-x11.c +++ b/gdk/x11/gdkselectionoutputstream-x11.c @@ -869,7 +869,6 @@ gdk_x11_selection_output_streams_request (GdkDisplay *display, gpointer user_data) { const char *mime_type, *selection, *target, *property; - gsize i; selection = gdk_x11_get_xatom_name_for_display (display, xselection); target = gdk_x11_get_xatom_name_for_display (display, xtarget); @@ -991,6 +990,8 @@ gdk_x11_selection_output_streams_request (GdkDisplay *display, } else { + gsize i; + for (i = 0; i < G_N_ELEMENTS (special_targets); i++) { if (g_str_equal (target, special_targets[i].x_target) && diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c index be0f293add..6e7abbc3e1 100644 --- a/gsk/gl/gskglrenderer.c +++ b/gsk/gl/gskglrenderer.c @@ -653,7 +653,6 @@ render_border_node (GskGLRenderer *self, } }; int indices[4] = { 0, 1, 2, 3 }; - int i; /* We sort them by color */ sort_border_sides (colors, indices); @@ -1067,7 +1066,7 @@ render_color_matrix_node (GskGLRenderer *self, if (is_offscreen) { - GskQuadVertex vertex_data[GL_N_VERTICES] = { + GskQuadVertex offscreen_vertex_data[GL_N_VERTICES] = { { { min_x, min_y }, { 0, 1 }, }, { { min_x, max_y }, { 0, 0 }, }, { { max_x, min_y }, { 1, 1 }, }, @@ -1077,7 +1076,7 @@ render_color_matrix_node (GskGLRenderer *self, { { max_x, min_y }, { 1, 1 }, }, }; - ops_draw (builder, vertex_data); + ops_draw (builder, offscreen_vertex_data); } else { @@ -1120,7 +1119,7 @@ render_blur_node (GskGLRenderer *self, if (is_offscreen) { - GskQuadVertex vertex_data[GL_N_VERTICES] = { + GskQuadVertex offscreen_vertex_data[GL_N_VERTICES] = { { { min_x, min_y }, { 0, 1 }, }, { { min_x, max_y }, { 0, 0 }, }, { { max_x, min_y }, { 1, 1 }, }, @@ -1130,7 +1129,7 @@ render_blur_node (GskGLRenderer *self, { { max_x, min_y }, { 1, 1 }, }, }; - ops_draw (builder, vertex_data); + ops_draw (builder, offscreen_vertex_data); } else { @@ -1635,7 +1634,7 @@ render_shadow_node (GskGLRenderer *self, ops_set_texture (builder, texture_id); if (is_offscreen) { - const GskQuadVertex vertex_data[GL_N_VERTICES] = { + const GskQuadVertex offscreen_vertex_data[GL_N_VERTICES] = { { { dx + min_x, dy + min_y }, { 0, 1 }, }, { { dx + min_x, dy + max_y }, { 0, 0 }, }, { { dx + max_x, dy + min_y }, { 1, 1 }, }, @@ -1645,11 +1644,11 @@ render_shadow_node (GskGLRenderer *self, { { dx + max_x, dy + min_y }, { 1, 1 }, }, }; - ops_draw (builder, vertex_data); + ops_draw (builder, offscreen_vertex_data); } else { - const GskQuadVertex vertex_data[GL_N_VERTICES] = { + const GskQuadVertex onscreen_vertex_data[GL_N_VERTICES] = { { { dx + min_x, dy + min_y }, { 0, 0 }, }, { { dx + min_x, dy + max_y }, { 0, 1 }, }, { { dx + max_x, dy + min_y }, { 1, 0 }, }, @@ -1659,7 +1658,7 @@ render_shadow_node (GskGLRenderer *self, { { dx + max_x, dy + min_y }, { 1, 0 }, }, }; - ops_draw (builder, vertex_data); + ops_draw (builder, onscreen_vertex_data); } ops_offset (builder, - dx, - dy); diff --git a/gsk/vulkan/gskvulkanrenderpass.c b/gsk/vulkan/gskvulkanrenderpass.c index b49c57294c..fa3d10ada6 100644 --- a/gsk/vulkan/gskvulkanrenderpass.c +++ b/gsk/vulkan/gskvulkanrenderpass.c @@ -1787,10 +1787,10 @@ gsk_vulkan_render_pass_draw_rect (GskVulkanRenderPass *self, break; case GSK_VULKAN_OP_PUSH_VERTEX_CONSTANTS: - for (int i = 0; i < layout_count; i++) + for (int j = 0; j < layout_count; j++) gsk_vulkan_push_constants_push (&op->constants.constants, command_buffer, - pipeline_layout[i]); + pipeline_layout[j]); break; case GSK_VULKAN_OP_CROSS_FADE: diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 26a1b7ce7f..26fe36b100 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -6334,7 +6334,6 @@ paste_received (GObject *clipboard, if (priv->insert_pos >= 0) { - gint pos, start, end; pos = priv->insert_pos; gtk_editable_get_selection_bounds (editable, &start, &end); if (!((start <= pos && pos <= end) || (end <= pos && pos <= start))) diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index 37fb282cf7..52c9a78df2 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -796,15 +796,15 @@ button_released_cb (GtkGestureMultiPress *gesture, if (button == GDK_BUTTON_SECONDARY) { - GtkWidget *button = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture)); + GtkWidget *button_widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture)); double diff; - if (button == priv->down_button) + if (button_widget == priv->down_button) { diff = gtk_adjustment_get_value (priv->adjustment) - gtk_adjustment_get_lower (priv->adjustment); if (diff > EPSILON) gtk_spin_button_real_spin (spin_button, -diff); } - else if (button == priv->up_button) + else if (button_widget == priv->up_button) { diff = gtk_adjustment_get_upper (priv->adjustment) - gtk_adjustment_get_value (priv->adjustment); if (diff > EPSILON) diff --git a/meson.build b/meson.build index afacc98635..0385d15b07 100644 --- a/meson.build +++ b/meson.build @@ -237,15 +237,15 @@ elif cc.get_id() == 'gcc' or cc.get_id() == 'clang' '-Wmissing-format-attribute', '-Wmissing-include-dirs', '-Wmissing-noreturn', - '-Wmissing-declarations', - '-Wmissing-prototypes', '-Wnested-externs', '-Wold-style-definition', '-Wpointer-arith', + '-Wshadow', '-Wstrict-prototypes', '-Wswitch-default', '-Wswitch-enum', '-Wundef', + '-Wuninitialized', '-Wunused', '-Werror=address', '-Werror=array-bounds', @@ -255,6 +255,8 @@ elif cc.get_id() == 'gcc' or cc.get_id() == 'clang' '-Werror=int-to-pointer-cast', '-Werror=main', '-Werror=missing-braces', + '-Werror=missing-declarations', + '-Werror=missing-prototypes', '-Werror=nonnull', '-Werror=pointer-to-int-cast', '-Werror=redundant-decls',