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

Daniel Stone daniel at fooishbar.org
Wed Nov 16 15:47:52 UTC 2016


Hi,

On 16 July 2016 at 08:42, Quentin Glidic
<sardemff7+wayland at sardemff7.net> wrote:
> On 11/07/2016 23:28, Emil Velikov wrote:
>> ::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>
>
> I found it weird that the compiler wouldn’t see that, so I re-checked the
> code.
>
> I think with -O3, this specific "for" is compile-time unlooped, and
> utf8_next_char inlined.
> And there is *one* path that can keep machine.state to utf8state_start, thus
> triggering the warning.
>
> Without -O3, the function is globally tagged as “changing unicode”, so no
> warning is produced.
>
> I will let the pusher to choose what to include in the commit message, as I
> find the wording “silence” (and not “fix”) clear enough, though in this
> specific case, it could need an actual fix.
>
> Side note: I picked 0 as the default value, but maybe in this case 0xfffd
> would be better?

The reasoning here seems legitimate; I've included your text here and
downgraded Emil's R-b to an A-b accordingly. Fixing it would indeed
probably be better, but honestly, corner cases in terminal UTF-8
handling aren't really our biggest concern right now.

Cheers,
Daniel


More information about the wayland-devel mailing list