Won't work with changing [0] to [].

We need to shift the [0] to be the last member of a struct. I have no idea 
about the implications that it will have but something like would work:

diff --git a/lib/classifier.c b/lib/classifier.c
index 2ed8697..9f58d43 100644
--- a/lib/classifier.c
+++ b/lib/classifier.c
@@ -1351,8 +1351,8 @@ classifier_rule_overlaps(const struct classifier *cls,
     PVECTOR_FOR_EACH_PRIORITY (subtable, target->priority - 1, 2,
                                sizeof(struct cls_subtable), &cls->subtables) {
         struct {
-            struct minimask mask;
             uint64_t storage[FLOW_U64S];
+            struct minimask mask;
         } m;
         const struct cls_rule *rule;

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 9e7343b..054fc48 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -97,8 +97,8 @@ static struct odp_support dp_netdev_support = {
 struct netdev_flow_key {
     uint32_t hash;       /* Hash function differs for different users. */
     uint32_t len;        /* Length of the following miniflow (incl. map). */
-    struct miniflow mf;
     uint64_t buf[FLOW_MAX_PACKET_U64S];
+    struct miniflow mf;
 };

 /* Exact match cache for frequently used flows
@@ -133,8 +133,8 @@ struct emc_entry {
 };

 struct emc_cache {
-    struct emc_entry entries[EM_FLOW_HASH_ENTRIES];
     int sweep_idx;                /* For emc_cache_slow_sweep(). */
+    struct emc_entry entries[EM_FLOW_HASH_ENTRIES];
 };

 /* Iterate in the exact match cache through every entry that might contain a
@@ -166,7 +166,7 @@ static void dpcls_insert(struct dpcls *, struct dpcls_rule 
*,
                          const struct netdev_flow_key *mask);
 static void dpcls_remove(struct dpcls *, struct dpcls_rule *);
 static bool dpcls_lookup(const struct dpcls *cls,
-                         const struct netdev_flow_key keys[],
+                         const struct netdev_flow_key *,
                          struct dpcls_rule **rules, size_t cnt);
 ^L
 /* Datapath based on the network device interface from netdev.h.
diff --git a/lib/flow.h b/lib/flow.h
index 392cb59..fb412ae 100644
--- a/lib/flow.h
+++ b/lib/flow.h
@@ -398,7 +398,7 @@ BUILD_ASSERT_DECL(FLOW_U64S <= 64);
  * many elements as there are 1-bits in 'map'. */
 struct miniflow {
     uint64_t map;
-    uint64_t values[0];
+    uint64_t values[];
 };
 BUILD_ASSERT_DECL(sizeof(struct miniflow) == sizeof(uint64_t));

But afterwards we will hit 
(https://msdn.microsoft.com/en-us/library/0scy7z2d.aspx):

lib/dpif-netdev.c(137) : error C2233: 'entries' : arrays of objects containing 
zero-size arrays are illegal
lib/dpif-netdev.c(3337) : error C2233: 'keys' : arrays of objects containing 
zero-size arrays are illegal
lib/dpif-netdev.c(3881) : error C2233: 'keys' : arrays of objects containing 
zero-size arrays are illegal
lib/dpif-netdev.c(3883) : warning C4028: formal parameter 4 different from 
declaration

Alin.

-----Mesaj original-----
De la: Ben Pfaff [mailto:b...@nicira.com] 
Trimis: Thursday, July 16, 2015 10:27 AM
Către: Alin Serdean
Cc: Jarno Rajahalme; dev@openvswitch.org
Subiect: Re: [ovs-dev] [RFC PATCH v2 3/7] flow: Always inline miniflows.

On Thu, Jul 16, 2015 at 01:35:14AM +0000, Alin Serdean wrote:
> Hi Jarno,
> 
> This is breaking the windows build 
> (https://ci.appveyor.com/project/blp/ovs/build/1.0.459):
> lib/classifier.c(1355) : error C2229: struct '<unnamed-tag>' has an illegal 
> zero-sized array.
> 
> The problem is the following 
> (https://msdn.microsoft.com/en-us/library/0scy7z2d.aspx ):
> https://github.com/openvswitch/ovs/commit/8fd4792403254f868398a89fb562
> 5830ee5a08eb#diff-b87c023d7e733f983131f231a672e71eR389
> 
> Could you please take a look into it?

Usually changing [0] to [] fixes such issues, can you check that that works 
here?
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to