Skip to content

Commit 65df7d4

Browse files
FuzzTest Teamcopybara-github
authored andcommitted
Revert designated initializer usages for C++17 compliance.
PiperOrigin-RevId: 732261060
1 parent 0c784bd commit 65df7d4

File tree

7 files changed

+29
-20
lines changed

7 files changed

+29
-20
lines changed

centipede/BUILD

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,7 @@ cc_library(
189189
name = "reverse_pc_table",
190190
hdrs = ["reverse_pc_table.h"],
191191
# Avoid non-trivial dependencies here, as this library will be linked to target binaries.
192-
deps = [
193-
":pc_info",
194-
"@com_google_absl//absl/types:span",
195-
],
192+
deps = [":pc_info"],
196193
)
197194

198195
cc_library(

centipede/mutation_input.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#ifndef THIRD_PARTY_CENTIPEDE_MUTATION_INPUT_H_
2020
#define THIRD_PARTY_CENTIPEDE_MUTATION_INPUT_H_
2121

22+
#include <utility>
2223
#include <vector>
2324

2425
#include "./centipede/execution_metadata.h"
@@ -44,7 +45,10 @@ inline std::vector<MutationInputRef> GetMutationInputRefsFromDataInputs(
4445
const std::vector<ByteArray> &inputs) {
4546
std::vector<MutationInputRef> results;
4647
results.reserve(inputs.size());
47-
for (const auto &input : inputs) results.push_back({.data = input});
48+
for (const auto &input : inputs) {
49+
MutationInputRef result{input};
50+
results.push_back(std::move(result));
51+
}
4852
return results;
4953
}
5054

centipede/pc_info_test.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@ namespace centipede {
2222
namespace {
2323

2424
TEST(PCTableTest, SerializesAndDeserializesPCInfoSuccessfully) {
25-
PCTable input = {{.pc = 0, .flags = 1}, {.pc = 2, .flags = 3}};
25+
PCInfo input1, input2;
26+
input1.pc = 0;
27+
input1.flags = 1;
28+
input2.pc = 2;
29+
input2.flags = 3;
30+
31+
PCTable input = {input1, input2};
2632

2733
std::stringstream stream;
2834
WritePcTable(input, stream);

centipede/periodic_action_test.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ TEST(PeriodicActionTest, OnlyNudgedInvocations) {
5050
constexpr absl::Duration kDuration = absl::Seconds(3);
5151
constexpr absl::Duration kNudgeInterval = absl::Milliseconds(100);
5252
int count = 0;
53+
PeriodicAction::Options options;
54+
// Effectively disable periodic invocations: only `Nudge()` calls
55+
// below will trigger them.
56+
options.sleep_before_each = [](size_t) { return absl::InfiniteDuration(); };
5357
PeriodicAction action{
5458
[&count]() { ++count; },
55-
{
56-
// Effectively disable periodic invocations: only `Nudge()` calls
57-
// below will trigger them.
58-
.sleep_before_each = [](size_t) { return absl::InfiniteDuration(); },
59-
},
59+
std::move(options),
6060
};
6161
int expected_count = 0;
6262
const absl::Time end_time = absl::Now() + kDuration;

centipede/puzzles/pthread_exit_uint32_cmp_1.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
3434
struct ThreadArg {
3535
const uint8_t *data;
3636
size_t size;
37-
} arg = {.data = data, .size = size};
37+
};
38+
ThreadArg arg = {data, size};
3839
auto pt_entry = +[](const ThreadArg *thread_arg) {
3940
uint32_t value, expected_value;
4041
if (thread_arg->size == sizeof(value)) {

centipede/resource_pool_test.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ namespace centipede::perf {
3232
namespace {
3333

3434
TEST(ResourcePoolTest, InvalidLeaseRequests) {
35-
const RUsageMemory kQuota = {.mem_rss = 1000};
36-
const RUsageMemory kZero = {.mem_rss = 0};
37-
const RUsageMemory kEpsilon = {.mem_rss = 1};
35+
RUsageMemory kQuota, kZero, kEpsilon;
36+
kQuota.mem_rss = 1000;
37+
kZero.mem_rss = 0;
38+
kEpsilon.mem_rss = 1;
3839
ResourcePool pool{kQuota};
3940
{
4041
const auto lease = pool.AcquireLeaseBlocking({.amount = kZero});

centipede/reverse_pc_table.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,10 @@ class ReversePCTable {
6161
for (size_t idx = 0; idx < pc_table.size(); ++idx) {
6262
const auto &pc_info = pc_table[idx];
6363
if (pc_info.pc >= size_) __builtin_trap(); // TODO(kcc): use RunnerCheck.
64-
table_[pc_info.pc] = {
65-
.is_function_entry = pc_info.has_flag(PCInfo::kFuncEntry),
66-
.pc_index = static_cast<uint32_t>(idx)};
64+
PCGuard pc_guard;
65+
pc_guard.is_function_entry = pc_info.has_flag(PCInfo::kFuncEntry);
66+
pc_guard.pc_index = static_cast<uint32_t>(idx);
67+
table_[pc_info.pc] = pc_guard;
6768
}
6869
}
6970

@@ -80,8 +81,7 @@ class ReversePCTable {
8081

8182
private:
8283
// A PCGuard object, such that IsValid() will return false.
83-
static constexpr PCGuard kInvalidPCGuard = {
84-
.is_function_entry = 0, .pc_index = PCGuard::kInvalidPcIndex};
84+
static constexpr PCGuard kInvalidPCGuard = {0, PCGuard::kInvalidPcIndex};
8585

8686
// We use size_ and table_ pointer instead of std::vector<> because
8787
// (1) we need ReversePCTable object to be accessible even after the

0 commit comments

Comments
 (0)