commit 8549e62d8595bb6f94b51f2051f8542e357f236b Author: Benjamin Otte Date: Tue Oct 24 18:13:45 2017 +0200 Add default return values to switch statements We are using g_assert_not_reached() without doing anything, assuming it aborts the program. In release builds however, it is ignored. diff --git a/gdk/x11/gdkdevicemanager-core-x11.c b/gdk/x11/gdkdevicemanager-core-x11.c index 350a79b03f..dd8613e3fd 100644 --- a/gdk/x11/gdkdevicemanager-core-x11.c +++ b/gdk/x11/gdkdevicemanager-core-x11.c @@ -265,6 +265,7 @@ translate_crossing_mode (int mode) return GDK_CROSSING_UNGRAB; default: g_assert_not_reached (); + return GDK_CROSSING_NORMAL; } } @@ -285,6 +286,7 @@ translate_notify_type (int detail) return GDK_NOTIFY_NONLINEAR_VIRTUAL; default: g_assert_not_reached (); + return GDK_NOTIFY_UNKONWN; } } diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c index 8779c65a72..758513e4db 100644 --- a/gdk/x11/gdkdevicemanager-xi2.c +++ b/gdk/x11/gdkdevicemanager-xi2.c @@ -1068,6 +1068,7 @@ translate_crossing_mode (gint mode) /* Fall through, unexpected in pointer crossing events */ default: g_assert_not_reached (); + return GDK_CROSSING_NORMAL; } } @@ -1088,6 +1089,7 @@ translate_notify_type (gint detail) return GDK_NOTIFY_NONLINEAR_VIRTUAL; default: g_assert_not_reached (); + return GDK_NOTIFY_UNKONWN; } } diff --git a/gtk/gtkcssselector.c b/gtk/gtkcssselector.c index 241a690230..961e78ea5c 100644 --- a/gtk/gtkcssselector.c +++ b/gtk/gtkcssselector.c @@ -876,6 +876,7 @@ change_pseudoclass_position (const GtkCssSelector *selector) return GTK_CSS_CHANGE_FIRST_CHILD | GTK_CSS_CHANGE_LAST_CHILD; default: g_assert_not_reached (); + return 0; } } diff --git a/gtk/inspector/general.c b/gtk/inspector/general.c index 2e7e21207b..62404a05c6 100644 --- a/gtk/inspector/general.c +++ b/gtk/inspector/general.c @@ -501,7 +501,7 @@ translate_subpixel_layout (GdkSubpixelLayout subpixel) case GDK_SUBPIXEL_LAYOUT_HORIZONTAL_BGR: return "horizontal bgr"; case GDK_SUBPIXEL_LAYOUT_VERTICAL_RGB: return "vertical rgb"; case GDK_SUBPIXEL_LAYOUT_VERTICAL_BGR: return "vertical bgr"; - default: g_assert_not_reached (); + default: g_assert_not_reached (); return "none; } } commit 46f475664d66e25f0cc4212786c441f929a91d05 Author: Emmanuele Bassi Date: Tue Oct 24 16:58:06 2017 +0100 Add a return value When building with G_DISABLE_ASSERT, the g_assert_not_reached() statement won't do anything, and we're going to fall through, and the compiler will emit a warning that we're not returning anything from a function with a return value. diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c index bb15eb1820..2d738a63ca 100644 --- a/gdk/wayland/gdkwindow-wayland.c +++ b/gdk/wayland/gdkwindow-wayland.c @@ -1617,6 +1617,9 @@ rect_anchor_to_anchor (GdkGravity rect_anchor) default: g_assert_not_reached (); } + + return (ZXDG_POSITIONER_V6_ANCHOR_TOP | + ZXDG_POSITIONER_V6_ANCHOR_LEFT); } static enum zxdg_positioner_v6_gravity @@ -1650,6 +1653,9 @@ window_anchor_to_gravity (GdkGravity rect_anchor) default: g_assert_not_reached (); } + + return (ZXDG_POSITIONER_V6_GRAVITY_BOTTOM | + ZXDG_POSITIONER_V6_GRAVITY_RIGHT); } static GdkWindow * commit 373b407bd26a940072173e0a509038185b63e936 Author: Benjamin Otte Date: Tue Oct 24 18:26:08 2017 +0200 Fix build Don't do two things at once and forget to run ninja before pushing. diff --git a/gdk/x11/gdkdevicemanager-core-x11.c b/gdk/x11/gdkdevicemanager-core-x11.c index dd8613e3fd..c662d215ce 100644 --- a/gdk/x11/gdkdevicemanager-core-x11.c +++ b/gdk/x11/gdkdevicemanager-core-x11.c @@ -286,7 +286,7 @@ translate_notify_type (int detail) return GDK_NOTIFY_NONLINEAR_VIRTUAL; default: g_assert_not_reached (); - return GDK_NOTIFY_UNKONWN; + return GDK_NOTIFY_UNKNOWN; } } diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c index 758513e4db..56fb2c8b25 100644 --- a/gdk/x11/gdkdevicemanager-xi2.c +++ b/gdk/x11/gdkdevicemanager-xi2.c @@ -1089,7 +1089,7 @@ translate_notify_type (gint detail) return GDK_NOTIFY_NONLINEAR_VIRTUAL; default: g_assert_not_reached (); - return GDK_NOTIFY_UNKONWN; + return GDK_NOTIFY_UNKNOWN; } } diff --git a/gtk/inspector/general.c b/gtk/inspector/general.c index 62404a05c6..45a386e56b 100644 --- a/gtk/inspector/general.c +++ b/gtk/inspector/general.c @@ -501,7 +501,7 @@ translate_subpixel_layout (GdkSubpixelLayout subpixel) case GDK_SUBPIXEL_LAYOUT_HORIZONTAL_BGR: return "horizontal bgr"; case GDK_SUBPIXEL_LAYOUT_VERTICAL_RGB: return "vertical rgb"; case GDK_SUBPIXEL_LAYOUT_VERTICAL_BGR: return "vertical bgr"; - default: g_assert_not_reached (); return "none; + default: g_assert_not_reached (); return "none"; } }