@@ -2473,6 +2473,10 @@ fn test_linux(target: &str) {
2473
2473
// FIXME: is this necessary?
2474
2474
"sighandler_t" => true ,
2475
2475
2476
+ // These cannot be tested when "resolv.h" is included and are tested
2477
+ // below.
2478
+ "Elf64_Phdr" | "Elf32_Phdr" => true ,
2479
+
2476
2480
_ => false ,
2477
2481
}
2478
2482
} ) ;
@@ -2482,6 +2486,10 @@ fn test_linux(target: &str) {
2482
2486
// FIXME: is this necessary?
2483
2487
"sockaddr_nl" if musl => true ,
2484
2488
2489
+ // These cannot be tested when "resolv.h" is included and are tested
2490
+ // below.
2491
+ "Elf64_Phdr" | "Elf32_Phdr" => true ,
2492
+
2485
2493
// On Linux, the type of `ut_tv` field of `struct utmpx`
2486
2494
// can be an anonymous struct, so an extra struct,
2487
2495
// which is absent in glibc, has to be defined.
@@ -2810,4 +2818,27 @@ fn test_linux(target: &str) {
2810
2818
t => t. to_string ( ) ,
2811
2819
} ) ;
2812
2820
cfg. generate ( "../src/lib.rs" , "linux_fcntl.rs" ) ;
2821
+
2822
+ // Test Elf64_Phdr and Elf32_Phdr
2823
+ // These types have a field called `p_type`, but including
2824
+ // "resolve.h" defines a `p_type` macro that expands to `__p_type`
2825
+ // making the tests for these fails when both are included.
2826
+ let mut cfg = ctest:: TestGenerator :: new ( ) ;
2827
+ cfg. skip_fn ( |_| true )
2828
+ . skip_const ( |_| true )
2829
+ . skip_static ( |_| true ) ;
2830
+ cfg. skip_struct ( move |ty| {
2831
+ match ty {
2832
+ "Elf64_Phdr" | "Elf32_Phdr" => false ,
2833
+ _ => true ,
2834
+ }
2835
+ } ) ;
2836
+ cfg. skip_type ( move |ty| {
2837
+ match ty {
2838
+ "Elf64_Phdr" | "Elf32_Phdr" => false ,
2839
+ _ => true ,
2840
+ }
2841
+ } ) ;
2842
+ cfg. header ( "elf.h" ) ;
2843
+ cfg. generate ( "../src/lib.rs" , "linux_elf.rs" ) ;
2813
2844
}
0 commit comments