diff options
author | Benjamin Otte <otte@redhat.com> | 2017-10-06 21:19:42 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2017-10-06 21:23:39 +0200 |
commit | 43c212ac28f5f80e10c49590e569b6450098743f (patch) | |
tree | ae5210d90f79d313d3b4c88c88f5e00b87405e0e /gtk/gtktextlayout.c | |
parent | 2ac66328a3edc0838c19b49fcb9468c473936c9c (diff) | |
download | gtk+-43c212ac28f5f80e10c49590e569b6450098743f.tar.gz |
build: Enable -Wswitch-enum and -Wswitch-default
This patch makes that work using 1 of 2 options:
1. Add all missing enums to the switch statement
or
2. Cast the switch argument to a uint to avoid having to do that (mostly
for GdkEventType).
I even found a bug while doing that: clearing a GtkImage with a surface
did not notify thae surface property.
The reason for enabling this flag even though it is tedious at times is
that it is very useful when adding values to an enum, because it makes
GTK immediately warn about all the switch statements where this enum is
relevant.
And I expect changes to enums to be frequent during the GTK4 development
cycle.
Diffstat (limited to 'gtk/gtktextlayout.c')
-rw-r--r-- | gtk/gtktextlayout.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c index ad3d1e0c9e..75c37a583b 100644 --- a/gtk/gtktextlayout.c +++ b/gtk/gtktextlayout.c @@ -1349,6 +1349,11 @@ set_para_values (GtkTextLayout *layout, case PANGO_DIRECTION_RTL : display->direction = GTK_TEXT_DIR_RTL; break; + case PANGO_DIRECTION_LTR: + case PANGO_DIRECTION_TTB_LTR: + case PANGO_DIRECTION_TTB_RTL: + case PANGO_DIRECTION_WEAK_LTR: + case PANGO_DIRECTION_WEAK_RTL: default: display->direction = GTK_TEXT_DIR_LTR; break; @@ -1411,6 +1416,7 @@ set_para_values (GtkTextLayout *layout, break; case GTK_WRAP_NONE: + default: break; } @@ -1998,7 +2004,7 @@ add_preedit_attrs (GtkTextLayout *layout, PangoAttribute *attr = tmp_list->data; GdkRGBA rgba; - switch (attr->klass->type) + switch ((guint) attr->klass->type) { case PANGO_ATTR_FOREGROUND: convert_color (&rgba, (PangoAttrColor *)attr); @@ -2583,6 +2589,7 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout, switch (pango_layout_get_alignment (display->layout)) { case PANGO_ALIGN_LEFT: + default: break; case PANGO_ALIGN_CENTER: display->x_offset += excess / 2; |