Skip to content
Permalink
Browse files

Fix implicit fallthrough warning and unused variable warning in GCC (#…

…1984)

* Fix implicit fallthrough warning and unused variable warning

* Add descriptive 'fall through' comment
  • Loading branch information...
jackgerrits committed Aug 2, 2019
1 parent 97cb5b9 commit 36e44bc837c2818a238f3868f18963dc958d9cc5
Showing with 13 additions and 5 deletions.
  1. +12 −4 explore/hash.h
  2. +1 −1 vowpalwabbit/gen_cs_example.h
@@ -110,16 +110,24 @@ inline uint64_t uniform_hash(const void * key, size_t len, uint64_t seed)

uint32_t k1 = 0;

// The 'fall through' comments below silence the implicit-fallthrough warning introduced in GCC 7.
// Once we move to C++17 these should be replaced with the [[fallthrough]] attribute.
switch (len & 3)
{
case 3: k1 ^= tail[2] << 16;
case 2: k1 ^= tail[1] << 8;
case 3:
k1 ^= tail[2] << 16;
// fall through
case 2:
k1 ^= tail[1] << 8;
// fall through
case 1: k1 ^= tail[0];
k1 *= c1; k1 = ROTL32(k1, 15); k1 *= c2; h1 ^= k1;
k1 *= c1;
k1 = ROTL32(k1, 15);
k1 *= c2; h1 ^= k1;
}

// --- finalization
h1 ^= len;

return MURMUR_HASH_3::fmix(h1);
}
}
@@ -144,7 +144,7 @@ void gen_cs_label(cb_to_cs& c, example& ec, COST_SENSITIVE::label& cs_ld, uint32
}

template <bool is_learn>
void gen_cs_example_dr(cb_to_cs& c, example& ec, CB::label& ld, COST_SENSITIVE::label& cs_ld, float clip_p=0.f)
void gen_cs_example_dr(cb_to_cs& c, example& ec, CB::label& ld, COST_SENSITIVE::label& cs_ld, float /*clip_p*/ =0.f)
{ // this implements the doubly robust method
cs_ld.costs.clear();
c.pred_scores.costs.clear();

0 comments on commit 36e44bc

Please sign in to comment.
You can’t perform that action at this time.