@@ -9,6 +9,7 @@ fn main() {
9
9
let aarch64 = target. contains ( "aarch64" ) ;
10
10
let i686 = target. contains ( "i686" ) ;
11
11
let x86_64 = target. contains ( "x86_64" ) ;
12
+ let powerpc = target. contains ( "powerpc" ) ;
12
13
let windows = target. contains ( "windows" ) ;
13
14
let mingw = target. contains ( "windows-gnu" ) ;
14
15
let linux = target. contains ( "unknown-linux" ) ;
@@ -377,6 +378,10 @@ fn main() {
377
378
// FIXME: unskip it for next major release
378
379
"stat" | "stat64" if android => true ,
379
380
381
+ // These are tested as part of the linux_fcntl tests since there are
382
+ // header conflicts when including them with all the other structs.
383
+ "termios2" => true ,
384
+
380
385
_ => false
381
386
}
382
387
} ) ;
@@ -671,8 +676,7 @@ fn main() {
671
676
// fails on a lot of platforms.
672
677
let mut cfg = ctest:: TestGenerator :: new ( ) ;
673
678
cfg. skip_type ( |_| true )
674
- . skip_struct ( |_| true )
675
- . skip_fn ( |_| true ) ;
679
+ . skip_fn ( |_| true ) ;
676
680
if android || linux {
677
681
// musl defines these directly in `fcntl.h`
678
682
if musl {
@@ -695,8 +699,22 @@ fn main() {
695
699
_ => true ,
696
700
}
697
701
} ) ;
702
+ cfg. skip_struct ( |s| {
703
+ s != "termios2"
704
+ } ) ;
705
+ cfg. type_name ( move |ty, is_struct| {
706
+ match ty {
707
+ // The termios2 struct is the same as `termios` on powerpc, so it's actually
708
+ // undeclared in the headers. We'll still expose it there to still provide
709
+ // some type safety, but we can't check it directly.
710
+ "termios2" if powerpc => "struct termios" . to_string ( ) ,
711
+ t if is_struct => format ! ( "struct {}" , t) ,
712
+ t => t. to_string ( ) ,
713
+ }
714
+ } ) ;
698
715
} else {
699
716
cfg. skip_const ( |_| true ) ;
717
+ cfg. skip_struct ( |_| true ) ;
700
718
}
701
719
cfg. generate ( "../src/lib.rs" , "linux_fcntl.rs" ) ;
702
720
}
0 commit comments