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/gtkexpander.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/gtkexpander.c')
-rw-r--r-- | gtk/gtkexpander.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gtk/gtkexpander.c b/gtk/gtkexpander.c index 6aac0e343d..55ff54934a 100644 --- a/gtk/gtkexpander.c +++ b/gtk/gtkexpander.c @@ -739,6 +739,7 @@ focus_in_site (GtkExpander *expander, return FALSE; } case FOCUS_NONE: + default: break; } @@ -767,6 +768,7 @@ get_next_site (GtkExpander *expander, case GTK_DIR_TAB_FORWARD: case GTK_DIR_DOWN: case GTK_DIR_RIGHT: + default: return FOCUS_WIDGET; } break; @@ -780,6 +782,7 @@ get_next_site (GtkExpander *expander, return ltr ? FOCUS_NONE : FOCUS_LABEL; case GTK_DIR_TAB_FORWARD: case GTK_DIR_DOWN: + default: return FOCUS_LABEL; case GTK_DIR_RIGHT: return ltr ? FOCUS_LABEL : FOCUS_NONE; @@ -795,6 +798,7 @@ get_next_site (GtkExpander *expander, return ltr ? FOCUS_WIDGET : FOCUS_CHILD; case GTK_DIR_TAB_FORWARD: case GTK_DIR_DOWN: + default: return FOCUS_CHILD; case GTK_DIR_RIGHT: return ltr ? FOCUS_CHILD : FOCUS_WIDGET; @@ -810,12 +814,15 @@ get_next_site (GtkExpander *expander, case GTK_DIR_TAB_FORWARD: case GTK_DIR_DOWN: case GTK_DIR_RIGHT: + default: return FOCUS_NONE; } break; + default: + g_assert_not_reached (); + break; } - - g_assert_not_reached (); + return FOCUS_NONE; } |