Skip to content

Conversation

@kartben
Copy link
Contributor

@kartben kartben commented Dec 9, 2025

As per our naming conventions for public symbols, these utility functions and macros should be prefixed with "sys_".

These were introduced with #98875 with a lack of prefix.

These should not show up as API in doxygen

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
As per our naming conventions for public symbols, these utility functions
and macros should be prefixed with "sys_".

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
@aescolar
Copy link
Member

aescolar commented Dec 9, 2025

By the way, this fix is needed to be able to build https://github.com/zephyrproject-rtos/zephyr/blob/main/drivers/usb_c/vbus/usbc_vbus_adc.c#L99

@ngphibang
Copy link
Contributor

ngphibang commented Dec 9, 2025

Thank you @kartben. Sorry that we didn't know this rule before #98875 is merged. However, should we do the same for all other macros in util.h, such as MIN/MAX(), min/max, min3/max3(), DIV_ROUND_CLOSEST(), etc. it seems all of them don't have a SYS_/sys_ prefix ?

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 9, 2025

@kartben
Copy link
Contributor Author

kartben commented Dec 9, 2025

Thank you @kartben. Sorry that we didn't know this rule before #98875 is merged.

No worries!

However, should we do the same for all other macros in util.h, such as MIN/MAX(), min/max, min3/max3(), DIV_ROUND_CLOSEST(), etc. it seems all of them don't have a SYS_/sys_ prefix ?

The rule is for new APIs being introduced. Renaming existing API is unfortunately not really possible without breaking LOTS of users :)

@fabiobaltieri
Copy link
Member

fabiobaltieri commented Dec 9, 2025

However, should we do the same for all other macros in util.h, such as MIN/MAX(), min/max, min3/max3(), DIV_ROUND_CLOSEST(), etc. it seems all of them don't have a SYS_/sys_ prefix ?

Yeah I don't think that'd be a good idea. In general, I don't think we should blindly follow these rules without applying common sense first, some of these macros are well used in Linux and we have a lot of developers working cross-project, having different convention just makes it harder for them carry over and add distractions when doing code reviews.

Probably no big deal for this one, there is a linux counterpart but it's not as commonly used as min/max though honestly I would leave it as is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Base OS Base OS Library (lib/os) area: Tests Issues related to a particular existing or missing test area: Testsuite Testsuite area: Utilities

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants