[ovs-dev] [PATCH] util: Update OVS_TYPEOF macro for Windows.

Ben Pfaff blp at ovn.org
Thu Mar 19 17:35:12 UTC 2020


On Thu, Mar 19, 2020 at 10:03:15AM -0700, Archana Holla via dev wrote:
> OVS_TYPEOF macro doesn’t return the type of object for non __GNUC__ platforms.
> Updating it for _WIN32 platforms when used from C++ code.
> 
> Signed-off-by: Archana Holla <harchana at vmware.com>
> ---
>  include/openvswitch/util.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/include/openvswitch/util.h b/include/openvswitch/util.h
> index 9189e64..af7d1b0 100644
> --- a/include/openvswitch/util.h
> +++ b/include/openvswitch/util.h
> @@ -86,8 +86,12 @@ OVS_NO_RETURN void ovs_assert_failure(const char *, const char *, const char *);
>  #ifdef __GNUC__
>  #define OVS_TYPEOF(OBJECT) typeof(OBJECT)
>  #else
> +#if defined (__cplusplus) && defined(_WIN32)
> +#define OVS_TYPEOF(OBJECT) decltype(OBJECT)
> +#else
>  #define OVS_TYPEOF(OBJECT) void *
>  #endif
> +#endif

Thanks for submitting a patch.

Does this solve a problem?

decltype is a C++ feature.  How is it specific to Windows?

Please use #elif instead of introducing a nested #if...#endif.

Thanks,

Ben.


More information about the dev mailing list