Skip to content

Commit df70b3f

Browse files
committed
---
yaml --- r: 6199 b: refs/heads/master c: 0f1af17 h: refs/heads/master i: 6197: 8ef0704 6195: 2017129 6191: 9f8b312 v: v3
1 parent 4b1ae88 commit df70b3f

15 files changed

+59
-28
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: a727bbaf70792b0a4315a95ef00ea911d7852be6
2+
refs/heads/master: 0f1af17a6069160f12085841796198e67b6c710f

trunk/src/compiletest/procsrv.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ fn writeclose(fd: int, s: option::t<str>) {
7777
writer.write_str(option::get(s));
7878
}
7979

80-
os::libc::close(fd);
80+
os::close(fd);
8181
}
8282

8383
fn readclose(fd: int) -> str {
@@ -89,7 +89,7 @@ fn readclose(fd: int) -> str {
8989
let bytes = reader.read_bytes(4096u);
9090
buf += str::unsafe_from_bytes(bytes);
9191
}
92-
os::libc::fclose(file);
92+
os::fclose(file);
9393
ret buf;
9494
}
9595

@@ -134,13 +134,13 @@ fn worker(p: port<request>) {
134134
pipe_in.in, pipe_out.out, pipe_err.out);
135135
let pid = maybe_with_lib_path(execparms.lib_path, spawnproc);
136136

137-
os::libc::close(pipe_in.in);
138-
os::libc::close(pipe_out.out);
139-
os::libc::close(pipe_err.out);
137+
os::close(pipe_in.in);
138+
os::close(pipe_out.out);
139+
os::close(pipe_err.out);
140140
if pid == -1 {
141-
os::libc::close(pipe_in.out);
142-
os::libc::close(pipe_out.in);
143-
os::libc::close(pipe_err.in);
141+
os::close(pipe_in.out);
142+
os::close(pipe_out.in);
143+
os::close(pipe_err.in);
144144
fail;
145145
}
146146

trunk/src/lib/linux_os.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ TODO: Restructure and document
66

