Skip to content

Commit f7770b3

Browse files
committed
Replace designated initializer usages as they require c++20 on MSVC.
1 parent 3a651bd commit f7770b3

File tree

5 files changed

+10
-14
lines changed

5 files changed

+10
-14
lines changed

inkcpp/globals_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ bool globals_impl::set_var(hash_t name, const ink::runtime::value& val)
188188

189189
void globals_impl::internal_observe(hash_t name, callback_base* callback)
190190
{
191-
_callbacks.push() = Callback{.name = name, .operation = callback};
191+
_callbacks.push() = Callback{name, callback};
192192
if (_globals_initialized) {
193193
value* p_var = _variables.get(name);
194194
inkAssert(

inkcpp/list_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void list_impl::next(const char*& flag_name, const char*& list_name, int& i, boo
4040
return;
4141
}
4242

43-
list_flag flag{.list_id = static_cast<int16_t>(i >> 16), .flag = static_cast<int16_t>(i & 0xFF)};
43+
list_flag flag{static_cast<int16_t>(i >> 16), static_cast<int16_t>(i & 0xFF)};
4444
if (flag_name != nullptr) {
4545
++flag.flag;
4646
}

inkcpp/list_table.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -699,9 +699,7 @@ optional<list_flag> list_table::toFlag(const char* flag_name) const
699699
int list_begin = list.list_id == 0 ? 0 : _list_end[list.list_id - 1];
700700
for (int i = list_begin; i != _list_end[list.list_id]; ++i) {
701701
if (str_equal(flag_name, _flag_names[i])) {
702-
return {
703-
list_flag{.list_id = list.list_id, .flag = static_cast<int16_t>(i - list_begin)}
704-
};
702+
return list_flag{list.list_id, static_cast<int16_t>(i - list_begin)};
705703
}
706704
}
707705
} else {
@@ -717,10 +715,7 @@ optional<list_flag> list_table::toFlag(const char* flag_name) const
717715
}
718716
begin = *list_itr;
719717
}
720-
return {
721-
list_flag{
722-
.list_id = static_cast<int16_t>(lid), .flag = static_cast<int16_t>(fid - begin)}
723-
};
718+
return list_flag{static_cast<int16_t>(lid), static_cast<int16_t>(fid - begin)};
724719
}
725720
}
726721
}

inkcpp/runner_impl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ void runner_impl::jump(ip_t dest, bool record_visits, bool track_knot_visit)
354354
break;
355355
}
356356
if (_container.empty() || _container.top().id != id) {
357-
_container.push({.id = id, .offset = offset});
357+
_container.push({id, offset});
358358
} else {
359359
_container.pop();
360360
if (_container.size() < comm_end) {
@@ -373,7 +373,7 @@ void runner_impl::jump(ip_t dest, bool record_visits, bool track_knot_visit)
373373
_entered_knot = true;
374374
}
375375
_ptr += 6;
376-
_container.push({.id = id, .offset = offset});
376+
_container.push({id, offset});
377377
if (reversed && comm_end == _container.size() - 1) {
378378
++comm_end;
379379
}
@@ -1394,7 +1394,7 @@ void runner_impl::step()
13941394
// Keep track of current container
13951395
auto index = read<uint32_t>();
13961396
// offset points to command, command has size 6
1397-
_container.push({.id = index, .offset = _ptr - 6});
1397+
_container.push({index, _ptr - 6});
13981398

13991399
// Increment visit count
14001400
if (flag & CommandFlag::CONTAINER_MARKER_TRACK_VISITS

inkcpp_compiler/list_data.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ void list_data::new_flag(const std::string& flag_name, int value)
3030
_flags.emplace_back(
3131
&flag_name,
3232
list_flag{
33-
.list_id = static_cast<decltype(list_flag::list_id)>(_list_name.size() - 1),
34-
.flag = static_cast<decltype(list_flag::flag)>(value)}
33+
static_cast<decltype(list_flag::list_id)>(_list_name.size() - 1),
34+
static_cast<decltype(list_flag::flag)>(value)
35+
}
3536
);
3637
}
3738

0 commit comments

Comments
 (0)