[ovs-dev] [PATCH 4/4] ofp-actions: Add compare to offsetof need for MSVC 2015/17

Anand Kumar kumaranand at vmware.com
Wed Nov 8 01:16:48 UTC 2017


Acked-by: Anand Kumar <kumaranand at vmware.com>

Thanks,
Anand Kumar

On 11/1/17, 10:19 AM, "ovs-dev-bounces at openvswitch.org on behalf of Alin Gabriel Serdean" <ovs-dev-bounces at openvswitch.org on behalf of aserdean at ovn.org> wrote:

    Unfortunately starting from VS 2015, the "C" definition for `offsetof`
    has been changed. Please see:
    https://urldefense.proofpoint.com/v2/url?u=https-3A__stackoverflow.com_questions_42725929_using-2Doffsetof-2Dwith-2Denum-2Ddoes-2Dnot-2Dcompile-2Din-2Dvisual-2Dstudio-2D2015_42726424&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=Q5z9tBe-nAOpE7LIHSPV8uy5-437agMXvkeHHMkR8Us&m=imFxQ_aJ0_DP4dimFnQD-LfWi8kLVE68mKlRQs3sYLo&s=CpTwQKV4LcgBt--l8gTD87Dp-U7y_UrG_mMYWwSFWQY&e=
    
    Several people reported the bug for 2015 and also 2017 (i.e. :
    https://urldefense.proofpoint.com/v2/url?u=https-3A__developercommunity.visualstudio.com_content_problem_22196_static-2Dassert-2Dcannot-2Dcompile-2Dconstexprs-2Dmethod-2Dtha.html&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=Q5z9tBe-nAOpE7LIHSPV8uy5-437agMXvkeHHMkR8Us&m=imFxQ_aJ0_DP4dimFnQD-LfWi8kLVE68mKlRQs3sYLo&s=2acERJsAmdC4hO7OhvCR0DqqAA_TMnlOysxK3ZfCUgk&e=
    ), but we don't have a fix yet.
    
    This patch adds an explicit compare, although we could redefine the macro
    for the same effect.
    
    Signed-off-by: Alin Gabriel Serdean <aserdean at ovn.org>
    ---
     include/openvswitch/ofp-actions.h | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/include/openvswitch/ofp-actions.h b/include/openvswitch/ofp-actions.h
    index 03c1d11..25f61ef 100644
    --- a/include/openvswitch/ofp-actions.h
    +++ b/include/openvswitch/ofp-actions.h
    @@ -1128,7 +1128,7 @@ void *ofpact_finish(struct ofpbuf *, struct ofpact *);
         BUILD_ASSERT_DECL(offsetof(struct STRUCT, ofpact) == 0);            \
                                                                             \
         enum { OFPACT_##ENUM##_SIZE                                         \
    -           = (offsetof(struct STRUCT, MEMBER)                           \
    +           = (offsetof(struct STRUCT, MEMBER) != 0                      \
                   ? offsetof(struct STRUCT, MEMBER)                         \
                   : OFPACT_ALIGN(sizeof(struct STRUCT))) };                 \
                                                                             \
    -- 
    2.10.2.windows.1
    
    _______________________________________________
    dev mailing list
    dev at openvswitch.org
    https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openvswitch.org_mailman_listinfo_ovs-2Ddev&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=Q5z9tBe-nAOpE7LIHSPV8uy5-437agMXvkeHHMkR8Us&m=imFxQ_aJ0_DP4dimFnQD-LfWi8kLVE68mKlRQs3sYLo&s=nFUZCkxUXM5tAdr96klxAPotyDUoEhvcJoTQBwJtOXk&e=
    





More information about the dev mailing list