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

Message ID 1440945631-11972-1-git-send-email-blp@nicira.com
State Accepted
Headers show

Commit Message

Ben Pfaff Aug. 30, 2015, 2:40 p.m. UTC
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@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
---
 lib/flow.c | 2 +-
 lib/flow.h | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Nithin Raju Aug. 31, 2015, 5:56 p.m. UTC | #1
> On Aug 30, 2015, at 7:40 AM, Ben Pfaff <blp@nicira.com> wrote:

> 

> 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@nicira.com>

> Signed-off-by: Ben Pfaff <blp@nicira.com>


Thanks Ben for the patch.

There seems to be one a change required in netdev-windows.c. I’ll send out a patch for that.

Acked-by: Nithin Raju <nithin@vmware.com>

Tested-by: Nithin Raju <nithin@vmware.com>


thanks,
-- Nithin
Ben Pfaff Aug. 31, 2015, 8 p.m. UTC | #2
On Mon, Aug 31, 2015 at 05:56:34PM +0000, Nithin Raju wrote:
> 
> > On Aug 30, 2015, at 7:40 AM, Ben Pfaff <blp@nicira.com> wrote:
> > 
> > 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@nicira.com>
> > Signed-off-by: Ben Pfaff <blp@nicira.com>
> 
> Thanks Ben for the patch.
> 
> There seems to be one a change required in netdev-windows.c. I’ll send out a patch for that.
> 
> Acked-by: Nithin Raju <nithin@vmware.com>
> Tested-by: Nithin Raju <nithin@vmware.com>

Thanks, I've applied this to master.  I'll look for the netdev-windows.c
patch.

Patch
diff mbox

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;