Repository navigation
ctest: support flexible array members - #5620
Open
Deepak-negi11 wants to merge 1 commit into
Open
Deepak-negi11 wants to merge 1 commit into
Deepak-negi11 wants to merge 1 commit into
Conversation
Skip the field size test for [T; 0] fields, since C can't sizeof a T[] field. Translate [T; 0] as T[] because MSVC rejects zero-length arrays. Remove the flexible array member skips in libc-test. Fixes rust-lang#5369
Deepak-negi11
force-pushed
the
ctest-fam
branch
from
October 11, 2026 20:17
0f7dbf9 to
b35b329
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5369
ctest couldn't test fields like
uint8_t data[](we write them as[T; 0]), so libc-test was skipping them.What I changed:
[T; 0]fields, since C can't dosizeofon them. offset and type are still checked[T; 0]is now written asT[]in the generated C, because MSVC errors on[0]arraysVarBufstruct to the ctest tests. I skipped its roundtrip test because it segfaulted on FreeBSD when passed by valuedirent.d_nameon wasi,iw_encode_ext.key,fanotify_event_info_fid.handle,mcontext_t.__extcontexton musl loongarch64,bcm_msg_head.frames,af_alg_iv.iv,file_handle.f_handle)I didn't touch roundtrip for the libc structs. not sure if ctest should skip those automatically, let me know and I can do it separately.
I ran the full CI on my fork and the tests passed: https://github.com/Deepak-negi11/libc/actions/runs/38123417531 (only
Verify buildfailed there, because it needsmainas the base branch)ctest/testsandctest/src/tests.rshave been updatedLIBC_BLESS=1 cargo test -p ctest)