Open williamtu opened 3 years ago
diff --git a/include/openvswitch/util.h b/include/openvswitch/util.h
index 228b185c3..b3a3b499b 100644
--- a/include/openvswitch/util.h
+++ b/include/openvswitch/util.h
@@ -83,7 +83,7 @@ OVS_NO_RETURN void ovs_assert_failure(const char *, const char *, const char *);
/* Given a pointer-typed lvalue OBJECT, expands to a pointer type that may be
* assigned to OBJECT. */
-#ifdef __GNUC__
+#if (__GNUC__ || __clang__)
#define OVS_TYPEOF(OBJECT) typeof(OBJECT)
#elif defined (__cplusplus)
#define OVS_TYPEOF(OBJECT) decltype(OBJECT)
@@ -100,7 +100,7 @@ OVS_NO_RETURN void ovs_assert_failure(const char *, const char *, const char *);
* dereference any pointer, so it would be surprising for it to cause any
* problems in practice.
*/
-#ifdef __GNUC__
+#if (__GNUC__ || __clang__)
#define OBJECT_OFFSETOF(OBJECT, MEMBER) offsetof(typeof(*(OBJECT)), MEMBER)
#else
#define OBJECT_OFFSETOF(OBJECT, MEMBER) \