Skip to content

Commit

Permalink
ovsdb-idlc: Use ALIGNED_CAST to avoid spurious warnings for index rows.
Browse files Browse the repository at this point in the history
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

However, rows are always allocated with malloc(), which returns member
suitable for any type, so this is a false positive warning and this commit
suppresses it.

Signed-off-by: Ben Pfaff <[email protected]>
Acked-by: Han Zhou <[email protected]>
  • Loading branch information
blp committed Sep 18, 2018
1 parent bc4fd43 commit 491fdb0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ovsdb/ovsdb-idlc.in
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@ struct %(s)s *
%(s)s_index_init_row(struct ovsdb_idl_index *index)
{
ovs_assert(index->table->class_ == &%(p)stable_%(tl)s);
return (struct %(s)s *) ovsdb_idl_index_init_row(index);
return ALIGNED_CAST(struct %(s)s *, ovsdb_idl_index_init_row(index));
}

struct %(s)s *
Expand Down

0 comments on commit 491fdb0

Please sign in to comment.