@@ -72,6 +72,16 @@ fn do_ctest() {
7272fn ctest_cfg ( ) -> ctest:: TestGenerator {
7373 let mut cfg = ctest:: TestGenerator :: new ( ) ;
7474 cfg. skip_private ( true ) ;
75+
76+ // Skip anonymous unions/structs.
77+ cfg. skip_union ( |u| u. ident ( ) . starts_with ( "__c_anonymous_" ) ) ;
78+ cfg. skip_struct ( |s| s. ident ( ) . starts_with ( "__c_anonymous_" ) ) ;
79+ cfg. skip_alias ( |ty| ty. ident ( ) . starts_with ( "__c_anonymous_" ) ) ;
80+
81+ // __uint128 is not declared in C, but is an alias we export.
82+ // FIXME(1.0): These aliases will eventually be removed.
83+ cfg. skip_alias ( |ty| ty. ident ( ) == "__uint128" ) ;
84+
7585 cfg
7686}
7787
@@ -307,10 +317,6 @@ fn test_apple(target: &str) {
307317 ( x86_64, "crt_externs.h" ) ,
308318 ) ;
309319
310- // Skip anonymous unions/structs.
311- cfg. skip_union ( |u| u. ident ( ) . starts_with ( "__c_anonymous_" ) ) ;
312- cfg. skip_struct ( |s| s. ident ( ) . starts_with ( "__c_anonymous_" ) ) ;
313-
314320 cfg. skip_struct ( |s| {
315321 match s. ident ( ) {
316322 // FIXME(union): actually a union
@@ -324,15 +330,6 @@ fn test_apple(target: &str) {
324330 }
325331 } ) ;
326332
327- cfg. skip_alias ( |ty| ty. ident ( ) . starts_with ( "__c_anonymous_" ) ) ;
328- cfg. skip_alias ( |ty| {
329- match ty. ident ( ) {
330- // FIXME(macos): "'__uint128' undeclared" in C
331- "__uint128" => true ,
332- _ => false ,
333- }
334- } ) ;
335-
336333 cfg. skip_const ( move |constant| {
337334 match constant. ident ( ) {
338335 // They're declared via `deprecated_mach` and we don't support it anymore.
@@ -590,9 +587,6 @@ fn test_openbsd(target: &str) {
590587 }
591588 } ) ;
592589
593- // Skip anonymous unions/structs.
594- cfg. skip_union ( |u| u. ident ( ) . starts_with ( "__c_anonymous_" ) ) ;
595- cfg. skip_struct ( |s| s. ident ( ) . starts_with ( "__c_anonymous_" ) ) ;
596590 cfg. skip_struct ( move |ty| {
597591 match ty. ident ( ) {
598592 // FIXME(union): actually a union
@@ -729,14 +723,6 @@ fn test_cygwin(target: &str) {
729723 _ => false ,
730724 } ) ;
731725
732- cfg. skip_struct ( move |struct_| {
733- if struct_. ident ( ) . starts_with ( "__c_anonymous_" ) {
734- return true ;
735- }
736-
737- false
738- } ) ;
739-
740726 cfg. rename_struct_field ( move |struct_, field| {
741727 match field. ident ( ) {
742728 // Our stat *_nsec fields normally don't actually exist but are part
@@ -869,17 +855,12 @@ fn test_windows(target: &str) {
869855 } ) ;
870856
871857 cfg. skip_struct ( move |struct_| {
872- let ty = struct_. ident ( ) ;
873- if ty. starts_with ( "__c_anonymous_" ) {
874- return true ;
875- }
876- match ty {
858+ match struct_. ident ( ) {
877859 // FIXME(windows): The size and alignment of this struct are incorrect
878860 "timespec" if gnu && i686 => true ,
879861 _ => false ,
880862 }
881863 } ) ;
882- cfg. skip_union ( move |union_| union_. ident ( ) . starts_with ( "__c_anonymous_" ) ) ;
883864
884865 cfg. skip_const ( move |constant| {
885866 match constant. ident ( ) {
@@ -1141,15 +1122,12 @@ fn test_solarish(target: &str) {
11411122
11421123 cfg. skip_union ( |union_| {
11431124 // the union handling is a mess
1144- if union_. ident ( ) . starts_with ( "__c_anonymous_" ) || union_ . ident ( ) . contains ( "door_desc_t_" ) {
1125+ if union_. ident ( ) . contains ( "door_desc_t_" ) {
11451126 return true ;
11461127 }
11471128 false
11481129 } ) ;
11491130 cfg. skip_struct ( move |struct_| {
1150- if struct_. ident ( ) . starts_with ( "__c_anonymous_" ) {
1151- return true ;
1152- }
11531131 // the union handling is a mess
11541132 if struct_. ident ( ) . contains ( "door_desc_t_" ) {
11551133 return true ;
@@ -1392,13 +1370,7 @@ fn test_netbsd(target: &str) {
13921370 }
13931371 } ) ;
13941372
1395- cfg. skip_struct ( |ty| ty. ident ( ) . starts_with ( "__c_anonymous_" ) ) ;
1396- cfg. skip_union ( |ty| ty. ident ( ) . starts_with ( "__c_anonymous_" ) ) ;
1397-
13981373 cfg. skip_alias ( move |ty| {
1399- if ty. ident ( ) . starts_with ( "__c_anonymous_" ) {
1400- return true ;
1401- }
14021374 match ty. ident ( ) {
14031375 // FIXME(netbsd): sighandler_t is crazy across platforms
14041376 "sighandler_t" => true ,
@@ -1627,9 +1599,6 @@ fn test_dragonflybsd(target: &str) {
16271599 } ) ;
16281600
16291601 cfg. skip_struct ( move |struct_| {
1630- if struct_. ident ( ) . starts_with ( "__c_anonymous_" ) {
1631- return true ;
1632- }
16331602 match struct_. ident ( ) {
16341603 // FIXME(dragonflybsd): These are tested as part of the linux_fcntl tests since
16351604 // there are header conflicts when including them with all the other
@@ -2007,21 +1976,14 @@ fn test_android(target: &str) {
20071976 "posix_spawn_file_actions_t" => true ,
20081977 "posix_spawnattr_t" => true ,
20091978
2010- // FIXME(android): "'__uint128' undeclared" in C
2011- "__uint128" => true ,
20121979 // Added in API level 24
20131980 "if_nameindex" => true ,
20141981
20151982 _ => false ,
20161983 }
20171984 } ) ;
20181985
2019- cfg. skip_union ( move |union_| union_. ident ( ) . starts_with ( "__c_anonymous_" ) ) ;
2020-
20211986 cfg. skip_struct ( move |struct_| {
2022- if struct_. ident ( ) . starts_with ( "__c_anonymous_" ) {
2023- return true ;
2024- }
20251987 match struct_. ident ( ) {
20261988 // These are tested as part of the linux_fcntl tests since there are
20271989 // header conflicts when including them with all the other structs.
@@ -2812,13 +2774,8 @@ fn test_freebsd(target: &str) {
28122774 }
28132775 } ) ;
28142776
2815- cfg. skip_union ( |u| u. ident ( ) . starts_with ( "__c_anonymous_" ) ) ;
28162777 cfg. skip_struct ( move |struct_| {
2817- let ty = struct_. ident ( ) ;
2818- if ty. starts_with ( "__c_anonymous_" ) {
2819- return true ;
2820- }
2821- match ty {
2778+ match struct_. ident ( ) {
28222779 // `procstat` is a private struct
28232780 "procstat" => true ,
28242781
@@ -3132,10 +3089,6 @@ fn test_emscripten(target: &str) {
31323089 } ) ;
31333090
31343091 cfg. skip_union ( |union_| {
3135- if union_. ident ( ) . starts_with ( "__c_anonymous_" ) {
3136- return true ;
3137- }
3138-
31393092 match union_. ident ( ) {
31403093 // No epoll support
31413094 // https://github.com/emscripten-core/emscripten/issues/5033
@@ -3154,9 +3107,6 @@ fn test_emscripten(target: &str) {
31543107 } ) ;
31553108
31563109 cfg. skip_struct ( move |struct_| {
3157- if struct_. ident ( ) . starts_with ( "__c_anonymous_" ) {
3158- return true ;
3159- }
31603110 match struct_. ident ( ) {
31613111 // This is actually a union, not a struct
31623112 "sigval" => true ,
@@ -3430,17 +3380,11 @@ fn test_neutrino(target: &str) {
34303380 // Does not exist in Neutrino
34313381 "locale_t" => true ,
34323382
3433- // FIXME: "'__uint128' undeclared" in C
3434- "__uint128" => true ,
3435-
34363383 _ => false ,
34373384 }
34383385 } ) ;
34393386
34403387 cfg. skip_struct ( move |struct_| {
3441- if struct_. ident ( ) . starts_with ( "__c_anonymous_" ) {
3442- return true ;
3443- }
34443388 match struct_. ident ( ) {
34453389 "Elf64_Phdr" | "Elf32_Phdr" => true ,
34463390
@@ -4014,9 +3958,6 @@ fn test_linux(target: &str) {
40143958 // specific type.
40153959 "Ioctl" => true ,
40163960
4017- // FIXME: "'__uint128' undeclared" in C
4018- "__uint128" => true ,
4019-
40203961 t => {
40213962 if musl {
40223963 // LFS64 types have been removed in musl 1.2.4+
@@ -4028,10 +3969,6 @@ fn test_linux(target: &str) {
40283969 }
40293970 } ) ;
40303971
4031- // Skip structs and enums that are unnamed in C.
4032- cfg. skip_union ( move |union_| union_. ident ( ) . starts_with ( "__c_anonymous_" ) ) ;
4033- cfg. skip_struct ( move |struct_| struct_. ident ( ) . starts_with ( "__c_anonymous_" ) ) ;
4034-
40353972 cfg. skip_struct ( move |struct_| {
40363973 let ty = struct_. ident ( ) ;
40373974
@@ -4113,10 +4050,7 @@ fn test_linux(target: &str) {
41134050 "xdp_umem_reg" => true ,
41144051
41154052 // FIXME(linux): Requires >= 6.8 kernel headers.
4116- "xsk_tx_metadata"
4117- | "__c_anonymous_xsk_tx_metadata_union"
4118- | "xsk_tx_metadata_request"
4119- | "xsk_tx_metadata_completion" => true ,
4053+ "xsk_tx_metadata" | "xsk_tx_metadata_request" | "xsk_tx_metadata_completion" => true ,
41204054
41214055 // A new field was added in kernel 5.4, this is the old version for backwards compatibility.
41224056 // https://github.com/torvalds/linux/commit/77cd0d7b3f257fd0e3096b4fdcff1a7d38e99e10
@@ -4797,9 +4731,9 @@ fn test_linux_like_apis(target: &str) {
47974731 if linux || android || emscripten {
47984732 // test strerror_r from the `string.h` header
47994733 config_gnu_bits ( target, & mut cfg) ;
4800- headers ! ( cfg, "string.h" , ) ;
48014734
4802- cfg. skip_alias ( |_| true )
4735+ cfg. header ( "string.h" )
4736+ . skip_alias ( |_| true )
48034737 . skip_static ( |_| true )
48044738 . skip_const ( |_| true )
48054739 . skip_struct ( |_| true )
@@ -5098,11 +5032,7 @@ fn test_haiku(target: &str) {
50985032 "support/TypeConstants.h" ,
50995033 ) ;
51005034
5101- cfg. skip_union ( |union_| union_. ident ( ) . starts_with ( "__c_anonymous_" ) ) ;
51025035 cfg. skip_struct ( move |struct_| {
5103- if struct_. ident ( ) . starts_with ( "__c_anonymous_" ) {
5104- return true ;
5105- }
51065036 match struct_. ident ( ) {
51075037 // FIXME(union): actually a union
51085038 "sigval" => true ,
0 commit comments