mirror of https://github.com/facebook/rocksdb.git
9a2a6db2a9
Summary: (Copied from https://www.internalfb.com/diff/D46606060) This diff makes its files safe for use with -Wimplicit-fallthrough. Now that we're using C+20 there's no reason not to use this C++17 feature to make our code safer. It's currently possible to write code like this: ``` switch(x){ case 1: foo1(); case 2: foo2(); break; case 3: foo3(); } ``` But that's scary because we don't know whether the fallthrough from case 1 was intentional or not. The -Wimplicit-fallthrough flag will make this an error. The solution is to either fix the bug by inserting break or indicating intention by using [[fallthrough]]; (from C++17). ``` switch(x){ case 1: foo1(); [[fallthrough]]; // Solution if we intended to fallthrough break; // Solution if we did not intend to fallthrough case 2: foo2(); break; case 3: foo3(); } ``` Pull Request resolved: https://github.com/facebook/rocksdb/pull/11663 Test Plan: Existing tests Reviewed By: jowlyzhang Differential Revision: D47961248 Pulled By: jaykorean fbshipit-source-id: 0d374c721bf1b328c14949dc5c17693da7311d03 |
||
---|---|---|
.. | ||
lock | ||
optimistic_transaction.cc | ||
optimistic_transaction.h | ||
optimistic_transaction_db_impl.cc | ||
optimistic_transaction_db_impl.h | ||
optimistic_transaction_test.cc | ||
pessimistic_transaction.cc | ||
pessimistic_transaction.h | ||
pessimistic_transaction_db.cc | ||
pessimistic_transaction_db.h | ||
snapshot_checker.cc | ||
timestamped_snapshot_test.cc | ||
transaction_base.cc | ||
transaction_base.h | ||
transaction_db_mutex_impl.cc | ||
transaction_db_mutex_impl.h | ||
transaction_test.cc | ||
transaction_test.h | ||
transaction_util.cc | ||
transaction_util.h | ||
write_committed_transaction_ts_test.cc | ||
write_prepared_transaction_test.cc | ||
write_prepared_txn.cc | ||
write_prepared_txn.h | ||
write_prepared_txn_db.cc | ||
write_prepared_txn_db.h | ||
write_unprepared_transaction_test.cc | ||
write_unprepared_txn.cc | ||
write_unprepared_txn.h | ||
write_unprepared_txn_db.cc | ||
write_unprepared_txn_db.h |