Skip to content

net: http: Fix __z_http_service_define fields incorrectly ordered C++20 #91204

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

Conversation

Pavllick
Copy link
Contributor

@Pavllick Pavllick commented Jun 6, 2025

Instance of the http_service_desc struct created by the __z_http_service_define macro uses designated initializer with fields not following original http_service_desc struct order which lead to compile time exception when #include <zephyr/net/http/service.h> is included and project is compiled for C++20.

.../zephyr/include/zephyr/net/http/service.h:113:9: error: designator order for field 'http_service_desc::backlog' does not match declaration order in 'const http_service_desc'
  113 |         }
      |         ^
.../zephyr/include/zephyr/net/http/service.h:195:9: note: in expansion of macro '__z_http_service_define'
  195 |         __z_http_service_define(_name, _host, _port, _concurrent, _backlog, _detail,               \
      |         ^~~~~~~~~~~~~~~~~~~~~~~

As C++20 doesn't allow out-of-order designated initialization.

This PR fixes the order.

Copy link

github-actions bot commented Jun 6, 2025

Hello @Pavllick, and thank you very much for your first pull request to the Zephyr project!
Our Continuous Integration pipeline will execute a series of checks on your Pull Request commit messages and code, and you are expected to address any failures by updating the PR. Please take a look at our commit message guidelines to find out how to format your commit messages, and at our contribution workflow to understand how to update your Pull Request. If you haven't already, please make sure to review the project's Contributor Expectations and update (by amending and force-pushing the commits) your pull request if necessary.
If you are stuck or need help please join us on Discord and ask your question there. Additionally, you can escalate the review when applicable. 😊

@github-actions github-actions bot added size: XS A PR changing only a single line of code area: HTTP HTTP client/server support labels Jun 6, 2025
@jukkar jukkar added the Trivial Changes that can be reviewed by anyone, i.e. doc changes, minor build system tweaks, etc. label Jun 7, 2025
@Pavllick Pavllick changed the title drivers: net: http: Fix __z_http_service_define fields incorrectly ordered C++20 net: http: Fix __z_http_service_define fields incorrectly ordered C++20 Jun 8, 2025
@Pavllick Pavllick force-pushed the http_service_define_order_fix branch from f87dad3 to 5aab8b4 Compare June 8, 2025 02:29
Fixes an error:
error: designator order for field 'http_service_desc::backlog'
does not match declaration order in 'const http_service_desc'
When compiled for C++

Signed-off-by: Pavel Maloletkov <[email protected]>
@Pavllick Pavllick force-pushed the http_service_define_order_fix branch from 5aab8b4 to 276a90e Compare June 8, 2025 18:41
Copy link

sonarqubecloud bot commented Jun 8, 2025

@dkalowsk
Copy link
Collaborator

dkalowsk commented Jun 9, 2025

Thanks for the fix @Pavllick !

@dkalowsk dkalowsk merged commit 26cf7a0 into zephyrproject-rtos:main Jun 9, 2025
27 checks passed
Copy link

github-actions bot commented Jun 9, 2025

Hi @Pavllick!
Congratulations on getting your very first Zephyr pull request merged 🎉🥳. This is a fantastic achievement, and we're thrilled to have you as part of our community!

To celebrate this milestone and showcase your contribution, we'd love to award you the Zephyr Technical Contributor badge. If you're interested, please claim your badge by filling out this form: Claim Your Zephyr Badge.

Thank you for your valuable input, and we look forward to seeing more of your contributions in the future! 🪁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: HTTP HTTP client/server support area: Networking size: XS A PR changing only a single line of code Trivial Changes that can be reviewed by anyone, i.e. doc changes, minor build system tweaks, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants