Commit 79e5fd2f authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot

Mark constexpr values needed within non-implicitly-capturing lambdas as static

Summary: MSVC needs these to be marked as `static` in order to be accessible within the lambdas without capturing them.

Reviewed By: yfeldblum

Differential Revision: D5099607

fbshipit-source-id: 0270e2191d504f74b1902789b662e1766b2056c4
parent f9da986c
......@@ -1545,15 +1545,15 @@ TEST(FiberManager, nestedFiberManagers) {
}
TEST(FiberManager, semaphore) {
constexpr size_t kTasks = 10;
constexpr size_t kIterations = 10000;
constexpr size_t kNumTokens = 10;
static constexpr size_t kTasks = 10;
static constexpr size_t kIterations = 10000;
static constexpr size_t kNumTokens = 10;
Semaphore sem(kNumTokens);
int counterA = 0;
int counterB = 0;
auto task = [&sem, kNumTokens](int& counter, folly::fibers::Baton& baton) {
auto task = [&sem](int& counter, folly::fibers::Baton& baton) {
FiberManager manager(std::make_unique<EventBaseLoopController>());
folly::EventBase evb;
dynamic_cast<EventBaseLoopController&>(manager.loopController())
......
......@@ -112,7 +112,7 @@ TEST(BarrierTest, Random) {
//
// At the end, we verify that exactly one future returning true was seen
// for each iteration.
constexpr uint32_t numIterations = 1;
static constexpr uint32_t numIterations = 1;
auto numThreads = folly::Random::rand32(30, 91);
struct ThreadInfo {
......
......@@ -83,8 +83,8 @@ class RandomDataHolder : public DataHolder {
RandomDataHolder::RandomDataHolder(size_t sizeLog2)
: DataHolder(sizeLog2) {
constexpr size_t numThreadsLog2 = 3;
constexpr size_t numThreads = size_t(1) << numThreadsLog2;
static constexpr size_t numThreadsLog2 = 3;
static constexpr size_t numThreads = size_t(1) << numThreadsLog2;
uint32_t seed = randomNumberSeed();
......
......@@ -121,8 +121,8 @@ TEST(AtomicIntrusiveLinkedList, Move) {
}
TEST(AtomicIntrusiveLinkedList, Stress) {
constexpr size_t kNumThreads = 32;
constexpr size_t kNumElements = 100000;
static constexpr size_t kNumThreads = 32;
static constexpr size_t kNumElements = 100000;
std::vector<TestIntrusiveObject> elements;
for (size_t i = 0; i < kNumThreads * kNumElements; ++i) {
......
......@@ -40,7 +40,7 @@ FooSingletonTL theFooSingleton;
}
TEST(SingletonThreadLocalTest, OneSingletonPerThread) {
const std::size_t targetThreadCount{64};
static constexpr std::size_t targetThreadCount{64};
std::atomic<std::size_t> completedThreadCount{0};
Synchronized<std::unordered_set<Foo*>> fooAddresses{};
std::vector<std::thread> threads{};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment