[PATCH libevdev 1/4] Shut up compiler warning

Benjamin Tissoires benjamin.tissoires at gmail.com
Tue Mar 18 07:16:44 PDT 2014


On Tue, Mar 18, 2014 at 12:20 AM, Peter Hutterer
<peter.hutterer at who-t.net> wrote:
> Triggered with -O2

Weird, on my box, I manage to trigger it with -O or -Og, but not -O2 nor -O0...

This series is reviewed-by: Benjamin Tissoires <benjamin.tissoires at gmail.com>

Cheers,
Benjamin

>
> ../libevdev/libevdev.c: In function ‘libevdev_has_event_code’:
> ../libevdev/libevdev-util.h:58:20: warning: ‘mask’ may be used uninitialized
> in this function [-Wmaybe-uninitialized]
>
> Optimisation clearly shuffles things around here: in the code, if no max is
> found, we return -1 and bail out before we access mask.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>  libevdev/libevdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libevdev/libevdev.c b/libevdev/libevdev.c
> index 84d9195..b73c5f0 100644
> --- a/libevdev/libevdev.c
> +++ b/libevdev/libevdev.c
> @@ -1089,7 +1089,7 @@ libevdev_has_event_type(const struct libevdev *dev, unsigned int type)
>  LIBEVDEV_EXPORT int
>  libevdev_has_event_code(const struct libevdev *dev, unsigned int type, unsigned int code)
>  {
> -       const unsigned long *mask;
> +       const unsigned long *mask = NULL;
>         int max;
>
>         if (!libevdev_has_event_type(dev, type))
> --
> 1.8.5.3
>
> _______________________________________________
> Input-tools mailing list
> Input-tools at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/input-tools


More information about the Input-tools mailing list