Skip to content

Commit f8e82dc

Browse files
committed
Skip round-trip tests for structs with FAMs
1 parent d1df702 commit f8e82dc

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

libc-test/build.rs

+13-5
Original file line numberDiff line numberDiff line change
@@ -3333,15 +3333,15 @@ fn test_linux(target: &str) {
33333333
"Ioctl" if gnu => "unsigned long".to_string(),
33343334
"Ioctl" => "int".to_string(),
33353335

3336-
t if is_union => format!("union {}", t),
3337-
3338-
t if t.ends_with("_t") => t.to_string(),
3339-
33403336
// In MUSL `flock64` is a typedef to `flock`.
33413337
"flock64" if musl => format!("struct {}", ty),
33423338

3339+
// typedefs don't need any keywords
3340+
t if t.ends_with("_t") => t.to_string(),
33433341
// put `struct` in front of all structs:.
33443342
t if is_struct => format!("struct {}", t),
3343+
// put `union` in front of all unions:
3344+
t if is_union => format!("union {}", t),
33453345

33463346
t => t.to_string(),
33473347
}
@@ -3390,7 +3390,8 @@ fn test_linux(target: &str) {
33903390
// on Linux, this is a volatile int
33913391
"pthread_spinlock_t" => true,
33923392

3393-
// For internal use only, to define architecture specific ioctl constants with a libc specific type.
3393+
// For internal use only, to define architecture specific ioctl constants with a libc
3394+
// specific type.
33943395
"Ioctl" => true,
33953396

33963397
// FIXME: requires >= 5.4.1 kernel headers
@@ -3964,6 +3965,13 @@ fn test_linux(target: &str) {
39643965
true
39653966
}
39663967

3968+
// The `inotify_event` and `cmsghdr` types contain Flexible Array Member fields (the
3969+
// `name` and `data` fields respectively) which have unspecified calling convention.
3970+
// The roundtripping tests deliberately pass the structs by value to check "by value"
3971+
// layout consistency, but this would be UB for the these types.
3972+
"inotify_event" => true,
3973+
"cmsghdr" => true,
3974+
39673975
// FIXME: the call ABI of max_align_t is incorrect on these platforms:
39683976
"max_align_t" if i686 || mips64 || ppc64 => true,
39693977

0 commit comments

Comments
 (0)