[ovs-dev] [PATCH] ovsdb-idlc: Use ALIGNED_CAST to avoid spurious warnings for index rows.

Han Zhou zhouhan at gmail.com
Wed Sep 12 22:47:05 UTC 2018


On Wed, Sep 12, 2018 at 2:18 PM Ben Pfaff <blp at ovn.org> wrote:
>
> On Tue, Sep 11, 2018 at 11:32:25PM -0700, Han Zhou wrote:
> > On Mon, Sep 10, 2018 at 1:01 PM Ben Pfaff <blp at ovn.org> wrote:
> > >
> > > The *_index_init_row() function casts a generic ovsdb_idl_row pointer
to
> > > a specific type of row pointer.  This can cause an increase in
required
> > > alignment with some kinds of data on some architectures.  GCC
complains,
> > > e.g.:
> > >
> > >     lib/vswitch-idl.c: In function
> > 'ovsrec_flow_sample_collector_set_index_init_row'
> > >     lib/vswitch-idl.c:9277:12: warning: cast increases required
alignment
> > of target
> >
> > Hi Ben, could you share on which compiler/version you see this warning?
>
> It's on non-x86 architectures, e.g. mipsel.  I don't think it's
> particularly sensitive to GCC version but this is with version 8.2.0:
>
https://buildd.debian.org/status/fetch.php?pkg=openvswitch&arch=mipsel&ver=2.10.0%2B2018.08.28%2Bgit.8ca7c82b7d%2Bds1-3&stamp=1536673373&raw=0

I see, thanks. But I wonder why it complains only for this particular type
cast - there are many type casts in other places. Do you have a hint on
when should the ALIGNED_CAST be used, or do we have to rely on the compiler
warnings - and it is not easy to get since most developers doesn't compile
for other archs.


More information about the dev mailing list