build: Reintroduce warning flags from autotools

Some of the flags got lost in the meson transition or were demoted from
error flags to warning flags.
This commit reintroduces them.

It also includes fixes for the code that had warnings with those flags.
The big one being -Wshadow.
This commit is contained in:
Benjamin Otte 2019-01-22 04:30:47 +01:00
parent 7723749e00
commit 359bc7695c
12 changed files with 40 additions and 39 deletions

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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));

View File

@ -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);

View File

@ -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));

View File

@ -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) &&

View File

@ -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);

View File

@ -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:

View File

@ -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)))

View File

@ -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)

View File

@ -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',