Skip to content

gh-117549: Don't use designated initializers in headers #118580

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Include/internal/pycore_backoff.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,18 @@ make_backoff_counter(uint16_t value, uint16_t backoff)
{
assert(backoff <= 15);
assert(value <= 0xFFF);
return (_Py_BackoffCounter){.backoff = backoff, .value = value};
_Py_BackoffCounter result;
result.value = value;
result.backoff = backoff;
return result;
}

static inline _Py_BackoffCounter
forge_backoff_counter(uint16_t counter)
{
return (_Py_BackoffCounter){.as_counter = counter};
_Py_BackoffCounter result;
result.as_counter = counter;
return result;
}

static inline _Py_BackoffCounter
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Don't use designated initializer syntax in inline functions in internal
headers. They cause problems for C++ or MSVC users who aren't yet using the
latest C++ standard (C++20). While internal, pycore_backoff.h, is included
(indirectly, via pycore_code.h) by some key 3rd party software that does so
for speed.
Loading