[cairo] GCC warning: correct?

Guillermo Rodriguez guillerodriguez.dev at gmail.com
Tue Jul 4 10:17:39 UTC 2017


2017-06-25 21:10 GMT+02:00 David Kastrup <dak at gnu.org>:
> David Kastrup <dak at gnu.org> writes:
>
>> cairo-surface.c: In function ‘cairo_surface_create_similar’:
>> cairo-surface.c:508:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
>>      if (unlikely (! CAIRO_CONTENT_VALID (content)))
>>      ^~
>> cairo-surface.c:511:9: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
>>          if (unlikely (other->status))
>>          ^~

Looking at the sources this seems to be just a (cosmetic) indentation
issue, no actual problems there. However the whole check in
cairo-surface.c:511 is redundant, as exactly the same check has been
done a few lines before (cairo-surface.c:501). I think the second one
can just be removed.

>>
>>
>
> And another one?
>
> cairo-script-operators.c: In function ‘_set_dash’:
> cairo-script-operators.c:4813:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
>   if (_csi_unlikely ((unsigned) array->stack.len >= INT_MAX / sizeof (double)))
>   ^~
> cairo-script-operators.c:4815:6: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
>       dashes = _csi_alloc (ctx, sizeof (double) * array->stack.len);
>       ^~~~~~

Also looks like a cosmetic indentation issue, no actual problems.

The fixes for both are trivial, I am submitting them separately.

Guillermo Rodriguez


More information about the cairo mailing list