Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions rules/ip/ir_unsafe.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,25 @@
"return_type": {
"type": "i32"
}
},
"f4": {
"body": [
{
"text": "libc::IPPROTO_IPV6"
}
],
"return_type": {
"type": "i32"
}
},
"f5": {
"body": [
{
"text": "libc::IPPROTO_MPTCP"
}
],
"return_type": {
"type": "i32"
}
}
}
10 changes: 10 additions & 0 deletions rules/ip/src.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,13 @@ int f2() {
int f3() {
return IPPROTO_IP;
}

int f4() {
return IPPROTO_IPV6;
}

#if defined(__linux__)
int f5() {
return IPPROTO_MPTCP;
}
#endif
8 changes: 8 additions & 0 deletions rules/ip/tgt_unsafe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,11 @@ unsafe fn f2() -> i32 {
unsafe fn f3() -> i32 {
libc::IPPROTO_IP
}

unsafe fn f4() -> i32 {
libc::IPPROTO_IPV6
}

unsafe fn f5() -> i32 {
libc::IPPROTO_MPTCP
}
4 changes: 3 additions & 1 deletion tests/unit/ipproto_macros.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ int main() {
int tcp = IPPROTO_TCP;
int udp = IPPROTO_UDP;
int ip = IPPROTO_IP;
return tcp + udp + ip;
int ip6 = IPPROTO_IPV6;
int mptcp = IPPROTO_MPTCP;
return tcp + udp + ip + ip6 + mptcp;
}
5 changes: 4 additions & 1 deletion tests/unit/out/refcount/ipproto_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@ fn main_0() -> i32 {
let tcp: Value<i32> = Rc::new(RefCell::new(libc::IPPROTO_TCP));
let udp: Value<i32> = Rc::new(RefCell::new(libc::IPPROTO_UDP));
let ip: Value<i32> = Rc::new(RefCell::new(libc::IPPROTO_IP));
return (((*tcp.borrow()) + (*udp.borrow())) + (*ip.borrow()));
let ip6: Value<i32> = Rc::new(RefCell::new(libc::IPPROTO_IPV6));
let mptcp: Value<i32> = Rc::new(RefCell::new(libc::IPPROTO_MPTCP));
return (((((*tcp.borrow()) + (*udp.borrow())) + (*ip.borrow())) + (*ip6.borrow()))
+ (*mptcp.borrow()));
}
4 changes: 3 additions & 1 deletion tests/unit/out/unsafe/ipproto_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ unsafe fn main_0() -> i32 {
let mut tcp: i32 = libc::IPPROTO_TCP;
let mut udp: i32 = libc::IPPROTO_UDP;
let mut ip: i32 = libc::IPPROTO_IP;
return (((tcp) + (udp)) + (ip));
let mut ip6: i32 = libc::IPPROTO_IPV6;
let mut mptcp: i32 = libc::IPPROTO_MPTCP;
return (((((tcp) + (udp)) + (ip)) + (ip6)) + (mptcp));
}
Loading