[ovs-dev] [PATCH] flow: Fix MSVC compile errors.

Ben Pfaff blp at nicira.com
Sun Aug 30 14:40:31 UTC 2015


MSVC doesn't like the change in 'const' between function declaration and
definition: it reports "formal parameter 2 different from declaration" for
each of the functions in flow.h corrected by this (commit.  I think it's
technically wrong about that, standards-wise.)

MSVC doesn't like an empty-brace initializer.  (I think it's technically
right about that, standards-wise.)

This commit attempts to fix both problems, but I have not tested it with
MSVC.

CC: Jarno Rajahalme <jrajahalme at nicira.com>
Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 lib/flow.c | 2 +-
 lib/flow.h | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/flow.c b/lib/flow.c
index 4236e87..84048e8 100644
--- a/lib/flow.c
+++ b/lib/flow.c
@@ -742,7 +742,7 @@ miniflow_extract(struct dp_packet *packet, struct miniflow *dst)
         } else if (OVS_LIKELY(nw_proto == IPPROTO_ICMPV6)) {
             if (OVS_LIKELY(size >= sizeof(struct icmp6_hdr))) {
                 const struct in6_addr *nd_target = NULL;
-                struct eth_addr arp_buf[2] = { };
+                struct eth_addr arp_buf[2] = { { { { 0 } } } };
                 const struct icmp6_hdr *icmp = data_pull(&data, &size,
                                                          sizeof *icmp);
                 parse_icmpv6(&data, &size, icmp, &nd_target, arp_buf);
diff --git a/lib/flow.h b/lib/flow.h
index 6ed7de3..d8632ff 100644
--- a/lib/flow.h
+++ b/lib/flow.h
@@ -529,7 +529,7 @@ flowmap_clear(struct flowmap *fm, size_t idx, unsigned int n_bits)
 
 /* OR the bits in the flowmaps. */
 static inline struct flowmap
-flowmap_or(struct flowmap a, const struct flowmap b)
+flowmap_or(struct flowmap a, struct flowmap b)
 {
     struct flowmap map;
     size_t unit;
@@ -542,7 +542,7 @@ flowmap_or(struct flowmap a, const struct flowmap b)
 
 /* AND the bits in the flowmaps. */
 static inline struct flowmap
-flowmap_and(struct flowmap a, const struct flowmap b)
+flowmap_and(struct flowmap a, struct flowmap b)
 {
     struct flowmap map;
     size_t unit;
@@ -554,7 +554,7 @@ flowmap_and(struct flowmap a, const struct flowmap b)
 }
 
 static inline bool
-flowmap_is_empty(const struct flowmap fm)
+flowmap_is_empty(struct flowmap fm)
 {
     map_t map;
 
-- 
2.1.3




More information about the dev mailing list