efficient / libcuckoo

A high-performance, concurrent hash table
Other
1.62k stars 275 forks source link

Compile fail with GCC 7.1 #76

Closed harrywong closed 7 years ago

harrywong commented 7 years ago

When use GCC 7.1 to compile libcuckoo, it warns this: .../libcuckoo/include/libcuckoo/cuckoohash_map.hh: In member function ‘cuckoohash_map<Key, T, Hash, Pred, Alloc, SLOT_PER_BUCKET>::table_position cuckoohash_map<Key, T, Hash, Pred, Alloc, SLOT_PER_BUCKET>::cuckoo_insert_loop(cuckoohash_map<Key, T, Hash, Pred, Alloc, SLOT_PER_BUCKET>::hash_value, cuckoohash_map<Key, T, Hash, Pred, Alloc, SLOT_PER_BUCKET>::TwoBuckets&, K&)’: .../libcuckoo/include/libcuckoo/cuckoohash_map.hh:1128:61: error: this statement may fall through [-Werror=implicit-fallthrough=] cuckoo_fast_double<LOCK_T, automatic_resize>(hp);



.../libcuckoo/include/libcuckoo/cuckoohash_map.hh:1129:13: note: here
             case failure_under_expansion:
             ^~~~

in this code:
        table_position pos;
        while (true) {
            assert(b.is_active());
            const size_type hp = hashpower();
            pos = cuckoo_insert(hv, b, key);
            switch (pos.status) {
            case ok:
            case failure_key_duplicated:
                return pos;
            case failure_table_full:
                // Expand the table and try again, re-grabbing the locks
                cuckoo_fast_double<LOCK_T, automatic_resize>(hp);
            case failure_under_expansion:
                b = snapshot_and_lock_two<LOCK_T>(hv);
                break;
            default:
                assert(false);
            }
        }
harrywong commented 7 years ago

Add one attribute to suppress this warning.

harrywong commented 7 years ago

Hi after I changed to use the newest version, it warns this: .../libcuckoo/include/libcuckoo/cuckoohash_map.hh:1397:17: error: unused variable ‘new_bucket’ [-Werror=unused-variable] bucket &newbucket = buckets[new_bucket_i];

manugoyal commented 7 years ago

Thanks for pointing that out! Fixed by c3ab84a464830c798fbba54cbda0aabdcb65e611