From d5a7bbd09462d08f8734b1a07d8f90409012430a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 25 Jan 2019 00:47:44 +0100 Subject: [PATCH] Fix builds with G_DISABLE_ASSERT Commit 25f416c13db added additional compilation warnings, including -Werror=return-type. There are several places where this results in build failures if `g_assert_not_reached()` is disabled at compile time and the compiler misses a return value. https://gitlab.gnome.org/GNOME/mutter/issues/447 --- src/backends/meta-monitor-manager.c | 1 + src/backends/meta-monitor-transform.c | 1 + src/backends/meta-remote-desktop-session.c | 1 + src/backends/native/meta-cursor-renderer-native.c | 1 + src/backends/x11/meta-monitor-manager-xrandr.c | 1 + src/backends/x11/meta-renderer-x11.c | 1 + src/compositor/meta-background.c | 1 + src/compositor/meta-surface-actor.c | 1 + src/core/boxes.c | 1 + src/core/display.c | 2 ++ src/core/edge-resistance.c | 1 + src/core/events.c | 1 + src/core/util.c | 1 + src/core/window.c | 1 + src/ui/frames.c | 3 +++ src/wayland/meta-wayland-buffer.c | 1 + src/wayland/meta-wayland-outputs.c | 1 + src/wayland/meta-wayland-xdg-shell.c | 2 ++ src/x11/iconcache.c | 1 + src/x11/window-x11.c | 2 ++ 20 files changed, 25 insertions(+) diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c index c69fbd107..d4b9bdde4 100644 --- a/src/backends/meta-monitor-manager.c +++ b/src/backends/meta-monitor-manager.c @@ -994,6 +994,7 @@ get_connector_type_name (MetaConnectorType connector_type) case META_CONNECTOR_TYPE_DSI: return "DSI"; default: g_assert_not_reached (); } + return NULL; } static GList * diff --git a/src/backends/meta-monitor-transform.c b/src/backends/meta-monitor-transform.c index 1ecf341cc..5287e85f8 100644 --- a/src/backends/meta-monitor-transform.c +++ b/src/backends/meta-monitor-transform.c @@ -37,4 +37,5 @@ meta_monitor_transform_invert (MetaMonitorTransform transform) return transform; } g_assert_not_reached (); + return 0; } diff --git a/src/backends/meta-remote-desktop-session.c b/src/backends/meta-remote-desktop-session.c index f44d2d52b..f069cba2f 100644 --- a/src/backends/meta-remote-desktop-session.c +++ b/src/backends/meta-remote-desktop-session.c @@ -479,6 +479,7 @@ discrete_steps_to_scroll_direction (unsigned int axis, return CLUTTER_SCROLL_RIGHT; g_assert_not_reached (); + return 0; } static gboolean diff --git a/src/backends/native/meta-cursor-renderer-native.c b/src/backends/native/meta-cursor-renderer-native.c index d32548344..f54f21c33 100644 --- a/src/backends/native/meta-cursor-renderer-native.c +++ b/src/backends/native/meta-cursor-renderer-native.c @@ -924,6 +924,7 @@ is_cursor_hw_state_valid (MetaCursorSprite *cursor_sprite, } g_assert_not_reached (); + return FALSE; } #ifdef HAVE_WAYLAND diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c index 246e60334..c3a33e5d3 100644 --- a/src/backends/x11/meta-monitor-manager-xrandr.c +++ b/src/backends/x11/meta-monitor-manager-xrandr.c @@ -173,6 +173,7 @@ meta_monitor_transform_to_xrandr (MetaMonitorTransform transform) } g_assert_not_reached (); + return 0; } static gboolean diff --git a/src/backends/x11/meta-renderer-x11.c b/src/backends/x11/meta-renderer-x11.c index e070d63b2..a501416e7 100644 --- a/src/backends/x11/meta-renderer-x11.c +++ b/src/backends/x11/meta-renderer-x11.c @@ -70,6 +70,7 @@ get_x11_cogl_winsys_vtable (CoglRenderer *renderer) break; } g_assert_not_reached (); + return NULL; } static CoglRenderer * diff --git a/src/compositor/meta-background.c b/src/compositor/meta-background.c index 7d74d2f23..0cdc7cb00 100644 --- a/src/compositor/meta-background.c +++ b/src/compositor/meta-background.c @@ -635,6 +635,7 @@ texture_has_alpha (CoglTexture *texture) return FALSE; default: g_assert_not_reached (); + return FALSE; } } diff --git a/src/compositor/meta-surface-actor.c b/src/compositor/meta-surface-actor.c index 9a7d0ef5b..6edf7c22d 100644 --- a/src/compositor/meta-surface-actor.c +++ b/src/compositor/meta-surface-actor.c @@ -348,6 +348,7 @@ meta_surface_actor_is_argb32 (MetaSurfaceActor *self) return FALSE; default: g_assert_not_reached (); + return FALSE; } } diff --git a/src/core/boxes.c b/src/core/boxes.c index 471258f40..7cb476d45 100644 --- a/src/core/boxes.c +++ b/src/core/boxes.c @@ -1246,6 +1246,7 @@ meta_rectangle_edge_aligns (const MetaRectangle *rect, const MetaEdge *edge) BOX_LEFT (edge->rect) <= BOX_RIGHT (*rect); default: g_assert_not_reached (); + return FALSE; } } diff --git a/src/core/display.c b/src/core/display.c index 02b6f92e0..74e732905 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -1603,6 +1603,7 @@ get_event_route_from_grab_op (MetaGrabOp op) default: g_assert_not_reached (); + return 0; } } @@ -2622,6 +2623,7 @@ meta_display_supports_extended_barriers (MetaDisplay *display) } g_assert_not_reached (); + return FALSE; } /** diff --git a/src/core/edge-resistance.c b/src/core/edge-resistance.c index 88b2a51e1..4f24c6de7 100644 --- a/src/core/edge-resistance.c +++ b/src/core/edge-resistance.c @@ -308,6 +308,7 @@ movement_towards_edge (MetaSide side, int increment) return increment > 0; default: g_assert_not_reached (); + return FALSE; } } diff --git a/src/core/events.c b/src/core/events.c index 350fbe86b..5b8e49fc7 100644 --- a/src/core/events.c +++ b/src/core/events.c @@ -86,6 +86,7 @@ get_window_for_event (MetaDisplay *display, return display->grab_window; default: g_assert_not_reached (); + return NULL; } } diff --git a/src/core/util.c b/src/core/util.c index 5febb0edf..57b73747d 100644 --- a/src/core/util.c +++ b/src/core/util.c @@ -992,6 +992,7 @@ meta_get_locale_direction (void) return META_LOCALE_DIRECTION_RTL; default: g_assert_not_reached (); + return 0; } } diff --git a/src/core/window.c b/src/core/window.c index 7f208c3a2..0fac22b85 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -5498,6 +5498,7 @@ meta_window_get_workspaces (MetaWindow *window) return NULL; else g_assert_not_reached (); + return NULL; } static void diff --git a/src/ui/frames.c b/src/ui/frames.c index 8743db91e..77f4eb77d 100644 --- a/src/ui/frames.c +++ b/src/ui/frames.c @@ -955,6 +955,7 @@ grab_op_from_resize_control (MetaFrameControl control) return META_GRAB_OP_RESIZING_W; default: g_assert_not_reached (); + return META_GRAB_OP_NONE; } } @@ -1003,6 +1004,7 @@ get_button_number (const ClutterEvent *event) return clutter_event_get_button (event); g_assert_not_reached (); + return -1; } static gboolean @@ -1105,6 +1107,7 @@ meta_frame_left_click_event (MetaUIFrame *frame, return FALSE; default: g_assert_not_reached (); + return FALSE; } } diff --git a/src/wayland/meta-wayland-buffer.c b/src/wayland/meta-wayland-buffer.c index 9fee02d52..a82e242e6 100644 --- a/src/wayland/meta-wayland-buffer.c +++ b/src/wayland/meta-wayland-buffer.c @@ -373,6 +373,7 @@ meta_wayland_buffer_attach (MetaWaylandBuffer *buffer, } g_assert_not_reached (); + return FALSE; } CoglTexture * diff --git a/src/wayland/meta-wayland-outputs.c b/src/wayland/meta-wayland-outputs.c index b9f0cb34f..04f43fc17 100644 --- a/src/wayland/meta-wayland-outputs.c +++ b/src/wayland/meta-wayland-outputs.c @@ -94,6 +94,7 @@ cogl_subpixel_order_to_wl_output_subpixel (CoglSubpixelOrder subpixel_order) } g_assert_not_reached (); + return WL_OUTPUT_SUBPIXEL_UNKNOWN; } static enum wl_output_subpixel diff --git a/src/wayland/meta-wayland-xdg-shell.c b/src/wayland/meta-wayland-xdg-shell.c index af35cc89a..c7e738357 100644 --- a/src/wayland/meta-wayland-xdg-shell.c +++ b/src/wayland/meta-wayland-xdg-shell.c @@ -1832,6 +1832,7 @@ positioner_anchor_to_placement_anchor (uint32_t anchor) return (META_PLACEMENT_ANCHOR_BOTTOM | META_PLACEMENT_ANCHOR_RIGHT); default: g_assert_not_reached (); + return META_PLACEMENT_ANCHOR_NONE; } } @@ -1860,6 +1861,7 @@ positioner_gravity_to_placement_gravity (uint32_t gravity) return (META_PLACEMENT_GRAVITY_BOTTOM | META_PLACEMENT_GRAVITY_RIGHT); default: g_assert_not_reached (); + return META_PLACEMENT_GRAVITY_NONE; } } diff --git a/src/x11/iconcache.c b/src/x11/iconcache.c index 7ab63b6a5..15d72da65 100644 --- a/src/x11/iconcache.c +++ b/src/x11/iconcache.c @@ -302,6 +302,7 @@ standard_pict_format_for_depth (int depth) default: g_assert_not_reached (); } + return 0; } static XRenderPictFormat * diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c index eb907c96e..c2103aa14 100644 --- a/src/x11/window-x11.c +++ b/src/x11/window-x11.c @@ -931,6 +931,7 @@ is_edge_constraint_resizable (MetaEdgeConstraint constraint) } g_assert_not_reached (); + return FALSE; } static gboolean @@ -946,6 +947,7 @@ is_edge_constraint_tiled (MetaEdgeConstraint constraint) } g_assert_not_reached (); + return FALSE; } static unsigned long