Commit 5bd9b136 authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot 2

Mark a few constants as constexpr so VLAs aren't required

Summary: Because MSVC doesn't support VLAs.

Reviewed By: yfeldblum

Differential Revision: D3513143

fbshipit-source-id: 256e9e843004a3c37821b3dddc6ecd4c6b5645d9
parent 1962ee07
......@@ -1105,7 +1105,7 @@ TEST(AsyncSocketTest, WriteIOBuf) {
acceptedSocket->setReadCB(&rcb);
// Write a simple buffer to the socket
size_t simpleBufLength = 5;
constexpr size_t simpleBufLength = 5;
char simpleBuf[simpleBufLength];
memset(simpleBuf, 'a', simpleBufLength);
WriteCallback wcb;
......@@ -1289,7 +1289,7 @@ TEST(AsyncSocketTest, ZeroLengthWritev) {
memset(buf.get(), 'b', len2);
WriteCallback wcb;
size_t iovCount = 4;
constexpr size_t iovCount = 4;
struct iovec iov[iovCount];
iov[0].iov_base = buf.get();
iov[0].iov_len = len1;
......
......@@ -1112,8 +1112,8 @@ void runInThreadTestFunc(RunInThreadArg* arg) {
}
TEST(EventBaseTest, RunInThread) {
uint32_t numThreads = 50;
uint32_t opsPerThread = 100;
constexpr uint32_t numThreads = 50;
constexpr uint32_t opsPerThread = 100;
RunInThreadData data(numThreads, opsPerThread);
deque<std::thread> threads;
......
......@@ -681,13 +681,14 @@ void* atomicHashArrayInsertRaceThread(void* /* j */) {
}
TEST(Ahm, atomic_hash_array_insert_race) {
AHA* arr = atomicHashArrayInsertRaceArray.get();
int numIterations = 5000, FLAGS_numThreads = 4;
void* statuses[FLAGS_numThreads];
int numIterations = 5000;
constexpr int numThreads = 4;
void* statuses[numThreads];
for (int i = 0; i < numIterations; i++) {
arr->clear();
runThreads(atomicHashArrayInsertRaceThread, FLAGS_numThreads, statuses);
runThreads(atomicHashArrayInsertRaceThread, numThreads, statuses);
EXPECT_GE(arr->size(), 1);
for (int j = 0; j < FLAGS_numThreads; j++) {
for (int j = 0; j < numThreads; j++) {
EXPECT_EQ(arr->size(), uintptr_t(statuses[j]));
}
}
......
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