-
Notifications
You must be signed in to change notification settings - Fork 8.4k
util: move utf8 utils to a separate header #95355
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
Conversation
7ef92fc to
a3f0834
Compare
|
cc @iliar |
d395e1d
|
Swapped to int, kept the separate header. |
This moves the declaration of the utf8 utils defined in lib/utils/utf8.c in their own header. Main reason to do this is that the current setup requried adding an include for sys/types.h in util.h, which can result in a build falure due to a circular header depdenecy when using: CONFIG_POSIX_API=y CONFIG_NEWLIB_LIBC=y _GNU_SOURCE the loop and error are: - include/sys/types.h:50: <- this is a NEWLIB one - include/zephyr/posix/sys/select.h:9: - include/zephyr/posix/posix_types.h:30: - include/zephyr/kernel.h:17: - include/zephyr/kernel_includes.h:25: - include/zephyr/sys/atomic.h:18: include/zephyr/sys/util.h:705:1: error: unknown type name 'ssize_t' Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
d395e1d to
d950df9
Compare
Change utf8_count_chars return type to int and drop thesys/types.h, this way the function does not depend on posix types. Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
d950df9 to
cd42ae0
Compare
|
Sorry one more tweak: converted the local variable in utf8.c as well and drop the header from there too. Nothing is ever easy. |
|
You know what, I may as well cherry pick the test while I'm at it. |
This combination (with newlib) seems to catch some build failures due to include depdenency, adding a test file so it gets caught in CI. Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
|
|
LGTM - in general, we should avoid exposing "gnuisms" that become visible with For test purposes, I think it's OK to do as evidence to show that we don't break in the presence of that macro. |
Yeah of course, that's just for testing purposes, downstream users may do it, and we already have other tests that do it, and surprisingly some drivers code too. |
|
@nashif? (note that there's a CI false positive) |



Hi, bumped into a build regression since #94779, one of our downstream application uses an interesting combination of configs that triggered a circular dependency build failure (which was a lot of fun to troubleshoot).
Managed to reproduce the issue upstream with
and
west build -p -b nrf52dk/nrf52832 samples/basic/blinky -DCONFIG_POSIX_API=y -DCONFIG_NEWLIB_LIBC=yMay look into adding a test case for this but for now I think the right thing to do is to split these on their own header.
--
This moves the declaration of the utf8 utils defined in lib/utils/utf8.c in their own header. Main reason to do this is that the current setup requried adding an include for sys/types.h in util.h, which can result in a build falure due to a circular header depdenecy when using:
CONFIG_POSIX_API=y
CONFIG_NEWLIB_LIBC=y
_GNU_SOURCE
the loop and error are:
include/zephyr/sys/util.h:705:1: error: unknown type name 'ssize_t'