Skip to content

Commit 08caf3a

Browse files
committed
Only keep socket_type values shared between Linux and macOS
1 parent 40bc270 commit 08caf3a

6 files changed

Lines changed: 4 additions & 109 deletions

File tree

rules/socket/ir_unsafe.json

Lines changed: 2 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,6 @@
99
"type": "i32"
1010
}
1111
},
12-
"f10": {
13-
"body": [
14-
{
15-
"text": "libc::SOCK_NONBLOCK"
16-
}
17-
],
18-
"return_type": {
19-
"type": "i32"
20-
}
21-
},
2212
"f2": {
2313
"body": [
2414
{
@@ -42,7 +32,7 @@
4232
"f4": {
4333
"body": [
4434
{
45-
"text": "libc::SOCK_RAW"
35+
"text": "libc::SOCK_CLOEXEC"
4636
}
4737
],
4838
"return_type": {
@@ -52,47 +42,7 @@
5242
"f5": {
5343
"body": [
5444
{
55-
"text": "libc::SOCK_RDM"
56-
}
57-
],
58-
"return_type": {
59-
"type": "i32"
60-
}
61-
},
62-
"f6": {
63-
"body": [
64-
{
65-
"text": "libc::SOCK_SEQPACKET"
66-
}
67-
],
68-
"return_type": {
69-
"type": "i32"
70-
}
71-
},
72-
"f7": {
73-
"body": [
74-
{
75-
"text": "libc::SOCK_DCCP"
76-
}
77-
],
78-
"return_type": {
79-
"type": "i32"
80-
}
81-
},
82-
"f8": {
83-
"body": [
84-
{
85-
"text": "libc::SOCK_PACKET"
86-
}
87-
],
88-
"return_type": {
89-
"type": "i32"
90-
}
91-
},
92-
"f9": {
93-
"body": [
94-
{
95-
"text": "libc::SOCK_CLOEXEC"
45+
"text": "libc::SOCK_NONBLOCK"
9646
}
9747
],
9848
"return_type": {

rules/socket/src.cpp

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,9 @@ int f3() {
1414
}
1515

1616
int f4() {
17-
return SOCK_RAW;
18-
}
19-
20-
int f5() {
21-
return SOCK_RDM;
22-
}
23-
24-
int f6() {
25-
return SOCK_SEQPACKET;
26-
}
27-
28-
int f7() {
29-
return SOCK_DCCP;
30-
}
31-
32-
int f8() {
33-
return SOCK_PACKET;
34-
}
35-
36-
int f9() {
3717
return SOCK_CLOEXEC;
3818
}
3919

40-
int f10() {
20+
int f5() {
4121
return SOCK_NONBLOCK;
4222
}

rules/socket/tgt_unsafe.rs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,9 @@ unsafe fn f3() -> i32 {
1111
}
1212

1313
unsafe fn f4() -> i32 {
14-
libc::SOCK_RAW
15-
}
16-
17-
unsafe fn f5() -> i32 {
18-
libc::SOCK_RDM
19-
}
20-
21-
unsafe fn f6() -> i32 {
22-
libc::SOCK_SEQPACKET
23-
}
24-
25-
unsafe fn f7() -> i32 {
26-
libc::SOCK_DCCP
27-
}
28-
29-
unsafe fn f8() -> i32 {
30-
libc::SOCK_PACKET
31-
}
32-
33-
unsafe fn f9() -> i32 {
3414
libc::SOCK_CLOEXEC
3515
}
3616

37-
unsafe fn f10() -> i32 {
17+
unsafe fn f5() -> i32 {
3818
libc::SOCK_NONBLOCK
3919
}

tests/unit/out/refcount/socket_type_constants.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ pub fn main() {
1212
fn main_0() -> i32 {
1313
assert!((((libc::SOCK_STREAM == 1) as i32) != 0));
1414
assert!((((libc::SOCK_DGRAM == 2) as i32) != 0));
15-
assert!((((libc::SOCK_RAW == 3) as i32) != 0));
16-
assert!((((libc::SOCK_RDM == 4) as i32) != 0));
17-
assert!((((libc::SOCK_SEQPACKET == 5) as i32) != 0));
18-
assert!((((libc::SOCK_DCCP == 6) as i32) != 0));
19-
assert!((((libc::SOCK_PACKET == 10) as i32) != 0));
2015
let x: Value<i32> = Rc::new(RefCell::new((libc::SOCK_STREAM | libc::SOCK_CLOEXEC)));
2116
assert!((((((*x.borrow()) & libc::SOCK_STREAM) == libc::SOCK_STREAM) as i32) != 0));
2217
assert!((((((*x.borrow()) & libc::SOCK_CLOEXEC) == libc::SOCK_CLOEXEC) as i32) != 0));

tests/unit/out/unsafe/socket_type_constants.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ pub fn main() {
1414
unsafe fn main_0() -> i32 {
1515
assert!(((((libc::SOCK_STREAM) == (1)) as i32) != 0));
1616
assert!(((((libc::SOCK_DGRAM) == (2)) as i32) != 0));
17-
assert!(((((libc::SOCK_RAW) == (3)) as i32) != 0));
18-
assert!(((((libc::SOCK_RDM) == (4)) as i32) != 0));
19-
assert!(((((libc::SOCK_SEQPACKET) == (5)) as i32) != 0));
20-
assert!(((((libc::SOCK_DCCP) == (6)) as i32) != 0));
21-
assert!(((((libc::SOCK_PACKET) == (10)) as i32) != 0));
2217
let mut x: i32 = ((libc::SOCK_STREAM) | (libc::SOCK_CLOEXEC));
2318
assert!((((((x) & (libc::SOCK_STREAM)) == (libc::SOCK_STREAM)) as i32) != 0));
2419
assert!((((((x) & (libc::SOCK_CLOEXEC)) == (libc::SOCK_CLOEXEC)) as i32) != 0));

tests/unit/socket_type_constants.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55
int main() {
66
assert(SOCK_STREAM == 1);
77
assert(SOCK_DGRAM == 2);
8-
assert(SOCK_RAW == 3);
9-
assert(SOCK_RDM == 4);
10-
assert(SOCK_SEQPACKET == 5);
11-
assert(SOCK_DCCP == 6);
12-
assert(SOCK_PACKET == 10);
138

149
int x = SOCK_STREAM | SOCK_CLOEXEC;
1510
assert((x & SOCK_STREAM) == SOCK_STREAM);

0 commit comments

Comments
 (0)