flow: Add a couple of missing build assertions on FLOW_WC_SEQ.
authorBen Pfaff <blp@nicira.com>
Fri, 27 Jan 2012 23:38:53 +0000 (15:38 -0800)
committerBen Pfaff <blp@nicira.com>
Fri, 3 Feb 2012 00:39:59 +0000 (16:39 -0800)
Every piece of code that may need to change whenever struct flow or struct
flow_wildcards changes, but might easily get overlooked, should have a
build assertion on the value of FLOW_WC_SEQ, but these functions did not.

Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/flow.c

index 29714b1..dc2bb1c 100644 (file)
@@ -699,6 +699,8 @@ flow_wildcards_combine(struct flow_wildcards *dst,
 {
     int i;
 
+    BUILD_ASSERT_DECL(FLOW_WC_SEQ == 7);
+
     dst->wildcards = src1->wildcards | src2->wildcards;
     dst->tun_id_mask = src1->tun_id_mask & src2->tun_id_mask;
     dst->nw_src_mask = src1->nw_src_mask & src2->nw_src_mask;
@@ -732,6 +734,8 @@ flow_wildcards_equal(const struct flow_wildcards *a,
 {
     int i;
 
+    BUILD_ASSERT_DECL(FLOW_WC_SEQ == 7);
+
     if (a->wildcards != b->wildcards
         || a->tun_id_mask != b->tun_id_mask
         || a->nw_src_mask != b->nw_src_mask
@@ -760,6 +764,8 @@ flow_wildcards_has_extra(const struct flow_wildcards *a,
     int i;
     struct in6_addr ipv6_masked;
 
+    BUILD_ASSERT_DECL(FLOW_WC_SEQ == 7);
+
     for (i = 0; i < FLOW_N_REGS; i++) {
         if ((a->reg_masks[i] & b->reg_masks[i]) != b->reg_masks[i]) {
             return true;