[ovs-dev] [PATCH] Broken build on MSVC

Alin Serdean aserdean at cloudbasesolutions.com
Mon Sep 1 20:11:54 UTC 2014


MSVC does not like variable length array either.

This patch treats the following error:

lib/dpif-netdev.c(2272) :
error C2057: expected constant expression
lib/dpif-netdev.c(2272) :
error C2466: cannot allocate an array of constant size 0
lib/dpif-netdev.c(2272) :
error C2133: 'batches' : unknown size
lib/dpif-netdev.c(2273) :
error C2057: expected constant expression
lib/dpif-netdev.c(2273) :
error C2466: cannot allocate an array of constant size 0
lib/dpif-netdev.c(2273) :
error C2133: 'mfs' : unknown size
lib/dpif-netdev.c(2274) :
error C2057: expected constant expression
lib/dpif-netdev.c(2274) :
error C2466: cannot allocate an array of constant size 0
lib/dpif-netdev.c(2274) :
error C2133: 'rules' : unknown size
lib/dpif-netdev.c(2363) :
warning C4034: sizeof returns 0
lib/dpif-netdev.c(2381) :
error C2057: expected constant expression
lib/dpif-netdev.c(2381) :
error C2466: cannot allocate an array of constant size 0
lib/dpif-netdev.c(2381) : error C2133: 'keys' : unknown size
make[2]: *** [lib/dpif-netdev.lo] Error 1

Signed-off-by: Alin Gabriel Serdean <aserdean at cloudbasesolutions.com>
---
 lib/dpif-netdev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 0ccf47d..38bd6a7 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -2263,10 +2263,10 @@ fast_path_processing(struct dp_netdev *dp, struct emc_cache *flow_cache,
                      struct dpif_packet **packets, size_t cnt,
                      struct pkt_metadata *md, struct netdev_flow_key *keys)
 {
-#ifndef __CHECKER__
+#if !defined(__CHECKER__) && !defined(_WIN32)
     const size_t PKT_ARRAY_SIZE = cnt;
 #else
-    /* Sparse doesn't like variable length array */
+    /* Sparse or MSVC doesn't like variable length array */
     enum { PKT_ARRAY_SIZE = NETDEV_MAX_RX_BATCH };
 #endif
     struct packet_batch batches[PKT_ARRAY_SIZE];
@@ -2372,10 +2372,10 @@ static void
 dp_netdev_input(struct dp_netdev *dp, struct emc_cache *flow_cache,
                 struct dpif_packet **packets, int cnt, struct pkt_metadata *md)
 {
-#ifndef __CHECKER__
+#if !defined(__CHECKER__) && !defined(_WIN32)
     const size_t PKT_ARRAY_SIZE = cnt;
 #else
-    /* Sparse doesn't like variable length array */
+    /* Sparse or MSVC doesn't like variable length array */
     enum { PKT_ARRAY_SIZE = NETDEV_MAX_RX_BATCH };
 #endif
     struct netdev_flow_key keys[PKT_ARRAY_SIZE];
-- 
1.9.0.msysgit.0




More information about the dev mailing list