libc: Add C23 stdbit.h with optional Kconfig and generic implementation#18347
libc: Add C23 stdbit.h with optional Kconfig and generic implementation#18347arjav1528 wants to merge 1 commit intoapache:masterfrom
Conversation
michallenc
left a comment
There was a problem hiding this comment.
That was fast, nice work! Please squash the commits ideally into two - one implementing stdbit and other updating the documentation. Also fix long lines in stdbit.h causing CI to fail.
We definitely need proper tests before merging this. These should go to app repository. I can write some, but won't get to it until next week probably.
ad2e28a to
277c277
Compare
8abb829 to
8e473c0
Compare
|
Seems the merge request now contains completely different commits unrelated to the title and previous changes. |
linguini1
left a comment
There was a problem hiding this comment.
Please check that your PR follows the contributing guidelines. Also, a mistake might have happened during rebase/squashing that has caused your commits to disappear, as Michal pointed out.
8e473c0 to
9d7969a
Compare
1151f5d to
79f0faa
Compare
done, could you please review the PR and approve the workflow |
|
@michallenc could you please approve the workflows again :( |
a9148f2 to
ada86ea
Compare
|
@michallenc could you please approve the workflows again as I have force pushed new commits |
|
@michallenc is this same timeout issue, or is anything wrong?? |
|
@michallenc restarted the workflow |
same issue, ig it might be due to multiple PR workflows in the repo, so the CPU load increases which results in the slower builds and hence timeouts |
|
@arjav1528 please rebase CONFIG_INTERPRETER_LUA_32BIT has been renamed with this PR #18398 |
ada86ea to
9440171
Compare
|
@simbit18 done, could you approve the workflows.. |
| * C23 endianness macros (reuse LITTLE_ENDIAN/BIG_ENDIAN from sys/endian.h) | ||
| ****************************************************************************/ | ||
|
|
||
| # include <sys/endian.h> |
There was a problem hiding this comment.
move after line 37
| * | ||
| ****************************************************************************/ | ||
|
|
||
| #ifndef __INCLUDE_NUTTX_LIB_STDBIT_H |
There was a problem hiding this comment.
squash your change into one patch
74e2c99 to
5e1c7a4
Compare
|
done @xiaoxiang781216, could you please approve the workflows |
please fix the ci issue before asking review: |
5e1c7a4 to
27d759a
Compare
- Introduced Kconfig options for stdbit.h, allowing architecture-specific and generic implementations. - Added new documentation for stdbit.h, detailing its usage and configuration. - Updated CMake and Makefile to handle the inclusion of stdbit.h based on configuration settings. This enhances the NuttX library with optional C23 bit manipulation utilities, improving functionality for architectures that support it. Signed-off-by: Arjav Patel <arjav1528@gmail.com>
27d759a to
964c118
Compare
Fixes: #18311
Summary
Add optional C23
stdbit.hsupport so builds can provide<stdbit.h>when the toolchain does not. Follows the same pattern asstdarg.h/math.h: redirect atinclude/nuttx/lib/stdbit.h, copied toinclude/stdbit.hwhen enabled.ARCH_HAVE_STDBIT_H,ARCH_STDBIT_H(arch-specific),LIBC_STDBIT_GENERIC(generic on any arch).__builtin_clz/__builtin_ctz/__builtin_popcountfor all C23 stdbit macros; archs may providearch/<arch>/include/stdbit.h.libs/libc/stdbit/stdbit_verify.c(compile-time check when stdbit enabled).Documentation/legacy_README.mdandDocumentation/components/libs/libc/index.rst.Impact
ARCH_STDBIT_HorLIBC_STDBIT_GENERICis enabled. Code can then use C23<stdbit.h>macros when the toolchain lacks them.include/stdbit.hwhen stdbit support is enabled; build system (Unix.mk, Win.mk, CMake) is extended only for this copy.stdbit.h. No impact on existing configs that don’t enable it.Testing
There is no freely available, upstream test suite for C23
stdbit.hthat we could add to NuttX to validate this implementation. Verification is limited to:LIBC_STDBIT_GENERIC(or arch-specificARCH_STDBIT_Hwhere implemented) and confirming the build completes andstdbit_verify.ccompiles (compile-time checks that the macros expand as expected).