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

Archana Holla harchana at vmware.com
Thu Mar 19 17:03:15 UTC 2020

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)
+#if defined (__cplusplus) && defined(_WIN32)
+#define OVS_TYPEOF(OBJECT) decltype(OBJECT)
 #define OVS_TYPEOF(OBJECT) void *
 /* Given OBJECT of type pointer-to-structure, expands to the offset of MEMBER
  * within an instance of the structure.

More information about the dev mailing list