Skip to content

Commit

Permalink
iwyu
Browse files Browse the repository at this point in the history
  • Loading branch information
acelyc111 committed Sep 10, 2023
1 parent 308f654 commit e8f7188
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/nfs/nfs_server_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include <chrono>
#include <cstdint>
#include <mutex>
#include <type_traits>
#include <vector>

#include "nfs/nfs_code_definition.h"
Expand Down
1 change: 1 addition & 0 deletions src/replica/mutation_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include "mutation_cache.h"

// IWYU pragma: no_include <ext/alloc_traits.h>
#include "consensus_types.h"
#include "mutation.h"
#include "utils/autoref_ptr.h"
Expand Down
1 change: 1 addition & 0 deletions src/runtime/rpc/asio_rpc_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "asio_rpc_session.h"

#include <boost/asio.hpp> // IWYU pragma: keep
// IWYU pragma: no_include <ext/alloc_traits.h>
#include <cstddef>
#include <iterator>
#include <new>
Expand Down
8 changes: 4 additions & 4 deletions src/runtime/scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <stddef.h>
#include <algorithm>
#include <chrono>
#include <random>
#include <thread>
#include <type_traits>
#include <utility>
Expand Down Expand Up @@ -276,10 +277,9 @@ void scheduler::schedule()
_time_ns = ts;
}

// randomize the events, and see
std::random_shuffle(
events->begin(), events->end(), [](int n) { return rand::next_u32(0, n - 1); });

std::random_device rd;
std::mt19937 g(rd());
std::shuffle(events->begin(), events->end(), g);
for (auto e : *events) {
if (e.app_task != nullptr) {
task *t = e.app_task;
Expand Down
1 change: 0 additions & 1 deletion src/utils/alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#ifdef CACHELINE_SIZE

#include <stddef.h>
#include <algorithm>
#include <functional>
#include <memory>
#include <new>
Expand Down
6 changes: 5 additions & 1 deletion src/utils/test/nth_element_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <algorithm>
#include <cstdint>
#include <memory>
#include <random>
#include <type_traits>
#include <utility>
#include <vector>
Expand Down Expand Up @@ -93,7 +94,10 @@ class nth_element_case_generator
auto delta = _rand(_range_size);
value += delta;
}
std::random_shuffle(array.begin(), array.end());

std::random_device rd;
std::mt19937 g(rd());
std::shuffle(array.begin(), array.end(), g);
}

private:
Expand Down
2 changes: 1 addition & 1 deletion src/utils/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

#include <stddef.h>
#include <stdint.h>
#include <algorithm>
#include <algorithm> // IWYU pragma: keep
#include <iterator>
#include <map>
#include <memory>
Expand Down

0 comments on commit e8f7188

Please sign in to comment.