@@ -1370,8 +1370,8 @@ fn test_android(target: &str) {
1370
1370
1371
1371
// FIXME: still necessary?
1372
1372
"SIG_DFL" | "SIG_ERR" | "SIG_IGN" => true , // sighandler_t weirdness
1373
- // FIXME: still necessary?
1374
- "SIGUNUSED" => true , // removed in glibc 2.26
1373
+ // FIXME: deprecated - removed in glibc 2.26
1374
+ "SIGUNUSED" => true ,
1375
1375
1376
1376
_ => false ,
1377
1377
}
@@ -1428,7 +1428,7 @@ fn test_android(target: &str) {
1428
1428
1429
1429
cfg. generate ( "../src/lib.rs" , "main.rs" ) ;
1430
1430
1431
- test_linux_incompatible_apis ( target) ;
1431
+ test_linux_like_apis ( target) ;
1432
1432
}
1433
1433
1434
1434
fn test_freebsd ( target : & str ) {
@@ -1635,11 +1635,7 @@ fn test_emscripten(target: &str) {
1635
1635
assert ! ( target. contains( "emscripten" ) ) ;
1636
1636
1637
1637
let mut cfg = ctest:: TestGenerator :: new ( ) ;
1638
- // FIXME: still necessary?
1639
- cfg. define ( "_GNU_SOURCE" , None ) ;
1640
-
1641
- // FIXME: still necessary?
1642
- cfg. flag ( "-Wno-deprecated-declarations" ) ;
1638
+ cfg. define ( "_GNU_SOURCE" , None ) ; // FIXME: ??
1643
1639
1644
1640
headers ! { cfg:
1645
1641
"aio.h" ,
@@ -1732,11 +1728,7 @@ fn test_emscripten(target: &str) {
1732
1728
cfg. type_name ( move |ty, is_struct, is_union| {
1733
1729
match ty {
1734
1730
// Just pass all these through, no need for a "struct" prefix
1735
- // FIXME: is this necessary?
1736
- "FILE" | "fd_set" | "Dl_info" | "DIR" | "Elf32_Phdr"
1737
- | "Elf64_Phdr" | "Elf32_Shdr" | "Elf64_Shdr" | "Elf32_Sym"
1738
- | "Elf64_Sym" | "Elf32_Ehdr" | "Elf64_Ehdr" | "Elf32_Chdr"
1739
- | "Elf64_Chdr" => ty. to_string ( ) ,
1731
+ "FILE" | "fd_set" | "Dl_info" | "DIR" => ty. to_string ( ) ,
1740
1732
1741
1733
t if is_union => format ! ( "union {}" , t) ,
1742
1734
@@ -1756,7 +1748,7 @@ fn test_emscripten(target: &str) {
1756
1748
s if s. ends_with ( "_nsec" ) && struct_. starts_with ( "stat" ) => {
1757
1749
s. replace ( "e_nsec" , ".tv_nsec" )
1758
1750
}
1759
- // FIXME: is this necessary?
1751
+ // FIXME: appears that `epoll_event.data` is an union
1760
1752
"u64" if struct_ == "epoll_event" => "data.u64" . to_string ( ) ,
1761
1753
s => s. to_string ( ) ,
1762
1754
}
@@ -1774,157 +1766,31 @@ fn test_emscripten(target: &str) {
1774
1766
1775
1767
cfg. skip_struct ( move |ty| {
1776
1768
match ty {
1777
- // FIXME: is this necessary?
1778
- "sockaddr_nl" => true ,
1779
-
1780
1769
// This is actually a union, not a struct
1781
1770
// FIXME: is this necessary?
1782
1771
"sigval" => true ,
1783
1772
1784
- // Linux kernel headers used on musl are too old to have this
1785
- // definition. Because it's tested on other Linux targets, skip it.
1786
- // FIXME: is this necessary?
1787
- "input_mask" => true ,
1788
-
1789
- // These are tested as part of the linux_fcntl tests since there are
1790
- // header conflicts when including them with all the other structs.
1791
- // FIXME: is this necessary?
1792
- "termios2" => true ,
1793
-
1794
1773
_ => false ,
1795
1774
}
1796
1775
} ) ;
1797
1776
1798
- cfg. skip_signededness ( move |c| match c {
1799
- // FIXME: is this necessary?
1800
- "LARGE_INTEGER" | "float" | "double" => true ,
1801
- // FIXME: is this necessary?
1802
- n if n. starts_with ( "pthread" ) => true ,
1803
- _ => false ,
1804
- } ) ;
1805
-
1806
- cfg. skip_const ( move |name| {
1777
+ cfg. skip_fn ( move |name| {
1807
1778
match name {
1808
- // FIXME: is this necessary?
1809
- "SIG_DFL" | "SIG_ERR" | "SIG_IGN" => true , // sighandler_t weirdness
1810
- // FIXME: is this necessary?
1811
- "SIGUNUSED" => true , // removed in glibc 2.26
1812
-
1813
- // types on musl are defined a little differently
1814
- // FIXME: is this necessary?
1815
- n if n. contains ( "__SIZEOF_PTHREAD" ) => true ,
1816
-
1817
- // Skip constants not defined in MUSL but just passed down to the
1818
- // kernel regardless
1819
- // FIXME: is this necessary?
1820
- "RLIMIT_NLIMITS"
1821
- | "TCP_COOKIE_TRANSACTIONS"
1822
- | "RLIMIT_RTTIME"
1823
- | "MSG_COPY"
1824
- =>
1825
- {
1826
- true
1827
- }
1828
-
1829
- // weird signed extension or something like that?
1830
- // FIXME: is this necessary?
1831
- "MS_NOUSER" => true ,
1832
- // FIXME: is this necessary?
1833
- "MS_RMT_MASK" => true , // updated in glibc 2.22 and musl 1.1.13
1834
-
1835
- // Musl uses old, patched kernel headers
1836
- // FIXME: is this necessary?
1837
- "FALLOC_FL_COLLAPSE_RANGE"
1838
- | "FALLOC_FL_ZERO_RANGE"
1839
- | "FALLOC_FL_INSERT_RANGE"
1840
- | "FALLOC_FL_UNSHARE_RANGE"
1841
- | "RENAME_NOREPLACE"
1842
- | "RENAME_EXCHANGE"
1843
- | "RENAME_WHITEOUT"
1844
- // ALG_SET_AEAD_* constants are available starting from kernel 3.19
1845
- | "ALG_SET_AEAD_ASSOCLEN"
1846
- | "ALG_SET_AEAD_AUTHSIZE"
1847
- =>
1848
- {
1849
- true
1850
- }
1851
-
1852
- // musl uses old kernel headers
1853
- // These are constants used in getrandom syscall
1854
- // FIXME: is this necessary?
1855
- "GRND_NONBLOCK" | "GRND_RANDOM" => true ,
1856
-
1857
-
1858
- // These constants are tested in a separate test program generated below because there
1859
- // are header conflicts if we try to include the headers that define them here.
1860
- // FIXME: is this necessary?
1861
- "F_CANCELLK" | "F_ADD_SEALS" | "F_GET_SEALS" => true ,
1862
- // FIXME: is this necessary?
1863
- "F_SEAL_SEAL" | "F_SEAL_SHRINK" | "F_SEAL_GROW"
1864
- | "F_SEAL_WRITE" => true ,
1865
- // FIXME: is this necessary?
1866
- "BOTHER" => true ,
1867
-
1868
- // FIXME: is this necessary?
1869
- "MFD_CLOEXEC" | "MFD_ALLOW_SEALING" => true ,
1870
- // MFD_HUGETLB is not available in some older libc versions on the CI builders. On the
1871
- // x86_64 and i686 builders it seems to be available for all targets, so at least test
1872
- // it there.
1873
- // FIXME: is this necessary?
1874
- "MFD_HUGETLB" =>
1875
- {
1876
- true
1877
- }
1878
-
1879
- // These are defined for Solaris 11, but the crate is tested on
1880
- // illumos, where they are currently not defined
1881
- // FIXME: is this necessary?
1882
- "EADI"
1883
- | "PORT_SOURCE_POSTWAIT"
1884
- | "PORT_SOURCE_SIGNAL"
1885
- | "PTHREAD_STACK_MIN" => true ,
1886
-
1887
- // These change all the time from release to release of linux
1888
- // distros, let's just not bother trying to verify them. They
1889
- // shouldn't be used in code anyway...
1890
- // FIXME: is this necessary?
1891
- "AF_MAX" | "PF_MAX" => true ,
1779
+ // FIXME: https://github.com/rust-lang/libc/issues/1272
1780
+ "execv" | "execve" | "execvp" | "execvpe" | "fexecve" => true ,
1892
1781
1893
1782
_ => false ,
1894
1783
}
1895
1784
} ) ;
1896
1785
1897
- cfg. skip_fn ( move |name| {
1898
- // skip those that are manually verified
1786
+ cfg. skip_const ( move |name| {
1899
1787
match name {
1900
- // FIXME: is this necessary?
1901
- "execv" | // crazy stuff with const/mut
1902
- "execve" |
1903
- "execvp" |
1904
- "execvpe" |
1905
- "fexecve" => true ,
1906
-
1907
- "getrlimit" | "getrlimit64" | // non-int in 1st arg
1908
- "setrlimit" | "setrlimit64" | // non-int in 1st arg
1909
- "prlimit" | "prlimit64" | // non-int in 2nd arg
1910
-
1911
- // int vs uint. Sorry musl, your prototype declarations are "correct" in the sense that
1912
- // they match the interface defined by Linux verbatim, but they conflict with other
1913
- // send*/recv* syscalls
1914
- // FIXME: is this necessary?
1915
- "sendmmsg" | "recvmmsg" => true ,
1916
-
1917
- // FIXME: is this necessary?
1918
- "dladdr" => true , // const-ness only added recently
1919
-
1920
- // FIXME: is this necessary?
1921
- "lio_listio" => true ,
1788
+ // FIXME: deprecated - SIGNUNUSED was removed in glibc 2.26
1789
+ // users should use SIGSYS instead
1790
+ "SIGUNUSED" => true ,
1922
1791
1923
- // Definition of those functions as changed since unified headers from NDK r14b
1924
- // These changes imply some API breaking changes but are still ABI compatible.
1925
- // We can wait for the next major release to be compliant with the new API.
1926
- // FIXME: unskip these for next major release
1927
- "strerror_r" | "madvise" | "msync" | "mprotect" | "recvfrom" | "getpriority" |
1792
+ // FIXME: emscripten uses different constants to constructs these
1793
+ n if n. contains ( "__SIZEOF_PTHREAD" ) => true ,
1928
1794
1929
1795
_ => false ,
1930
1796
}
@@ -1966,9 +1832,7 @@ fn test_emscripten(target: &str) {
1966
1832
field == "ssi_arch" ) )
1967
1833
} ) ;
1968
1834
1969
- // FIXME: remove
1970
- cfg. fn_cname ( move |name, _cname| name. to_string ( ) ) ;
1971
-
1835
+ // FIXME: test linux like
1972
1836
cfg. generate ( "../src/lib.rs" , "main.rs" ) ;
1973
1837
}
1974
1838
@@ -2377,17 +2241,19 @@ fn test_linux(target: &str) {
2377
2241
2378
2242
cfg. generate ( "../src/lib.rs" , "main.rs" ) ;
2379
2243
2380
- test_linux_incompatible_apis ( target) ;
2244
+ test_linux_like_apis ( target) ;
2381
2245
}
2382
2246
2383
2247
// This function tests APIs that are incompatible to test when other APIs
2384
2248
// are included (e.g. because including both sets of headers clashes)
2385
- fn test_linux_incompatible_apis ( target : & str ) {
2386
- assert ! ( target. contains( "linux" ) || target. contains( "android" ) ) ;
2249
+ fn test_linux_like_apis ( target : & str ) {
2387
2250
let musl = target. contains ( "musl" ) ;
2388
2251
let linux = target. contains ( "linux" ) ;
2252
+ let emscripten = target. contains ( "emscripten" ) ;
2253
+ let android = target. contains ( "android" ) ;
2254
+ assert ! ( linux || android || emscripten) ;
2389
2255
2390
- {
2256
+ if linux || android || emscripten {
2391
2257
// test strerror_r from the `string.h` header
2392
2258
let mut cfg = ctest:: TestGenerator :: new ( ) ;
2393
2259
cfg. skip_type ( |_| true ) . skip_static ( |_| true ) ;
@@ -2401,7 +2267,8 @@ fn test_linux_incompatible_apis(target: &str) {
2401
2267
. skip_struct ( |_| true ) ;
2402
2268
cfg. generate ( "../src/lib.rs" , "linux_strerror_r.rs" ) ;
2403
2269
}
2404
- {
2270
+
2271
+ if linux || android || emscripten {
2405
2272
// test fcntl - see:
2406
2273
// http://man7.org/linux/man-pages/man2/fcntl.2.html
2407
2274
let mut cfg = ctest:: TestGenerator :: new ( ) ;
@@ -2431,7 +2298,8 @@ fn test_linux_incompatible_apis(target: &str) {
2431
2298
2432
2299
cfg. generate ( "../src/lib.rs" , "linux_fcntl.rs" ) ;
2433
2300
}
2434
- {
2301
+
2302
+ if linux || android {
2435
2303
// test termios
2436
2304
let mut cfg = ctest:: TestGenerator :: new ( ) ;
2437
2305
cfg. header ( "asm/termbits.h" ) ;
@@ -2448,12 +2316,7 @@ fn test_linux_incompatible_apis(target: &str) {
2448
2316
cfg. generate ( "../src/lib.rs" , "linux_termios.rs" ) ;
2449
2317
}
2450
2318
2451
- if !linux {
2452
- return ;
2453
- }
2454
- // linux-only tests (no android):
2455
-
2456
- {
2319
+ if linux || android {
2457
2320
// test IPV6_ constants:
2458
2321
let mut cfg = ctest:: TestGenerator :: new ( ) ;
2459
2322
headers ! {
@@ -2480,7 +2343,8 @@ fn test_linux_incompatible_apis(target: &str) {
2480
2343
} ) ;
2481
2344
cfg. generate ( "../src/lib.rs" , "linux_ipv6.rs" ) ;
2482
2345
}
2483
- {
2346
+
2347
+ if linux || android {
2484
2348
// Test Elf64_Phdr and Elf32_Phdr
2485
2349
// These types have a field called `p_type`, but including
2486
2350
// "resolve.h" defines a `p_type` macro that expands to `__p_type`
0 commit comments