> How about this approach, which should cleanly eliminate the warning? > > diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c > index e1a5c097f3aa..362339a4abb4 100644 > --- a/ofproto/ofproto-dpif.c > +++ b/ofproto/ofproto-dpif.c > @@ -4780,22 +4780,17 @@ group_setup_dp_hash_table(struct group_dpif *group, > size_t max_hash) > > /* Use Webster method to distribute hash values over buckets. */ > for (int hash = 0; hash < n_hash; hash++) { > - double max_val = 0.0; > - struct webster *winner; > - for (i = 0; i < n_buckets; i++) { > - if (webster[i].value > max_val) { > - max_val = webster[i].value; > + struct webster *winner = &webster[0]; > + for (i = 1; i < n_buckets; i++) { > + if (webster[i].value > winner->value) { > winner = &webster[i]; > } > } > -#pragma GCC diagnostic push > -#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" > /* winner is a reference to a webster[] element initialized above. */ > winner->divisor += 2; > winner->value = (double) winner->bucket->weight / winner->divisor; > group->hash_map[hash] = winner->bucket; > winner->bucket->aux++; > -#pragma GCC diagnostic pop > }
Thank you, Ben, for your thorough checks. Yes, your approach is better and compiles w/o warnings. Regards, Jan _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev