Skip to content

Commit 1675d5e

Browse files
committed
Add rule for nfds_t
This makes the output on macos and linux be the same
1 parent cc70c6c commit 1675d5e

4 files changed

Lines changed: 12 additions & 3 deletions

File tree

‎rules/poll/src.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <poll.h>
55

66
typedef struct pollfd t1;
7+
typedef nfds_t t2;
78

89
int f1(struct pollfd *fds, nfds_t nfds, int timeout) {
910
return poll(fds, nfds, timeout);

‎rules/poll/tgt_unsafe.rs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ fn t1() -> ::libc::pollfd {
55
unsafe { std::mem::zeroed() }
66
}
77

8-
unsafe fn f1(a0: *mut ::libc::pollfd, a1: u64, a2: i32) -> i32 {
8+
fn t2() -> ::libc::nfds_t {
9+
0
10+
}
11+
12+
unsafe fn f1(a0: *mut ::libc::pollfd, a1: ::libc::nfds_t, a2: i32) -> i32 {
913
libc::poll(a0, a1 as ::libc::nfds_t, a2)
1014
}

‎tests/unit/out/refcount/poll.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ fn main_0() -> i32 {
6464
let mut __idx = Vec::new();
6565
let mut __wanted = Vec::new();
6666
let mut __events = Vec::new();
67-
for __i in 0..(2_u64 as usize) {
67+
for __i in 0..((2 as ::libc::nfds_t) as usize) {
6868
let (__fd, __ev) = __p
6969
.offset(__i)
7070
.with(|__e| (*__e.fd.borrow(), *__e.events.borrow()));

‎tests/unit/out/unsafe/poll.rs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ unsafe fn main_0() -> i32 {
2929
pfd[(1) as usize].fd = -1_i32;
3030
pfd[(1) as usize].events = 1_i16;
3131
pfd[(1) as usize].revents = 42_i16;
32-
assert!(((((libc::poll(pfd.as_mut_ptr(), 2_u64 as ::libc::nfds_t, 0)) == (1)) as i32) != 0));
32+
assert!(
33+
((((libc::poll(pfd.as_mut_ptr(), (2 as ::libc::nfds_t) as ::libc::nfds_t, 0)) == (1))
34+
as i32)
35+
!= 0)
36+
);
3337
assert!((((((pfd[(0) as usize].revents as i32) & (1)) != (0)) as i32) != 0));
3438
assert!(((((pfd[(1) as usize].revents as i32) == (0)) as i32) != 0));
3539
let mut ch: libc::c_char = (0 as libc::c_char);

0 commit comments

Comments
 (0)