77
// FIXME Somehow merge stuff duplicated here and macosx_os.rs. Made difficult
88
// by https://github.com/graydon/rust/issues#issue/268
9-
native "cdecl" mod libc = "" {
9+
native "c-stack-cdecl" mod libc = "" {
1010
fn read(fd: int, buf: *u8, count: uint) -> int;
1111
fn write(fd: int, buf: *u8, count: uint) -> int;
1212
fn fread(buf: *u8, size: uint, n: uint, f: libc::FILE) -> uint;
@@ -72,6 +72,14 @@ fn fd_FILE(fd: int) -> libc::FILE {
7272
ret str::as_buf("r", {|modebuf| libc::fdopen(fd, modebuf) });
7373
}
7474

75+
fn close(fd: int) -> int {
76+
libc::close(fd)
77+
}
78+
79+
fn fclose(file: libc::FILE) {
80+
libc::fclose(file)
81+
}
82+
7583
fn waitpid(pid: int) -> int {
7684
let status = 0;
7785
assert (os::libc::waitpid(pid, status, 0) != -1);

trunk/src/lib/macos_os.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
native "cdecl" mod libc = "" {
2+
native "c-stack-cdecl" mod libc = "" {
33
fn read(fd: int, buf: *u8, count: uint) -> int;
44
fn write(fd: int, buf: *u8, count: uint) -> int;
55
fn fread(buf: *u8, size: uint, n: uint, f: libc::FILE) -> uint;
@@ -65,6 +65,14 @@ fn fd_FILE(fd: int) -> libc::FILE {
6565
ret str::as_buf("r", {|modebuf| libc::fdopen(fd, modebuf) });
6666
}
6767

68+
fn close(fd: int) -> int {
69+
libc::close(fd)
70+
}
71+
72+
fn fclose(file: libc::FILE) {
73+
libc::fclose(file)
74+
}
75+
6876
fn waitpid(pid: int) -> int {
6977
let status = 0;
7078
assert (os::libc::waitpid(pid, status, 0) != -1);

trunk/src/lib/unicode.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ mod icu {
148148
// FIXME: should be -1, change when compiler supports negative
149149
// constants
150150

151-
native "cdecl" mod libicu = "icuuc" {
151+
native "c-stack-cdecl" mod libicu = "icuuc" {
152152
fn u_hasBinaryProperty(c: UChar32, which: UProperty) -> UBool;
153153
}
154154
}

trunk/src/lib/win32_os.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
native "cdecl" mod libc = "" {
2+
native "c-stack-cdecl" mod libc = "" {
33
fn read(fd: int, buf: *u8, count: uint) -> int;
44
fn write(fd: int, buf: *u8, count: uint) -> int;
55
fn fread(buf: *u8, size: uint, n: uint, f: libc::FILE) -> uint;
@@ -79,6 +79,14 @@ fn fd_FILE(fd: int) -> libc::FILE {
7979
ret str::as_buf("r", {|modebuf| libc::_fdopen(fd, modebuf) });
8080
}
8181

82+
fn close(fd: int) -> int {
83+
libc::close(fd)
84+
}
85+
86+
fn fclose(file: libc::FILE) {
87+
libc::fclose(file)
88+
}
89+
8290
native "c-stack-cdecl" mod rustrt {
8391
fn rust_process_wait(handle: int) -> int;
8492
fn rust_getcwd() -> str;

trunk/src/test/compile-fail/native-unsafe-fn-called.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// -*- rust -*-
22
// error-pattern: safe function calls function marked unsafe
3-
native "cdecl" mod test {
3+
native "c-stack-cdecl" mod test {
44
unsafe fn free();
55
}
66

trunk/src/test/compile-fail/native-unsafe-fn.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// -*- rust -*-
22
// error-pattern: unsafe functions can only be called
33

4-
native "cdecl" mod test {
4+
native "c-stack-cdecl" mod test {
55
unsafe fn free();
66
}
77

trunk/src/test/run-pass/bind-native.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Can we bind native things?
33
*/
44

5-
native "cdecl" mod rustrt {
5+
native "c-stack-cdecl" mod rustrt {
66
fn task_yield();
77
}
88

trunk/src/test/run-pass/binops.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,17 @@ fn test_fn() {
117117
assert (h1 >= h2);
118118
}
119119

120-
native "cdecl" mod native_mod = "" {
120+
native "c-stack-cdecl" mod native_mod = "" {
121121
fn do_gc();
122122
fn unsupervise();
123123
}
124124

125-
// FIXME: comparison of native fns
125+
// FIXME (#1058): comparison of native fns
126126
fn test_native_fn() {
127+
/*
127128
assert (native_mod::do_gc == native_mod::do_gc);
128129
assert (native_mod::do_gc != native_mod::unsupervise);
130+
*/
129131
}
130132

131133
fn test_obj() {

trunk/src/test/run-pass/import-glob-1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ mod a1 {
2020
// | | |
2121
mod a2 {
2222
// | | |
23-
native "cdecl" mod b1 = "" {
23+
native "c-stack-cdecl" mod b1 = "" {
2424
// | | |
2525
import a1::b2::*;
2626
// | <-/ -/

trunk/src/test/run-pass/issue-506.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
// xfail-test
2+
// FIXME: This test is no longer testing what it was intended to. It should
3+
// be testing spawning of a native function, but is actually testing
4+
// spawning some other function, then executing a native function.
5+
16
/*
27
A reduced test case for Issue #506, provided by Rob Arnold.
38
*/

trunk/src/test/run-pass/native-opaque-type.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22

3-
native "cdecl" mod libc = "" {
3+
native "c-stack-cdecl" mod libc = "" {
44
type file_handle;
55
}
66

trunk/src/test/run-pass/native2.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ native "c-stack-cdecl" mod rustrt {
66

77
native "c-stack-cdecl" mod bar = "" { }
88

9-
native "cdecl" mod zed = "" { }
9+
native "c-stack-cdecl" mod zed = "" { }
1010

11-
native "cdecl" mod libc = "" {
11+
native "c-stack-cdecl" mod libc = "" {
1212
fn write(fd: int, buf: *u8, count: uint) -> int;
1313
}
1414

15-
native "cdecl" mod baz = "" { }
15+
native "c-stack-cdecl" mod baz = "" { }
1616

1717
fn main(args: [str]) { }

trunk/src/test/stdtest/run.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ fn test_pipes() unsafe {
2222

2323
let pid =
2424
run::spawn_process("cat", [], pipe_in.in, pipe_out.out, pipe_err.out);
25-
os::libc::close(pipe_in.in);
26-
os::libc::close(pipe_out.out);
27-
os::libc::close(pipe_err.out);
25+
os::close(pipe_in.in);
26+
os::close(pipe_out.out);
27+
os::close(pipe_err.out);
2828

2929
if pid == -1 { fail; }
3030
let expected = "test";
@@ -41,7 +41,7 @@ fn test_pipes() unsafe {
4141
let writer = io::new_writer(io::fd_buf_writer(fd, option::none));
4242
writer.write_str(s);
4343

44-
os::libc::close(fd);
44+
os::close(fd);
4545
}
4646

4747
fn readclose(fd: int) -> str unsafe {
@@ -53,7 +53,7 @@ fn test_pipes() unsafe {
5353
let bytes = reader.read_bytes(4096u);
5454
buf += str::unsafe_from_bytes(bytes);
5555
}
56-
os::libc::fclose(file);
56+
os::fclose(file);
5757
ret buf;
5858
}
5959
}

0 commit comments

Comments
 (0)