[PATCH weston v2 8/8] terminal: Silence maybe-uninitialized warning

Emil Velikov emil.l.velikov at gmail.com
Mon Jul 11 21:28:47 UTC 2016


On 10 July 2016 at 10:00, Quentin Glidic
<sardemff7+wayland at sardemff7.net> wrote:
> From: Quentin Glidic <sardemff7+git at sardemff7.net>
>
> clients/terminal.c: In function 'redraw_handler':
> clients/terminal.c:213:28: warning: 'machine.unicode' may be used
> uninitialized in this function [-Wmaybe-uninitialized]
>   struct utf8_state_machine machine;
>                             ^~~~~~~
>
> clients/terminal.c: In function 'handle_char':
> clients/terminal.c:213:28: warning: 'machine.unicode' may be used
> uninitialized in this function [-Wmaybe-uninitialized]
>
> Warning produced by GCC 5.3 and 6.1, with -O3.
>
> Signed-off-by: Quentin Glidic <sardemff7+git at sardemff7.net>
> ---
>
> You have to look at the file directly to completely understand this one.
> Not sure that is the value to return in this case, but at least it
> silences the warning.
>
::unicode will never be read (get_unicode) when it's invalid, since
::state will equal to utf8state_reject (as set in utf8_next_char).
Seems like the compiler/optimiser cannot see that far, thus throws a
warning message.

With anything vaguely like the above in the commit message, the patch is
Reviewed-by: Emil Velikov <emil.l.velikov at gmail.com>

-Emil


More information about the wayland-devel mailing list