[PATCH] Cleanups and bug fix for 13042

Amitay Isaacs amitay at gmail.com
Tue Sep 26 07:03:46 UTC 2017


On Tue, Sep 26, 2017 at 4:05 PM, Volker Lendecke <Volker.Lendecke at sernet.de>
wrote:

> On Tue, Sep 26, 2017 at 01:35:43PM +1000, Amitay Isaacs wrote:
> > Reviewed-by: Amitay Isaacs <amitay at gmail.com>
>
> Thanks!
>
> > Minor nitpick --
> > The compilation warnings are from ctdbd.c and ctdb_daemon.c (nested event
> > loop).
> > There should not be any compilation warnings from ctdb.c.  If you find
> any,
> > please let me know.
>
> When compiling with clang you get many warnings of the following type:
>
> [2885/4321] Compiling ctdb/tools/ctdb.c
> ../ctdb/server/ctdb_daemon.c:136:40: warning: comparison of integers of
> different signs: 'int' and 'uint32_t' (aka 'unsigned int') [-Wsign-compare]
>                 if (ctdb_queue_length(client->queue) >
> client->ctdb->tunable.max_queue_depth_drop_msg) {
>                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> That should be easy to fix. Not so easy to fix is:
>
> ../ctdb/server/ctdb_daemon.c:158:6: warning: cast from 'struct
> ctdb_req_header *' to 'struct ctdb_req_message_old *' increases required
> alignment from 4 to 8 [-Wcast-align]
>         r = ctdbd_allocate_pkt(client->ctdb, client->ctdb,
> CTDB_REQ_MESSAGE,
>             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~~~
> ../ctdb/include/ctdb_client.h:65:2: note: expanded from macro
> 'ctdbd_allocate_pkt'
>         (type *)_ctdbd_allocate_pkt(ctdb, mem_ctx, operation, length, \
>         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> which on x86_64 is a performance issue if at all. If we still had
> sparc, this would be a real problem.
>

Even though it's saying "Compiling ctdb/tools/ctdb.c", all the warnings are
in ctdb_daemon.c

May be you are using "make -j" ?

I am aware of the warnings in the server code (ctdb/server/*.c).
When I am using clang I usually turn off following flags:

  -Wcast-align -Wcast-qual

Amitay.


More information about the samba-technical mailing list