[Xcb] Proposed patch to support clang compilation of util-image

Bart Massey bart at cs.pdx.edu
Mon Oct 17 07:44:09 UTC 2016


Yeah, assert() should be marked noreturn (directly or indirectly) in
general or bad things happen. Those assert()s really want to be assert()s
or calls to abort() or something: there is nothing good that can happen
after returning from those places.

On Sun, Oct 16, 2016 at 11:19 PM Alan Coopersmith <
alan.coopersmith at oracle.com> wrote:

> On 10/ 8/16 12:58 PM, Pablo Cholaky wrote:
> > I think this patch is currently harmless and makes support to clang to
> properly
> > compile it.
>
> clang doesn't complain on the current code for me (probably because my libc
> headers define the function called on a failed assert with the noreturn
> attribute), but adding this:
>
> >   assert(0);
> > +  return -1;
>
> causes clang to report two new warnings for me:
>
> ./xcb_bitops.h:210:10: warning: integer constant not in range of
>        enumerated type 'xcb_image_order_t' (aka 'enum xcb_image_order_t')
>        [-Wassign-enum]
>    return -1;
>           ^
> ./xcb_bitops.h:210:10: warning: implicit conversion changes signedness:
>        'int' to 'xcb_image_order_t' (aka 'enum xcb_image_order_t')
>        [-Wsign-conversion]
>    return -1;
>    ~~~~~~ ^~
>
> Admittedly I run clang with more warnings enabled than the default build,
> to
> help find issues during development.
>
> --
>         -Alan Coopersmith-              alan.coopersmith at oracle.com
>          Oracle Solaris Engineering - http://blogs.oracle.com/alanc
> _______________________________________________
> Xcb mailing list
> Xcb at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/xcb
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/xcb/attachments/20161017/4c373446/attachment.html>


More information about the Xcb mailing list