-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Move to using C99 int types and deprecating zephyr int types #25679
Conversation
This comment has been minimized.
This comment has been minimized.
I'm totally in favor of using standard stdint types . |
These are longer and harder to type. Could we do what linux does instead? u64, u32, u16, u8 for unsigned |
The issue is that a lot of code integrated w/zephyr utilizes C99 and those types have leaked into Zephyr. If we plan on getting 2 different types, we'd just leave the zephyr types as is. |
d83049d
to
3110f62
Compare
The sanitycheck failure is timeout of a test that passes when run by itself. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to using PRIu64/PRId64 instead of %llu/%lld since on native_posix_64 the uint64_t/int64_t type is defined in terms of 'long int' and not 'long long int'.
Dropping the keyword "LP64" in the commit message and documentation would add a lot of relevant background information with very few extra characters. Something like: "Unlike Zephyr, native_posix_64 follows the LP64 model that blabla..."
https://en.wikipedia.org/wiki/64-bit_computing#64-bit_data_models
https://www.google.com/search?q=__LP64__
These are longer and harder to type.
https://twitter.com/study_web_dev/status/764811712394620928
(Not counting all the time spent trying to understand Zephyr types - and I barely did)
Could we do what linux does instead?
The Linux kernel doesn't look like it will ever care about POSIX-looking code.
e461a14
to
2c3e8bc
Compare
On 64-bit arch's like AARCH64, x86_64, or riscv-64 the way {u}int64_t will differ from how its defined on 32-bit arch's. Do the same trick we do for {u}int32_t for {u}int64_t so that the type is the same regardless of what we are building for. This keeps things like %lld working the same regardless of 32-bit or 64-bit arch. Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Pull in various module updates for C99 type change Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
git grep -l 'u\(8\|16\|32\|64\)_t' | \ xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g" git grep -l 's\(8\|16\|32\|64\)_t' | \ xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g" Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Move to using PRIu64/PRId64 instead of %llu/%lld since on native_posix_64 the uint64_t/int64_t type is defined in terms of 'long int' and not 'long long int'. Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
As the int types defined in include/zephyr/types.h are typdef's we utilize a Kconfig option (LEGACY_ZEPHYR_INT_TYPES) to enable/disable the support for them. By default to LEGACY_ZEPHYR_INT_TYPES not being enabled and add an explicit test to ensure the types continue to function until removed in the future. Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Now that we are standardizing C99 integer types we can revert the commit that warned about C99 type usage. Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't believe we're doing this again. But OK, quick spot checks show that the scripting did the right thing. Please rip the bandaid off and merge this quickly so we can get past the resulting rebase hell.
I am not fond of calling old types legacy, legacy means that you want to maintain those for a lengthy period of time where deprecated is more strict and follows deprecation policies. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add an entry in the API Changes section of the 2.4 release notes in this PR
help | ||
Allows use of the deprecated Zephyr integer typedefs defined in | ||
Zephyr 2.3 and previous versions. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@galak could you please mention the types by name here?
It's what we do when we deprecate via Kconfig option. At least it's what we've done so far (timeouts and DT, which will both go away in 2 releases), so for consistency I think we should keep the same naming scheme. It's mentioned here: https://docs.zephyrproject.org/latest/development_process/api_lifecycle.html#deprecated |
well, just because we have what I think is a mistake, does not mean we have to continue with that mistake, and all of this happened just recently... https://www.linkedin.com/pulse/deprecated-vs-legacy-ayoub-moustaid/ the way I see it:
Are we going to keep those types more than 2 releases? |
No, I don't think so. So in that case I suggest we change the doc, because right now (mostly because of the timeout and DT Kconfig options using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is samples/tests: Convert use of %ll{u,d} to PRI{u,d}64
intended to be comprehensive? git grep '%ll' tests/
finds a few more cases.
Only the samples/tests that get built on native_posix_64 were touched. |
@carlescufi I suggest we merge this and deal with any Kconfig/relnote fixes a follow up PRs. |
An explicit link the shippable run: https://app.shippable.com/github/zephyrproject-rtos/zephyr/runs/74656/summary/console |
Add top line note about C99 integer types being the default Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
@carlescufi & @nashif opened up PR #26047 to continue the legacy/deprecated naming discussion. |
No description provided.