[ovs-dev] [PATCH 4/4] unaligned.h: Fixed C++ compilation issue due to designated initializers

Shireesh Singh shireeshcse07 at gmail.com
Sat Dec 16 00:38:24 UTC 2017


This change fixes compilation issues related to designated
initializers, which are not supported by C++ compier.

Signed-off-by: Shireesh Kumar Singh <shireeshkum at vmware.com>
Signed-off-by: Sairam Venugopal <vsairam at vmware.com>
Co-authored-by: Sairam Venugopal <vsairam at vmware.com>
---
 lib/unaligned.h | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/lib/unaligned.h b/lib/unaligned.h
index a150d7d..f40e4e1 100644
--- a/lib/unaligned.h
+++ b/lib/unaligned.h
@@ -220,7 +220,11 @@ put_32aligned_u64(ovs_32aligned_u64 *x, uint64_t value)
 static inline ovs_u128
 get_32aligned_u128(const ovs_32aligned_u128 *x)
 {
-    ovs_u128 u = { .u32 = { x->u32[0], x->u32[1], x->u32[2], x->u32[3] } };
+    ovs_u128 u;
+    u.u32[0] = x->u32[0];
+    u.u32[1] = x->u32[1];
+    u.u32[2] = x->u32[2];
+    u.u32[3] = x->u32[3];
     return u;
 }
 
@@ -287,8 +291,11 @@ put_32aligned_be64(ovs_32aligned_be64 *x, ovs_be64 value)
 static inline ovs_be128
 get_32aligned_be128(const ovs_32aligned_be128 *x)
 {
-    ovs_be128 u = { .be32 = { x->be32[0], x->be32[1],
-                              x->be32[2], x->be32[3] } };
+    ovs_be128 u;
+    u.be32[0] = x->be32[0];
+    u.be32[1] = x->be32[1];
+    u.be32[2] = x->be32[2];
+    u.be32[3] = x->be32[3];
     return u;
 }
 
-- 
2.7.4



More information about the dev mailing list