diff --git a/centipede/mutation_input.h b/centipede/mutation_input.h index 1b0191b1..fd7009f7 100644 --- a/centipede/mutation_input.h +++ b/centipede/mutation_input.h @@ -19,6 +19,7 @@ #ifndef THIRD_PARTY_CENTIPEDE_MUTATION_INPUT_H_ #define THIRD_PARTY_CENTIPEDE_MUTATION_INPUT_H_ +#include #include #include "./centipede/execution_metadata.h" @@ -44,7 +45,10 @@ inline std::vector GetMutationInputRefsFromDataInputs( const std::vector &inputs) { std::vector results; results.reserve(inputs.size()); - for (const auto &input : inputs) results.push_back({.data = input}); + for (const auto &input : inputs) { + MutationInputRef result{input}; + results.push_back(std::move(result)); + } return results; } diff --git a/centipede/pc_info_test.cc b/centipede/pc_info_test.cc index 68ba411f..b395a584 100644 --- a/centipede/pc_info_test.cc +++ b/centipede/pc_info_test.cc @@ -22,7 +22,13 @@ namespace centipede { namespace { TEST(PCTableTest, SerializesAndDeserializesPCInfoSuccessfully) { - PCTable input = {{.pc = 0, .flags = 1}, {.pc = 2, .flags = 3}}; + PCInfo input1, input2; + input1.pc = 0; + input1.flags = 1; + input2.pc = 2; + input2.flags = 3; + + PCTable input = {input1, input2}; std::stringstream stream; WritePcTable(input, stream); diff --git a/centipede/periodic_action_test.cc b/centipede/periodic_action_test.cc index 33bdeb60..771660fb 100644 --- a/centipede/periodic_action_test.cc +++ b/centipede/periodic_action_test.cc @@ -50,13 +50,13 @@ TEST(PeriodicActionTest, OnlyNudgedInvocations) { constexpr absl::Duration kDuration = absl::Seconds(3); constexpr absl::Duration kNudgeInterval = absl::Milliseconds(100); int count = 0; + PeriodicAction::Options options; + // Effectively disable periodic invocations: only `Nudge()` calls + // below will trigger them. + options.sleep_before_each = [](size_t) { return absl::InfiniteDuration(); }; PeriodicAction action{ [&count]() { ++count; }, - { - // Effectively disable periodic invocations: only `Nudge()` calls - // below will trigger them. - .sleep_before_each = [](size_t) { return absl::InfiniteDuration(); }, - }, + std::move(options), }; int expected_count = 0; const absl::Time end_time = absl::Now() + kDuration; diff --git a/centipede/puzzles/pthread_exit_uint32_cmp_1.cc b/centipede/puzzles/pthread_exit_uint32_cmp_1.cc index 3a79bdcf..228134f5 100644 --- a/centipede/puzzles/pthread_exit_uint32_cmp_1.cc +++ b/centipede/puzzles/pthread_exit_uint32_cmp_1.cc @@ -34,7 +34,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { struct ThreadArg { const uint8_t *data; size_t size; - } arg = {.data = data, .size = size}; + }; + ThreadArg arg = {data, size}; auto pt_entry = +[](const ThreadArg *thread_arg) { uint32_t value, expected_value; if (thread_arg->size == sizeof(value)) { diff --git a/centipede/resource_pool_test.cc b/centipede/resource_pool_test.cc index 684fd38d..27da5d59 100644 --- a/centipede/resource_pool_test.cc +++ b/centipede/resource_pool_test.cc @@ -32,9 +32,10 @@ namespace centipede::perf { namespace { TEST(ResourcePoolTest, InvalidLeaseRequests) { - const RUsageMemory kQuota = {.mem_rss = 1000}; - const RUsageMemory kZero = {.mem_rss = 0}; - const RUsageMemory kEpsilon = {.mem_rss = 1}; + RUsageMemory kQuota, kZero, kEpsilon; + kQuota.mem_rss = 1000; + kZero.mem_rss = 0; + kEpsilon.mem_rss = 1; ResourcePool pool{kQuota}; { const auto lease = pool.AcquireLeaseBlocking({.amount = kZero}); diff --git a/centipede/reverse_pc_table.h b/centipede/reverse_pc_table.h index 8d2d7244..becde1c5 100644 --- a/centipede/reverse_pc_table.h +++ b/centipede/reverse_pc_table.h @@ -61,9 +61,10 @@ class ReversePCTable { for (size_t idx = 0; idx < pc_table.size(); ++idx) { const auto &pc_info = pc_table[idx]; if (pc_info.pc >= size_) __builtin_trap(); // TODO(kcc): use RunnerCheck. - table_[pc_info.pc] = { - .is_function_entry = pc_info.has_flag(PCInfo::kFuncEntry), - .pc_index = static_cast(idx)}; + PCGuard pc_guard; + pc_guard.is_function_entry = pc_info.has_flag(PCInfo::kFuncEntry); + pc_guard.pc_index = static_cast(idx); + table_[pc_info.pc] = pc_guard; } } @@ -80,8 +81,7 @@ class ReversePCTable { private: // A PCGuard object, such that IsValid() will return false. - static constexpr PCGuard kInvalidPCGuard = { - .is_function_entry = 0, .pc_index = PCGuard::kInvalidPcIndex}; + static constexpr PCGuard kInvalidPCGuard = {0, PCGuard::kInvalidPcIndex}; // We use size_ and table_ pointer instead of std::vector<> because // (1) we need ReversePCTable object to be accessible even after the