Skip to content

Commit

Permalink
Make sure all initializer clauses are designated
Browse files Browse the repository at this point in the history
Not doing so is actually an error and breaks C++20.
  • Loading branch information
ktf committed Oct 31, 2023
1 parent 7ffc7ba commit b9ddf10
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 3 additions & 1 deletion Framework/Core/src/DataProcessingDevice.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2177,7 +2177,9 @@ bool DataProcessingDevice::tryDispatchComputation(ServiceRegistryRef ref, std::v
buffer[ai] = record.isValid(ai) ? '3' : '0';
}
buffer[record.size()] = 0;
states.updateState({.id = short((int)ProcessingStateId::DATA_RELAYER_BASE + action.slot.index), (int)(record.size() + buffer - relayerSlotState), relayerSlotState});
states.updateState({.id = short((int)ProcessingStateId::DATA_RELAYER_BASE + action.slot.index),
.size = (int)(record.size() + buffer - relayerSlotState),
.data = relayerSlotState});
uint64_t tEnd = uv_hrtime();
// tEnd and tStart are in nanoseconds according to https://docs.libuv.org/en/v1.x/misc.html#c.uv_hrtime
int64_t wallTimeMs = (tEnd - tStart) / 1000000;
Expand Down
16 changes: 9 additions & 7 deletions Framework/Core/src/DataRelayer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,9 @@ void sendVariableContextMetrics(VariableContext& context, TimesliceSlot slot, Da
}
state += ";";
}
states.updateState({.id = short((int)ProcessingStateId::CONTEXT_VARIABLES_BASE + slot.index), (int)state.size(), state.data()});
states.updateState({.id = short((int)ProcessingStateId::CONTEXT_VARIABLES_BASE + slot.index),
.size = (int)state.size(),
.data = state.data()});
},
&states, slot);
}
Expand Down Expand Up @@ -516,7 +518,7 @@ DataRelayer::RelayChoice
index.publishSlot(slot);
index.markAsDirty(slot, true);
stats.updateStats({static_cast<short>(ProcessingStatsId::RELAYED_MESSAGES), DataProcessingStats::Op::Add, (int)1});
return RelayChoice{RelayChoice::Type::WillRelay, timeslice};
return RelayChoice{.type = RelayChoice::Type::WillRelay, .timeslice = timeslice};
}

/// If not, we find which timeslice we really were looking at
Expand All @@ -543,7 +545,7 @@ DataRelayer::RelayChoice
for (size_t pi = 0; pi < nMessages; ++pi) {
messages[pi].reset(nullptr);
}
return RelayChoice{.type = RelayChoice::Type::Invalid, timeslice};
return RelayChoice{.type = RelayChoice::Type::Invalid, .timeslice = timeslice};
}

if (TimesliceId::isValid(timeslice) == false) {
Expand All @@ -553,7 +555,7 @@ DataRelayer::RelayChoice
for (size_t pi = 0; pi < nMessages; ++pi) {
messages[pi].reset(nullptr);
}
return RelayChoice{.type = RelayChoice::Type::Invalid, timeslice};
return RelayChoice{.type = RelayChoice::Type::Invalid, .timeslice = timeslice};
}

TimesliceIndex::ActionTaken action;
Expand All @@ -563,7 +565,7 @@ DataRelayer::RelayChoice

switch (action) {
case TimesliceIndex::ActionTaken::Wait:
return RelayChoice{.type = RelayChoice::Type::Backpressured, timeslice};
return RelayChoice{.type = RelayChoice::Type::Backpressured, .timeslice = timeslice};
case TimesliceIndex::ActionTaken::DropObsolete:
static std::atomic<size_t> obsoleteCount = 0;
static std::atomic<size_t> mult = 1;
Expand All @@ -573,15 +575,15 @@ DataRelayer::RelayChoice
mult = mult * 10;
}
}
return RelayChoice{.type = RelayChoice::Type::Dropped, timeslice};
return RelayChoice{.type = RelayChoice::Type::Dropped, .timeslice = timeslice};
case TimesliceIndex::ActionTaken::DropInvalid:
LOG(warning) << "Incoming data is invalid, not relaying.";
stats.updateStats({static_cast<short>(ProcessingStatsId::MALFORMED_INPUTS), DataProcessingStats::Op::Add, (int)1});
stats.updateStats({static_cast<short>(ProcessingStatsId::DROPPED_INCOMING_MESSAGES), DataProcessingStats::Op::Add, (int)1});
for (size_t pi = 0; pi < nMessages; ++pi) {
messages[pi].reset(nullptr);
}
return RelayChoice{.type = RelayChoice::Type::Invalid, timeslice};
return RelayChoice{.type = RelayChoice::Type::Invalid, .timeslice = timeslice};
case TimesliceIndex::ActionTaken::ReplaceUnused:
case TimesliceIndex::ActionTaken::ReplaceObsolete:
// At this point the variables match the new input but the
Expand Down

0 comments on commit b9ddf10

Please sign in to comment.