[PATCH weston 1/2] libinput: Suppress unhandled-case warning
Peter Hutterer
peter.hutterer at who-t.net
Tue Mar 14 23:54:49 UTC 2017
On Tue, Mar 14, 2017 at 05:26:50PM +0000, Daniel Stone wrote:
> When the wheel tilt source is present, gcc complains that we don't
> handle all possible enumeration values. We already ensure this cannot
> happen in its only caller (handle_pointer_axis), but gcc doesn't
> recognise this. Give it a default value to quiet the warning.
>
> Signed-off-by: Daniel Stone <daniels at collabora.com>
tbh, I dislike adding default cases because the warnings are really
useful to spot which bits aren't handled correctly yet. Especially in cases
like restricted enums (that don't change that often) it's imo usually better
to add the missing cases to be clear about the code's intent.
Cheers,
Peter
> ---
> libweston/libinput-device.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/libweston/libinput-device.c b/libweston/libinput-device.c
> index f97afcf8..78a09cfe 100644
> --- a/libweston/libinput-device.c
> +++ b/libweston/libinput-device.c
> @@ -191,6 +191,8 @@ normalize_scroll(struct libinput_event_pointer *pointer_event,
> value = libinput_event_pointer_get_axis_value(pointer_event,
> axis);
> break;
> + default:
> + break;
> }
>
> return value;
> --
> 2.12.0
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
More information about the wayland-devel
mailing list