[ovs-dev] [PATCH v2] windows/lib: Fix Windows C++ compilation issues on common headers

Ben Pfaff blp at ovn.org
Fri Dec 1 21:43:56 UTC 2017


On Wed, Nov 29, 2017 at 05:13:14PM -0800, Sairam Venugopal wrote:
> Found when compiling the code with C++ binaries. Most of the issues are
> due to missing explicit cast.
> 
> Signed-off-by: Sairam Venugopal <vsairam at vmware.com>
> Signed-off-by: Shireesh Kumar Singh <shireeshkum at vmware.com>
> Co-authored-by: Shireesh Kumar Singh <shireeshkum at vmware.com>

Previously I gave some high-level feedback on this change.  Some of that
hasn't been addressed yet, but it still seems appropriate to give some
lower level feedback as well.

checkpatch reports the following:

    ERROR: Inappropriate spacing in pointer declaration
    #211 FILE: lib/packets.h:1139:
            (union ovs_16aligned_in6_addr*) addr;

    ERROR: Inappropriate spacing in pointer declaration
    #222 FILE: lib/packets.h:1156:
            (union ovs_16aligned_in6_addr*) lla;

    ERROR: Inappropriate spacing in pointer declaration
    #224 FILE: lib/packets.h:1158:
            (union ovs_16aligned_in6_addr*) prefix;

    ERROR: Inappropriate spacing in pointer declaration
    #234 FILE: lib/packets.h:1177:
            (union ovs_16aligned_in6_addr*) lla;

    ERROR: Inappropriate spacing in pointer declaration
    WARNING: Line lacks whitespace around operator
    #247 FILE: lib/socket-util.h:141:
        return (setsockopt)(sock, level, optname, (const char*)optval, optlen);

This introduces a new warning with Clang (the right fix is probably to
use ALIGNED_CAST):

    ../lib/netlink.h:156:12: error: cast from 'uint8_t *' (aka 'unsigned char *') to 'struct nlattr *' increases required alignment from 1 to 2 [-Werror,-Wcast-align]

I would prefer to make BUILD_ASSERT work as an expression, rather than
to modify get_unaligned_u64().

Thanks,

Ben.


More information about the dev mailing list