Skip to content

Commit

Permalink
test-classifier: add ovs_assert to prevent warning
Browse files Browse the repository at this point in the history
GCC 4.9.0 triggers a warning (array-bounds) while compiling test-classifier.c
This commit introduces an assertion that suppresses the warning.

Signed-off-by: Daniele Di Proietto <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
ddiproietto authored and blp committed Jun 24, 2014
1 parent f1457c2 commit c424c2f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/test-classifier.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,9 @@ compare_classifiers(struct classifier *cls, struct tcls *tcls)
flow.nw_proto = nw_proto_values[get_value(&x, N_NW_PROTO_VALUES)];
flow.nw_tos = nw_dscp_values[get_value(&x, N_NW_DSCP_VALUES)];

/* This assertion is here to suppress a GCC 4.9 array-bounds warning */
ovs_assert(cls->cls->n_tries <= CLS_MAX_TRIES);

cr0 = classifier_lookup(cls, &flow, &wc);
cr1 = tcls_lookup(tcls, &flow);
assert((cr0 == NULL) == (cr1 == NULL));
Expand Down

0 comments on commit c424c2f

Please sign in to comment.