librustc: Disallow "unsafe" for external functions
This commit is contained in:
parent
887c656970
commit
9457ebee55
36 changed files with 1709 additions and 1829 deletions
|
@ -25,13 +25,13 @@ pub mod rustrt {
|
|||
|
||||
#[link_name = "rustrt"]
|
||||
extern {
|
||||
pub unsafe fn tdefl_compress_mem_to_heap(psrc_buf: *const c_void,
|
||||
pub fn tdefl_compress_mem_to_heap(psrc_buf: *const c_void,
|
||||
src_buf_len: size_t,
|
||||
pout_len: *mut size_t,
|
||||
flags: c_int)
|
||||
-> *c_void;
|
||||
|
||||
pub unsafe fn tinfl_decompress_mem_to_heap(psrc_buf: *const c_void,
|
||||
pub fn tinfl_decompress_mem_to_heap(psrc_buf: *const c_void,
|
||||
src_buf_len: size_t,
|
||||
pout_len: *mut size_t,
|
||||
flags: c_int)
|
||||
|
|
|
@ -20,13 +20,13 @@ pub mod rustrt {
|
|||
use std::libc::{c_char, c_int};
|
||||
|
||||
extern {
|
||||
pub unsafe fn linenoise(prompt: *c_char) -> *c_char;
|
||||
pub unsafe fn linenoiseHistoryAdd(line: *c_char) -> c_int;
|
||||
pub unsafe fn linenoiseHistorySetMaxLen(len: c_int) -> c_int;
|
||||
pub unsafe fn linenoiseHistorySave(file: *c_char) -> c_int;
|
||||
pub unsafe fn linenoiseHistoryLoad(file: *c_char) -> c_int;
|
||||
pub unsafe fn linenoiseSetCompletionCallback(callback: *u8);
|
||||
pub unsafe fn linenoiseAddCompletion(completions: *(), line: *c_char);
|
||||
pub fn linenoise(prompt: *c_char) -> *c_char;
|
||||
pub fn linenoiseHistoryAdd(line: *c_char) -> c_int;
|
||||
pub fn linenoiseHistorySetMaxLen(len: c_int) -> c_int;
|
||||
pub fn linenoiseHistorySave(file: *c_char) -> c_int;
|
||||
pub fn linenoiseHistoryLoad(file: *c_char) -> c_int;
|
||||
pub fn linenoiseSetCompletionCallback(callback: *u8);
|
||||
pub fn linenoiseAddCompletion(completions: *(), line: *c_char);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,16 +23,13 @@ pub mod rustrt {
|
|||
|
||||
#[abi = "cdecl"]
|
||||
extern {
|
||||
pub unsafe fn get_time(sec: &mut i64, nsec: &mut i32);
|
||||
|
||||
pub unsafe fn precise_time_ns(ns: &mut u64);
|
||||
|
||||
pub unsafe fn rust_tzset();
|
||||
|
||||
pub unsafe fn rust_gmtime(sec: i64, nsec: i32, result: &mut Tm);
|
||||
pub unsafe fn rust_localtime(sec: i64, nsec: i32, result: &mut Tm);
|
||||
pub unsafe fn rust_timegm(tm: &Tm) -> i64;
|
||||
pub unsafe fn rust_mktime(tm: &Tm) -> i64;
|
||||
pub fn get_time(sec: &mut i64, nsec: &mut i32);
|
||||
pub fn precise_time_ns(ns: &mut u64);
|
||||
pub fn rust_tzset();
|
||||
pub fn rust_gmtime(sec: i64, nsec: i32, result: &mut Tm);
|
||||
pub fn rust_localtime(sec: i64, nsec: i32, result: &mut Tm);
|
||||
pub fn rust_timegm(tm: &Tm) -> i64;
|
||||
pub fn rust_mktime(tm: &Tm) -> i64;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -162,14 +162,13 @@ pub mod icu {
|
|||
#[link_name = "icuuc"]
|
||||
#[abi = "cdecl"]
|
||||
extern {
|
||||
pub unsafe fn u_hasBinaryProperty(c: UChar32, which: UProperty)
|
||||
-> UBool;
|
||||
pub unsafe fn u_isdigit(c: UChar32) -> UBool;
|
||||
pub unsafe fn u_islower(c: UChar32) -> UBool;
|
||||
pub unsafe fn u_isspace(c: UChar32) -> UBool;
|
||||
pub unsafe fn u_isupper(c: UChar32) -> UBool;
|
||||
pub unsafe fn u_tolower(c: UChar32) -> UChar32;
|
||||
pub unsafe fn u_toupper(c: UChar32) -> UChar32;
|
||||
pub fn u_hasBinaryProperty(c: UChar32, which: UProperty) -> UBool;
|
||||
pub fn u_isdigit(c: UChar32) -> UBool;
|
||||
pub fn u_islower(c: UChar32) -> UBool;
|
||||
pub fn u_isspace(c: UChar32) -> UBool;
|
||||
pub fn u_isupper(c: UChar32) -> UBool;
|
||||
pub fn u_tolower(c: UChar32) -> UChar32;
|
||||
pub fn u_toupper(c: UChar32) -> UChar32;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1151,9 +1151,9 @@ fn encode_info_for_foreign_item(ecx: &EncodeContext,
|
|||
|
||||
ebml_w.start_tag(tag_items_data_item);
|
||||
match nitem.node {
|
||||
foreign_item_fn(_, purity, _) => {
|
||||
foreign_item_fn(*) => {
|
||||
encode_def_id(ebml_w, local_def(nitem.id));
|
||||
encode_family(ebml_w, purity_fn_family(purity));
|
||||
encode_family(ebml_w, purity_fn_family(impure_fn));
|
||||
encode_bounds_and_type(ebml_w, ecx,
|
||||
&lookup_item_type(ecx.tcx,local_def(nitem.id)));
|
||||
encode_name(ecx, ebml_w, nitem.ident);
|
||||
|
|
|
@ -789,7 +789,7 @@ fn check_item_ctypes(cx: &Context, it: &ast::item) {
|
|||
ast::item_foreign_mod(ref nmod) if !nmod.abis.is_intrinsic() => {
|
||||
foreach ni in nmod.items.iter() {
|
||||
match ni.node {
|
||||
ast::foreign_item_fn(ref decl, _, _) => {
|
||||
ast::foreign_item_fn(ref decl, _) => {
|
||||
check_foreign_fn(cx, decl);
|
||||
}
|
||||
ast::foreign_item_static(ref t, _) => { check_ty(cx, t); }
|
||||
|
|
|
@ -1523,7 +1523,7 @@ impl Resolver {
|
|||
foreign_item.span);
|
||||
|
||||
match foreign_item.node {
|
||||
foreign_item_fn(_, _, ref generics) => {
|
||||
foreign_item_fn(_, ref generics) => {
|
||||
let def = def_fn(local_def(foreign_item.id), unsafe_fn);
|
||||
name_bindings.define_value(Public, def, foreign_item.span);
|
||||
|
||||
|
@ -3606,7 +3606,7 @@ impl Resolver {
|
|||
do self.with_scope(Some(item.ident)) {
|
||||
foreach foreign_item in foreign_module.items.iter() {
|
||||
match foreign_item.node {
|
||||
foreign_item_fn(_, _, ref generics) => {
|
||||
foreign_item_fn(_, ref generics) => {
|
||||
self.with_type_parameter_rib(
|
||||
HasTypeParameters(
|
||||
generics, foreign_item.id, 0,
|
||||
|
|
|
@ -1137,7 +1137,7 @@ pub fn ty_of_foreign_item(ccx: &CrateCtxt,
|
|||
abis: AbiSet) -> ty::ty_param_bounds_and_ty
|
||||
{
|
||||
match it.node {
|
||||
ast::foreign_item_fn(ref fn_decl, _, ref generics) => {
|
||||
ast::foreign_item_fn(ref fn_decl, ref generics) => {
|
||||
ty_of_foreign_fn_decl(ccx,
|
||||
fn_decl,
|
||||
local_def(it.id),
|
||||
|
|
|
@ -69,12 +69,23 @@ fn get_fn_sig(srv: astsrv::Srv, fn_id: doc::AstId) -> Option<~str> {
|
|||
ast_map::node_item(@ast::item {
|
||||
ident: ident,
|
||||
node: ast::item_fn(ref decl, purity, _, ref tys, _), _
|
||||
}, _) |
|
||||
}, _) => {
|
||||
Some(pprust::fun_to_str(decl,
|
||||
purity,
|
||||
ident,
|
||||
None,
|
||||
tys,
|
||||
token::get_ident_interner()))
|
||||
}
|
||||
ast_map::node_foreign_item(@ast::foreign_item {
|
||||
ident: ident,
|
||||
node: ast::foreign_item_fn(ref decl, purity, ref tys), _
|
||||
node: ast::foreign_item_fn(ref decl, ref tys), _
|
||||
}, _, _, _) => {
|
||||
Some(pprust::fun_to_str(decl, purity, ident, None, tys,
|
||||
Some(pprust::fun_to_str(decl,
|
||||
ast::impure_fn,
|
||||
ident,
|
||||
None,
|
||||
tys,
|
||||
token::get_ident_interner()))
|
||||
}
|
||||
_ => fail!("get_fn_sig: fn_id not bound to a fn item")
|
||||
|
|
|
@ -156,6 +156,6 @@ pub mod rustrt {
|
|||
extern {
|
||||
#[rust_stack]
|
||||
// FIXME (#4386): Unable to make following method private.
|
||||
pub unsafe fn rust_get_task() -> *c_void;
|
||||
pub fn rust_get_task() -> *c_void;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,10 +66,10 @@ pub mod rustrt {
|
|||
#[link_name = "rustrt"]
|
||||
extern {
|
||||
#[rust_stack]
|
||||
pub unsafe fn rust_gc_metadata() -> *Word;
|
||||
pub fn rust_gc_metadata() -> *Word;
|
||||
|
||||
pub unsafe fn rust_get_stack_segment() -> *StackSegment;
|
||||
pub unsafe fn rust_get_c_stack() -> *StackSegment;
|
||||
pub fn rust_get_stack_segment() -> *StackSegment;
|
||||
pub fn rust_get_c_stack() -> *StackSegment;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -77,9 +77,9 @@ pub mod rustrt {
|
|||
#[abi = "cdecl"]
|
||||
#[link_name = "rustrt"]
|
||||
extern {
|
||||
pub unsafe fn rust_get_stdin() -> *libc::FILE;
|
||||
pub unsafe fn rust_get_stdout() -> *libc::FILE;
|
||||
pub unsafe fn rust_get_stderr() -> *libc::FILE;
|
||||
pub fn rust_get_stdin() -> *libc::FILE;
|
||||
pub fn rust_get_stdout() -> *libc::FILE;
|
||||
pub fn rust_get_stderr() -> *libc::FILE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2400,19 +2400,19 @@ pub mod funcs {
|
|||
use libc::types::os::arch::c95::{c_char, c_int};
|
||||
|
||||
extern {
|
||||
pub unsafe fn isalnum(c: c_int) -> c_int;
|
||||
pub unsafe fn isalpha(c: c_int) -> c_int;
|
||||
pub unsafe fn iscntrl(c: c_int) -> c_int;
|
||||
pub unsafe fn isdigit(c: c_int) -> c_int;
|
||||
pub unsafe fn isgraph(c: c_int) -> c_int;
|
||||
pub unsafe fn islower(c: c_int) -> c_int;
|
||||
pub unsafe fn isprint(c: c_int) -> c_int;
|
||||
pub unsafe fn ispunct(c: c_int) -> c_int;
|
||||
pub unsafe fn isspace(c: c_int) -> c_int;
|
||||
pub unsafe fn isupper(c: c_int) -> c_int;
|
||||
pub unsafe fn isxdigit(c: c_int) -> c_int;
|
||||
pub unsafe fn tolower(c: c_char) -> c_char;
|
||||
pub unsafe fn toupper(c: c_char) -> c_char;
|
||||
pub fn isalnum(c: c_int) -> c_int;
|
||||
pub fn isalpha(c: c_int) -> c_int;
|
||||
pub fn iscntrl(c: c_int) -> c_int;
|
||||
pub fn isdigit(c: c_int) -> c_int;
|
||||
pub fn isgraph(c: c_int) -> c_int;
|
||||
pub fn islower(c: c_int) -> c_int;
|
||||
pub fn isprint(c: c_int) -> c_int;
|
||||
pub fn ispunct(c: c_int) -> c_int;
|
||||
pub fn isspace(c: c_int) -> c_int;
|
||||
pub fn isupper(c: c_int) -> c_int;
|
||||
pub fn isxdigit(c: c_int) -> c_int;
|
||||
pub fn tolower(c: c_char) -> c_char;
|
||||
pub fn toupper(c: c_char) -> c_char;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2423,66 +2423,58 @@ pub mod funcs {
|
|||
use libc::types::os::arch::c95::{c_char, c_int, c_long, size_t};
|
||||
|
||||
extern {
|
||||
pub unsafe fn fopen(filename: *c_char, mode: *c_char)
|
||||
pub fn fopen(filename: *c_char, mode: *c_char) -> *FILE;
|
||||
pub fn freopen(filename: *c_char, mode: *c_char, file: *FILE)
|
||||
-> *FILE;
|
||||
pub unsafe fn freopen(filename: *c_char,
|
||||
mode: *c_char,
|
||||
file: *FILE)
|
||||
-> *FILE;
|
||||
pub unsafe fn fflush(file: *FILE) -> c_int;
|
||||
pub unsafe fn fclose(file: *FILE) -> c_int;
|
||||
pub unsafe fn remove(filename: *c_char) -> c_int;
|
||||
pub unsafe fn rename(oldname: *c_char, newname: *c_char)
|
||||
-> c_int;
|
||||
pub unsafe fn tmpfile() -> *FILE;
|
||||
pub unsafe fn setvbuf(stream: *FILE,
|
||||
pub fn fflush(file: *FILE) -> c_int;
|
||||
pub fn fclose(file: *FILE) -> c_int;
|
||||
pub fn remove(filename: *c_char) -> c_int;
|
||||
pub fn rename(oldname: *c_char, newname: *c_char) -> c_int;
|
||||
pub fn tmpfile() -> *FILE;
|
||||
pub fn setvbuf(stream: *FILE,
|
||||
buffer: *c_char,
|
||||
mode: c_int,
|
||||
size: size_t)
|
||||
-> c_int;
|
||||
pub unsafe fn setbuf(stream: *FILE, buf: *c_char);
|
||||
pub fn setbuf(stream: *FILE, buf: *c_char);
|
||||
// Omitted: printf and scanf variants.
|
||||
pub unsafe fn fgetc(stream: *FILE) -> c_int;
|
||||
pub fn fgetc(stream: *FILE) -> c_int;
|
||||
#[fast_ffi]
|
||||
pub unsafe fn fgets(buf: *mut c_char,
|
||||
n: c_int,
|
||||
stream: *FILE)
|
||||
pub fn fgets(buf: *mut c_char, n: c_int, stream: *FILE)
|
||||
-> *c_char;
|
||||
#[fast_ffi]
|
||||
pub unsafe fn fputc(c: c_int, stream: *FILE) -> c_int;
|
||||
pub fn fputc(c: c_int, stream: *FILE) -> c_int;
|
||||
#[fast_ffi]
|
||||
pub unsafe fn fputs(s: *c_char, stream: *FILE) -> *c_char;
|
||||
pub fn fputs(s: *c_char, stream: *FILE) -> *c_char;
|
||||
// Omitted: getc, getchar (might be macros).
|
||||
|
||||
// Omitted: gets, so ridiculously unsafe that it should not
|
||||
// survive.
|
||||
|
||||
// Omitted: putc, putchar (might be macros).
|
||||
pub unsafe fn puts(s: *c_char) -> c_int;
|
||||
pub unsafe fn ungetc(c: c_int, stream: *FILE) -> c_int;
|
||||
pub fn puts(s: *c_char) -> c_int;
|
||||
pub fn ungetc(c: c_int, stream: *FILE) -> c_int;
|
||||
#[fast_ffi]
|
||||
pub unsafe fn fread(ptr: *mut c_void,
|
||||
pub fn fread(ptr: *mut c_void,
|
||||
size: size_t,
|
||||
nobj: size_t,
|
||||
stream: *FILE)
|
||||
-> size_t;
|
||||
#[fast_ffi]
|
||||
pub unsafe fn fwrite(ptr: *c_void,
|
||||
pub fn fwrite(ptr: *c_void,
|
||||
size: size_t,
|
||||
nobj: size_t,
|
||||
stream: *FILE)
|
||||
-> size_t;
|
||||
pub unsafe fn fseek(stream: *FILE,
|
||||
offset: c_long,
|
||||
whence: c_int)
|
||||
pub fn fseek(stream: *FILE, offset: c_long, whence: c_int)
|
||||
-> c_int;
|
||||
pub unsafe fn ftell(stream: *FILE) -> c_long;
|
||||
pub unsafe fn rewind(stream: *FILE);
|
||||
pub unsafe fn fgetpos(stream: *FILE, ptr: *fpos_t) -> c_int;
|
||||
pub unsafe fn fsetpos(stream: *FILE, ptr: *fpos_t) -> c_int;
|
||||
pub unsafe fn feof(stream: *FILE) -> c_int;
|
||||
pub unsafe fn ferror(stream: *FILE) -> c_int;
|
||||
pub unsafe fn perror(s: *c_char);
|
||||
pub fn ftell(stream: *FILE) -> c_long;
|
||||
pub fn rewind(stream: *FILE);
|
||||
pub fn fgetpos(stream: *FILE, ptr: *fpos_t) -> c_int;
|
||||
pub fn fsetpos(stream: *FILE, ptr: *fpos_t) -> c_int;
|
||||
pub fn feof(stream: *FILE) -> c_int;
|
||||
pub fn ferror(stream: *FILE) -> c_int;
|
||||
pub fn perror(s: *c_char);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2495,33 +2487,32 @@ pub mod funcs {
|
|||
use libc::types::os::arch::c95::{size_t};
|
||||
|
||||
extern {
|
||||
pub unsafe fn abs(i: c_int) -> c_int;
|
||||
pub unsafe fn labs(i: c_long) -> c_long;
|
||||
pub fn abs(i: c_int) -> c_int;
|
||||
pub fn labs(i: c_long) -> c_long;
|
||||
// Omitted: div, ldiv (return pub type incomplete).
|
||||
pub unsafe fn atof(s: *c_char) -> c_double;
|
||||
pub unsafe fn atoi(s: *c_char) -> c_int;
|
||||
pub unsafe fn strtod(s: *c_char, endp: **c_char) -> c_double;
|
||||
pub unsafe fn strtol(s: *c_char, endp: **c_char, base: c_int)
|
||||
pub fn atof(s: *c_char) -> c_double;
|
||||
pub fn atoi(s: *c_char) -> c_int;
|
||||
pub fn strtod(s: *c_char, endp: **c_char) -> c_double;
|
||||
pub fn strtol(s: *c_char, endp: **c_char, base: c_int)
|
||||
-> c_long;
|
||||
pub unsafe fn strtoul(s: *c_char, endp: **c_char, base: c_int)
|
||||
pub fn strtoul(s: *c_char, endp: **c_char, base: c_int)
|
||||
-> c_ulong;
|
||||
#[fast_ffi]
|
||||
pub unsafe fn calloc(nobj: size_t, size: size_t) -> *c_void;
|
||||
pub fn calloc(nobj: size_t, size: size_t) -> *c_void;
|
||||
#[fast_ffi]
|
||||
pub unsafe fn malloc(size: size_t) -> *c_void;
|
||||
pub fn malloc(size: size_t) -> *c_void;
|
||||
#[fast_ffi]
|
||||
pub unsafe fn realloc(p: *mut c_void, size: size_t)
|
||||
-> *mut c_void;
|
||||
pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
|
||||
#[fast_ffi]
|
||||
pub unsafe fn free(p: *c_void);
|
||||
pub unsafe fn abort() -> !;
|
||||
pub unsafe fn exit(status: c_int) -> !;
|
||||
pub fn free(p: *c_void);
|
||||
pub fn abort() -> !;
|
||||
pub fn exit(status: c_int) -> !;
|
||||
// Omitted: atexit.
|
||||
pub unsafe fn system(s: *c_char) -> c_int;
|
||||
pub unsafe fn getenv(s: *c_char) -> *c_char;
|
||||
pub fn system(s: *c_char) -> c_int;
|
||||
pub fn getenv(s: *c_char) -> *c_char;
|
||||
// Omitted: bsearch, qsort
|
||||
pub unsafe fn rand() -> c_int;
|
||||
pub unsafe fn srand(seed: c_uint);
|
||||
pub fn rand() -> c_int;
|
||||
pub fn srand(seed: c_uint);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2533,28 +2524,25 @@ pub mod funcs {
|
|||
use libc::types::os::arch::c95::{wchar_t};
|
||||
|
||||
extern {
|
||||
pub unsafe fn strcpy(dst: *c_char, src: *c_char) -> *c_char;
|
||||
pub unsafe fn strncpy(dst: *c_char, src: *c_char, n: size_t)
|
||||
pub fn strcpy(dst: *c_char, src: *c_char) -> *c_char;
|
||||
pub fn strncpy(dst: *c_char, src: *c_char, n: size_t)
|
||||
-> *c_char;
|
||||
pub unsafe fn strcat(s: *c_char, ct: *c_char) -> *c_char;
|
||||
pub unsafe fn strncat(s: *c_char, ct: *c_char, n: size_t)
|
||||
-> *c_char;
|
||||
pub unsafe fn strcmp(cs: *c_char, ct: *c_char) -> c_int;
|
||||
pub unsafe fn strncmp(cs: *c_char, ct: *c_char, n: size_t)
|
||||
-> c_int;
|
||||
pub unsafe fn strcoll(cs: *c_char, ct: *c_char) -> c_int;
|
||||
pub unsafe fn strchr(cs: *c_char, c: c_int) -> *c_char;
|
||||
pub unsafe fn strrchr(cs: *c_char, c: c_int) -> *c_char;
|
||||
pub unsafe fn strspn(cs: *c_char, ct: *c_char) -> size_t;
|
||||
pub unsafe fn strcspn(cs: *c_char, ct: *c_char) -> size_t;
|
||||
pub unsafe fn strpbrk(cs: *c_char, ct: *c_char) -> *c_char;
|
||||
pub unsafe fn strstr(cs: *c_char, ct: *c_char) -> *c_char;
|
||||
pub unsafe fn strlen(cs: *c_char) -> size_t;
|
||||
pub unsafe fn strerror(n: c_int) -> *c_char;
|
||||
pub unsafe fn strtok(s: *c_char, t: *c_char) -> *c_char;
|
||||
pub unsafe fn strxfrm(s: *c_char, ct: *c_char, n: size_t)
|
||||
-> size_t;
|
||||
pub unsafe fn wcslen(buf: *wchar_t) -> size_t;
|
||||
pub fn strcat(s: *c_char, ct: *c_char) -> *c_char;
|
||||
pub fn strncat(s: *c_char, ct: *c_char, n: size_t) -> *c_char;
|
||||
pub fn strcmp(cs: *c_char, ct: *c_char) -> c_int;
|
||||
pub fn strncmp(cs: *c_char, ct: *c_char, n: size_t) -> c_int;
|
||||
pub fn strcoll(cs: *c_char, ct: *c_char) -> c_int;
|
||||
pub fn strchr(cs: *c_char, c: c_int) -> *c_char;
|
||||
pub fn strrchr(cs: *c_char, c: c_int) -> *c_char;
|
||||
pub fn strspn(cs: *c_char, ct: *c_char) -> size_t;
|
||||
pub fn strcspn(cs: *c_char, ct: *c_char) -> size_t;
|
||||
pub fn strpbrk(cs: *c_char, ct: *c_char) -> *c_char;
|
||||
pub fn strstr(cs: *c_char, ct: *c_char) -> *c_char;
|
||||
pub fn strlen(cs: *c_char) -> size_t;
|
||||
pub fn strerror(n: c_int) -> *c_char;
|
||||
pub fn strtok(s: *c_char, t: *c_char) -> *c_char;
|
||||
pub fn strxfrm(s: *c_char, ct: *c_char, n: size_t) -> size_t;
|
||||
pub fn wcslen(buf: *wchar_t) -> size_t;
|
||||
|
||||
// Omitted: memcpy, memmove, memset (provided by LLVM)
|
||||
|
||||
|
@ -2562,12 +2550,10 @@ pub mod funcs {
|
|||
// in fact, because LLVM generates calls to them!
|
||||
#[rust_stack]
|
||||
#[inline]
|
||||
pub unsafe fn memcmp(cx: *c_void, ct: *c_void, n: size_t)
|
||||
-> c_int;
|
||||
pub fn memcmp(cx: *c_void, ct: *c_void, n: size_t) -> c_int;
|
||||
#[rust_stack]
|
||||
#[inline]
|
||||
pub unsafe fn memchr(cx: *c_void, c: c_int, n: size_t)
|
||||
-> *c_void;
|
||||
pub fn memchr(cx: *c_void, c: c_int, n: size_t) -> *c_void;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2588,16 +2574,13 @@ pub mod funcs {
|
|||
|
||||
extern {
|
||||
#[link_name = "_chmod"]
|
||||
pub unsafe fn chmod(path: *c_char, mode: c_int) -> c_int;
|
||||
|
||||
pub fn chmod(path: *c_char, mode: c_int) -> c_int;
|
||||
#[link_name = "_mkdir"]
|
||||
pub unsafe fn mkdir(path: *c_char) -> c_int;
|
||||
|
||||
pub fn mkdir(path: *c_char) -> c_int;
|
||||
#[link_name = "_fstat64"]
|
||||
pub unsafe fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
|
||||
|
||||
pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
|
||||
#[link_name = "_stat64"]
|
||||
pub unsafe fn stat(path: *c_char, buf: *mut stat) -> c_int;
|
||||
pub fn stat(path: *c_char, buf: *mut stat) -> c_int;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2609,17 +2592,14 @@ pub mod funcs {
|
|||
|
||||
extern {
|
||||
#[link_name = "_popen"]
|
||||
pub unsafe fn popen(command: *c_char, mode: *c_char) -> *FILE;
|
||||
|
||||
pub fn popen(command: *c_char, mode: *c_char) -> *FILE;
|
||||
#[link_name = "_pclose"]
|
||||
pub unsafe fn pclose(stream: *FILE) -> c_int;
|
||||
|
||||
pub fn pclose(stream: *FILE) -> c_int;
|
||||
#[link_name = "_fdopen"]
|
||||
#[fast_ffi]
|
||||
pub unsafe fn fdopen(fd: c_int, mode: *c_char) -> *FILE;
|
||||
|
||||
pub fn fdopen(fd: c_int, mode: *c_char) -> *FILE;
|
||||
#[link_name = "_fileno"]
|
||||
pub unsafe fn fileno(stream: *FILE) -> c_int;
|
||||
pub fn fileno(stream: *FILE) -> c_int;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2629,11 +2609,10 @@ pub mod funcs {
|
|||
use libc::types::os::arch::c95::{c_int, c_char};
|
||||
extern {
|
||||
#[link_name = "_open"]
|
||||
pub unsafe fn open(path: *c_char, oflag: c_int, mode: c_int)
|
||||
pub fn open(path: *c_char, oflag: c_int, mode: c_int)
|
||||
-> c_int;
|
||||
|
||||
#[link_name = "_creat"]
|
||||
pub unsafe fn creat(path: *c_char, mode: c_int) -> c_int;
|
||||
pub fn creat(path: *c_char, mode: c_int) -> c_int;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2653,73 +2632,48 @@ pub mod funcs {
|
|||
|
||||
extern {
|
||||
#[link_name = "_access"]
|
||||
pub unsafe fn access(path: *c_char, amode: c_int) -> c_int;
|
||||
|
||||
pub fn access(path: *c_char, amode: c_int) -> c_int;
|
||||
#[link_name = "_chdir"]
|
||||
pub unsafe fn chdir(dir: *c_char) -> c_int;
|
||||
|
||||
pub fn chdir(dir: *c_char) -> c_int;
|
||||
#[link_name = "_close"]
|
||||
pub unsafe fn close(fd: c_int) -> c_int;
|
||||
|
||||
pub fn close(fd: c_int) -> c_int;
|
||||
#[link_name = "_dup"]
|
||||
pub unsafe fn dup(fd: c_int) -> c_int;
|
||||
|
||||
pub fn dup(fd: c_int) -> c_int;
|
||||
#[link_name = "_dup2"]
|
||||
pub unsafe fn dup2(src: c_int, dst: c_int) -> c_int;
|
||||
|
||||
pub fn dup2(src: c_int, dst: c_int) -> c_int;
|
||||
#[link_name = "_execv"]
|
||||
pub unsafe fn execv(prog: *c_char, argv: **c_char)
|
||||
-> intptr_t;
|
||||
|
||||
pub fn execv(prog: *c_char, argv: **c_char) -> intptr_t;
|
||||
#[link_name = "_execve"]
|
||||
pub unsafe fn execve(prog: *c_char,
|
||||
argv: **c_char,
|
||||
envp: **c_char)
|
||||
pub fn execve(prog: *c_char, argv: **c_char, envp: **c_char)
|
||||
-> c_int;
|
||||
|
||||
#[link_name = "_execvp"]
|
||||
pub unsafe fn execvp(c: *c_char, argv: **c_char) -> c_int;
|
||||
|
||||
pub fn execvp(c: *c_char, argv: **c_char) -> c_int;
|
||||
#[link_name = "_execvpe"]
|
||||
pub unsafe fn execvpe(c: *c_char,
|
||||
argv: **c_char,
|
||||
envp: **c_char)
|
||||
pub fn execvpe(c: *c_char, argv: **c_char, envp: **c_char)
|
||||
-> c_int;
|
||||
|
||||
#[link_name = "_getcwd"]
|
||||
pub unsafe fn getcwd(buf: *c_char, size: size_t) -> *c_char;
|
||||
|
||||
pub fn getcwd(buf: *c_char, size: size_t) -> *c_char;
|
||||
#[link_name = "_getpid"]
|
||||
pub unsafe fn getpid() -> c_int;
|
||||
|
||||
pub fn getpid() -> c_int;
|
||||
#[link_name = "_isatty"]
|
||||
pub unsafe fn isatty(fd: c_int) -> c_int;
|
||||
|
||||
pub fn isatty(fd: c_int) -> c_int;
|
||||
#[link_name = "_lseek"]
|
||||
pub unsafe fn lseek(fd: c_int, offset: c_long, origin: c_int)
|
||||
pub fn lseek(fd: c_int, offset: c_long, origin: c_int)
|
||||
-> c_long;
|
||||
|
||||
#[link_name = "_pipe"]
|
||||
pub unsafe fn pipe(fds: *mut c_int,
|
||||
psize: c_uint,
|
||||
textmode: c_int)
|
||||
pub fn pipe(fds: *mut c_int, psize: c_uint, textmode: c_int)
|
||||
-> c_int;
|
||||
|
||||
#[link_name = "_read"]
|
||||
#[fast_ffi]
|
||||
pub unsafe fn read(fd: c_int, buf: *mut c_void, count: c_uint)
|
||||
pub fn read(fd: c_int, buf: *mut c_void, count: c_uint)
|
||||
-> c_int;
|
||||
|
||||
#[link_name = "_rmdir"]
|
||||
pub unsafe fn rmdir(path: *c_char) -> c_int;
|
||||
|
||||
pub fn rmdir(path: *c_char) -> c_int;
|
||||
#[link_name = "_unlink"]
|
||||
pub unsafe fn unlink(c: *c_char) -> c_int;
|
||||
|
||||
pub fn unlink(c: *c_char) -> c_int;
|
||||
#[link_name = "_write"]
|
||||
#[fast_ffi]
|
||||
pub unsafe fn write(fd: c_int, buf: *c_void, count: c_uint)
|
||||
-> c_int;
|
||||
pub fn write(fd: c_int, buf: *c_void, count: c_uint) -> c_int;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2741,29 +2695,29 @@ pub mod funcs {
|
|||
#[nolink]
|
||||
#[abi = "cdecl"]
|
||||
extern {
|
||||
pub unsafe fn chmod(path: *c_char, mode: mode_t) -> c_int;
|
||||
pub unsafe fn fchmod(fd: c_int, mode: mode_t) -> c_int;
|
||||
pub fn chmod(path: *c_char, mode: mode_t) -> c_int;
|
||||
pub fn fchmod(fd: c_int, mode: mode_t) -> c_int;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
#[cfg(target_os = "android")]
|
||||
pub unsafe fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
|
||||
pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[link_name = "fstat64"]
|
||||
pub unsafe fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
|
||||
pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
|
||||
|
||||
pub unsafe fn mkdir(path: *c_char, mode: mode_t) -> c_int;
|
||||
pub unsafe fn mkfifo(path: *c_char, mode: mode_t) -> c_int;
|
||||
pub fn mkdir(path: *c_char, mode: mode_t) -> c_int;
|
||||
pub fn mkfifo(path: *c_char, mode: mode_t) -> c_int;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
#[cfg(target_os = "android")]
|
||||
pub unsafe fn stat(path: *c_char, buf: *mut stat) -> c_int;
|
||||
pub fn stat(path: *c_char, buf: *mut stat) -> c_int;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[link_name = "stat64"]
|
||||
pub unsafe fn stat(path: *c_char, buf: *mut stat) -> c_int;
|
||||
pub fn stat(path: *c_char, buf: *mut stat) -> c_int;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2774,10 +2728,10 @@ pub mod funcs {
|
|||
use libc::types::os::arch::c95::{c_char, c_int};
|
||||
|
||||
extern {
|
||||
pub unsafe fn popen(command: *c_char, mode: *c_char) -> *FILE;
|
||||
pub unsafe fn pclose(stream: *FILE) -> c_int;
|
||||
pub unsafe fn fdopen(fd: c_int, mode: *c_char) -> *FILE;
|
||||
pub unsafe fn fileno(stream: *FILE) -> c_int;
|
||||
pub fn popen(command: *c_char, mode: *c_char) -> *FILE;
|
||||
pub fn pclose(stream: *FILE) -> c_int;
|
||||
pub fn fdopen(fd: c_int, mode: *c_char) -> *FILE;
|
||||
pub fn fileno(stream: *FILE) -> c_int;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2788,10 +2742,10 @@ pub mod funcs {
|
|||
use libc::types::os::arch::posix88::mode_t;
|
||||
|
||||
extern {
|
||||
pub unsafe fn open(path: *c_char, oflag: c_int, mode: c_int)
|
||||
pub fn open(path: *c_char, oflag: c_int, mode: c_int)
|
||||
-> c_int;
|
||||
pub unsafe fn creat(path: *c_char, mode: mode_t) -> c_int;
|
||||
pub unsafe fn fcntl(fd: c_int, cmd: c_int) -> c_int;
|
||||
pub fn creat(path: *c_char, mode: mode_t) -> c_int;
|
||||
pub fn fcntl(fd: c_int, cmd: c_int) -> c_int;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2815,15 +2769,15 @@ pub mod funcs {
|
|||
}
|
||||
|
||||
extern {
|
||||
unsafe fn rust_opendir(dirname: *c_char) -> *DIR;
|
||||
unsafe fn rust_readdir(dirp: *DIR) -> *dirent_t;
|
||||
fn rust_opendir(dirname: *c_char) -> *DIR;
|
||||
fn rust_readdir(dirp: *DIR) -> *dirent_t;
|
||||
}
|
||||
|
||||
extern {
|
||||
pub unsafe fn closedir(dirp: *DIR) -> c_int;
|
||||
pub unsafe fn rewinddir(dirp: *DIR);
|
||||
pub unsafe fn seekdir(dirp: *DIR, loc: c_long);
|
||||
pub unsafe fn telldir(dirp: *DIR) -> c_long;
|
||||
pub fn closedir(dirp: *DIR) -> c_int;
|
||||
pub fn rewinddir(dirp: *DIR);
|
||||
pub fn seekdir(dirp: *DIR, loc: c_long);
|
||||
pub fn telldir(dirp: *DIR) -> c_long;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2837,61 +2791,54 @@ pub mod funcs {
|
|||
use libc::types::os::arch::posix88::{ssize_t, uid_t};
|
||||
|
||||
extern {
|
||||
pub unsafe fn access(path: *c_char, amode: c_int) -> c_int;
|
||||
pub unsafe fn alarm(seconds: c_uint) -> c_uint;
|
||||
pub unsafe fn chdir(dir: *c_char) -> c_int;
|
||||
pub unsafe fn chown(path: *c_char, uid: uid_t, gid: gid_t)
|
||||
pub fn access(path: *c_char, amode: c_int) -> c_int;
|
||||
pub fn alarm(seconds: c_uint) -> c_uint;
|
||||
pub fn chdir(dir: *c_char) -> c_int;
|
||||
pub fn chown(path: *c_char, uid: uid_t, gid: gid_t) -> c_int;
|
||||
pub fn close(fd: c_int) -> c_int;
|
||||
pub fn dup(fd: c_int) -> c_int;
|
||||
pub fn dup2(src: c_int, dst: c_int) -> c_int;
|
||||
pub fn execv(prog: *c_char, argv: **c_char) -> c_int;
|
||||
pub fn execve(prog: *c_char, argv: **c_char, envp: **c_char)
|
||||
-> c_int;
|
||||
pub unsafe fn close(fd: c_int) -> c_int;
|
||||
pub unsafe fn dup(fd: c_int) -> c_int;
|
||||
pub unsafe fn dup2(src: c_int, dst: c_int) -> c_int;
|
||||
pub unsafe fn execv(prog: *c_char, argv: **c_char) -> c_int;
|
||||
pub unsafe fn execve(prog: *c_char,
|
||||
argv: **c_char,
|
||||
envp: **c_char)
|
||||
pub fn execvp(c: *c_char, argv: **c_char) -> c_int;
|
||||
pub fn fork() -> pid_t;
|
||||
pub fn fpathconf(filedes: c_int, name: c_int) -> c_long;
|
||||
pub fn getcwd(buf: *c_char, size: size_t) -> *c_char;
|
||||
pub fn getegid() -> gid_t;
|
||||
pub fn geteuid() -> uid_t;
|
||||
pub fn getgid() -> gid_t ;
|
||||
pub fn getgroups(ngroups_max: c_int, groups: *mut gid_t)
|
||||
-> c_int;
|
||||
pub unsafe fn execvp(c: *c_char, argv: **c_char) -> c_int;
|
||||
pub unsafe fn fork() -> pid_t;
|
||||
pub unsafe fn fpathconf(filedes: c_int, name: c_int)
|
||||
-> c_long;
|
||||
pub unsafe fn getcwd(buf: *c_char, size: size_t) -> *c_char;
|
||||
pub unsafe fn getegid() -> gid_t;
|
||||
pub unsafe fn geteuid() -> uid_t;
|
||||
pub unsafe fn getgid() -> gid_t ;
|
||||
pub unsafe fn getgroups(ngroups_max: c_int,
|
||||
groups: *mut gid_t)
|
||||
pub fn getlogin() -> *c_char;
|
||||
pub fn getopt(argc: c_int, argv: **c_char, optstr: *c_char)
|
||||
-> c_int;
|
||||
pub unsafe fn getlogin() -> *c_char;
|
||||
pub unsafe fn getopt(argc: c_int,
|
||||
argv: **c_char,
|
||||
optstr: *c_char)
|
||||
-> c_int;
|
||||
pub unsafe fn getpgrp() -> pid_t;
|
||||
pub unsafe fn getpid() -> pid_t;
|
||||
pub unsafe fn getppid() -> pid_t;
|
||||
pub unsafe fn getuid() -> uid_t;
|
||||
pub unsafe fn isatty(fd: c_int) -> c_int;
|
||||
pub unsafe fn link(src: *c_char, dst: *c_char) -> c_int;
|
||||
pub unsafe fn lseek(fd: c_int, offset: off_t, whence: c_int)
|
||||
pub fn getpgrp() -> pid_t;
|
||||
pub fn getpid() -> pid_t;
|
||||
pub fn getppid() -> pid_t;
|
||||
pub fn getuid() -> uid_t;
|
||||
pub fn isatty(fd: c_int) -> c_int;
|
||||
pub fn link(src: *c_char, dst: *c_char) -> c_int;
|
||||
pub fn lseek(fd: c_int, offset: off_t, whence: c_int)
|
||||
-> off_t;
|
||||
pub unsafe fn pathconf(path: *c_char, name: c_int) -> c_long;
|
||||
pub unsafe fn pause() -> c_int;
|
||||
pub unsafe fn pipe(fds: *mut c_int) -> c_int;
|
||||
pub fn pathconf(path: *c_char, name: c_int) -> c_long;
|
||||
pub fn pause() -> c_int;
|
||||
pub fn pipe(fds: *mut c_int) -> c_int;
|
||||
#[fast_ffi]
|
||||
pub unsafe fn read(fd: c_int, buf: *mut c_void, count: size_t)
|
||||
pub fn read(fd: c_int, buf: *mut c_void, count: size_t)
|
||||
-> ssize_t;
|
||||
pub unsafe fn rmdir(path: *c_char) -> c_int;
|
||||
pub unsafe fn setgid(gid: gid_t) -> c_int;
|
||||
pub unsafe fn setpgid(pid: pid_t, pgid: pid_t) -> c_int;
|
||||
pub unsafe fn setsid() -> pid_t;
|
||||
pub unsafe fn setuid(uid: uid_t) -> c_int;
|
||||
pub unsafe fn sleep(secs: c_uint) -> c_uint;
|
||||
pub unsafe fn sysconf(name: c_int) -> c_long;
|
||||
pub unsafe fn tcgetpgrp(fd: c_int) -> pid_t;
|
||||
pub unsafe fn ttyname(fd: c_int) -> *c_char;
|
||||
pub unsafe fn unlink(c: *c_char) -> c_int;
|
||||
pub fn rmdir(path: *c_char) -> c_int;
|
||||
pub fn setgid(gid: gid_t) -> c_int;
|
||||
pub fn setpgid(pid: pid_t, pgid: pid_t) -> c_int;
|
||||
pub fn setsid() -> pid_t;
|
||||
pub fn setuid(uid: uid_t) -> c_int;
|
||||
pub fn sleep(secs: c_uint) -> c_uint;
|
||||
pub fn sysconf(name: c_int) -> c_long;
|
||||
pub fn tcgetpgrp(fd: c_int) -> pid_t;
|
||||
pub fn ttyname(fd: c_int) -> *c_char;
|
||||
pub fn unlink(c: *c_char) -> c_int;
|
||||
#[fast_ffi]
|
||||
pub unsafe fn write(fd: c_int, buf: *c_void, count: size_t)
|
||||
pub fn write(fd: c_int, buf: *c_void, count: size_t)
|
||||
-> ssize_t;
|
||||
}
|
||||
}
|
||||
|
@ -2903,7 +2850,7 @@ pub mod funcs {
|
|||
use libc::types::os::arch::posix88::{pid_t};
|
||||
|
||||
extern {
|
||||
pub unsafe fn kill(pid: pid_t, sig: c_int) -> c_int;
|
||||
pub fn kill(pid: pid_t, sig: c_int) -> c_int;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2915,32 +2862,28 @@ pub mod funcs {
|
|||
use libc::types::os::arch::posix88::{mode_t, off_t};
|
||||
|
||||
extern {
|
||||
pub unsafe fn mlock(addr: *c_void, len: size_t) -> c_int;
|
||||
pub unsafe fn munlock(addr: *c_void, len: size_t) -> c_int;
|
||||
pub unsafe fn mlockall(flags: c_int) -> c_int;
|
||||
pub unsafe fn munlockall() -> c_int;
|
||||
pub fn mlock(addr: *c_void, len: size_t) -> c_int;
|
||||
pub fn munlock(addr: *c_void, len: size_t) -> c_int;
|
||||
pub fn mlockall(flags: c_int) -> c_int;
|
||||
pub fn munlockall() -> c_int;
|
||||
|
||||
pub unsafe fn mmap(addr: *c_void,
|
||||
pub fn mmap(addr: *c_void,
|
||||
len: size_t,
|
||||
prot: c_int,
|
||||
flags: c_int,
|
||||
fd: c_int,
|
||||
offset: off_t)
|
||||
-> *mut c_void;
|
||||
pub unsafe fn munmap(addr: *c_void, len: size_t) -> c_int;
|
||||
pub fn munmap(addr: *c_void, len: size_t) -> c_int;
|
||||
|
||||
pub unsafe fn mprotect(addr: *c_void,
|
||||
len: size_t,
|
||||
prot: c_int)
|
||||
pub fn mprotect(addr: *c_void, len: size_t, prot: c_int)
|
||||
-> c_int;
|
||||
|
||||
pub unsafe fn msync(addr: *c_void, len: size_t, flags: c_int)
|
||||
pub fn msync(addr: *c_void, len: size_t, flags: c_int)
|
||||
-> c_int;
|
||||
pub unsafe fn shm_open(name: *c_char,
|
||||
oflag: c_int,
|
||||
mode: mode_t)
|
||||
pub fn shm_open(name: *c_char, oflag: c_int, mode: mode_t)
|
||||
-> c_int;
|
||||
pub unsafe fn shm_unlink(name: *c_char) -> c_int;
|
||||
pub fn shm_unlink(name: *c_char) -> c_int;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2960,11 +2903,11 @@ pub mod funcs {
|
|||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
#[cfg(target_os = "android")]
|
||||
pub unsafe fn lstat(path: *c_char, buf: *mut stat) -> c_int;
|
||||
pub fn lstat(path: *c_char, buf: *mut stat) -> c_int;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[link_name = "lstat64"]
|
||||
pub unsafe fn lstat(path: *c_char, buf: *mut stat) -> c_int;
|
||||
pub fn lstat(path: *c_char, buf: *mut stat) -> c_int;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2975,26 +2918,23 @@ pub mod funcs {
|
|||
use libc::types::os::arch::posix88::{ssize_t};
|
||||
|
||||
extern {
|
||||
pub unsafe fn readlink(path: *c_char,
|
||||
pub fn readlink(path: *c_char,
|
||||
buf: *mut c_char,
|
||||
bufsz: size_t)
|
||||
-> ssize_t;
|
||||
|
||||
pub unsafe fn fsync(fd: c_int) -> c_int;
|
||||
pub fn fsync(fd: c_int) -> c_int;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "android")]
|
||||
pub unsafe fn fdatasync(fd: c_int) -> c_int;
|
||||
pub fn fdatasync(fd: c_int) -> c_int;
|
||||
|
||||
pub unsafe fn setenv(name: *c_char,
|
||||
val: *c_char,
|
||||
overwrite: c_int)
|
||||
pub fn setenv(name: *c_char, val: *c_char, overwrite: c_int)
|
||||
-> c_int;
|
||||
pub unsafe fn unsetenv(name: *c_char) -> c_int;
|
||||
pub unsafe fn putenv(string: *c_char) -> c_int;
|
||||
pub fn unsetenv(name: *c_char) -> c_int;
|
||||
pub fn putenv(string: *c_char) -> c_int;
|
||||
|
||||
pub unsafe fn symlink(path1: *c_char, path2: *c_char)
|
||||
-> c_int;
|
||||
pub fn symlink(path1: *c_char, path2: *c_char) -> c_int;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3005,9 +2945,7 @@ pub mod funcs {
|
|||
use libc::types::os::arch::posix88::{pid_t};
|
||||
|
||||
extern {
|
||||
pub unsafe fn waitpid(pid: pid_t,
|
||||
status: *mut c_int,
|
||||
options: c_int)
|
||||
pub fn waitpid(pid: pid_t, status: *mut c_int, options: c_int)
|
||||
-> pid_t;
|
||||
}
|
||||
}
|
||||
|
@ -3020,11 +2958,11 @@ pub mod funcs {
|
|||
use libc::types::os::common::posix01::{glob_t};
|
||||
|
||||
extern {
|
||||
pub unsafe fn glob(pattern: *c_char,
|
||||
pub fn glob(pattern: *c_char,
|
||||
flags: c_int,
|
||||
errfunc: *c_void, // XXX callback
|
||||
pglob: *mut glob_t);
|
||||
pub unsafe fn globfree(pglob: *mut glob_t);
|
||||
pub fn globfree(pglob: *mut glob_t);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3035,7 +2973,7 @@ pub mod funcs {
|
|||
use libc::types::os::arch::c95::{c_int, size_t};
|
||||
|
||||
extern {
|
||||
pub unsafe fn posix_madvise(addr: *c_void,
|
||||
pub fn posix_madvise(addr: *c_void,
|
||||
len: size_t,
|
||||
advice: c_int)
|
||||
-> c_int;
|
||||
|
@ -3079,32 +3017,27 @@ pub mod funcs {
|
|||
|
||||
#[abi = "cdecl"]
|
||||
extern {
|
||||
pub unsafe fn sysctl(name: *c_int,
|
||||
pub fn sysctl(name: *c_int,
|
||||
namelen: c_uint,
|
||||
oldp: *mut c_void,
|
||||
oldlenp: *mut size_t,
|
||||
newp: *c_void,
|
||||
newlen: size_t)
|
||||
-> c_int;
|
||||
|
||||
pub unsafe fn sysctlbyname(name: *c_char,
|
||||
pub fn sysctlbyname(name: *c_char,
|
||||
oldp: *mut c_void,
|
||||
oldlenp: *mut size_t,
|
||||
newp: *c_void,
|
||||
newlen: size_t)
|
||||
-> c_int;
|
||||
|
||||
pub unsafe fn sysctlnametomib(name: *c_char,
|
||||
pub fn sysctlnametomib(name: *c_char,
|
||||
mibp: *mut c_int,
|
||||
sizep: *mut size_t)
|
||||
-> c_int;
|
||||
|
||||
pub unsafe fn getdtablesize() -> c_int;
|
||||
|
||||
pub unsafe fn madvise(addr: *c_void, len: size_t, advice: c_int)
|
||||
pub fn getdtablesize() -> c_int;
|
||||
pub fn madvise(addr: *c_void, len: size_t, advice: c_int)
|
||||
-> c_int;
|
||||
|
||||
pub unsafe fn mincore(addr: *c_void, len: size_t, vec: *c_uchar)
|
||||
pub fn mincore(addr: *c_void, len: size_t, vec: *c_uchar)
|
||||
-> c_int;
|
||||
}
|
||||
}
|
||||
|
@ -3118,12 +3051,10 @@ pub mod funcs {
|
|||
|
||||
#[abi = "cdecl"]
|
||||
extern {
|
||||
pub unsafe fn getdtablesize() -> c_int;
|
||||
|
||||
pub unsafe fn madvise(addr: *c_void, len: size_t, advice: c_int)
|
||||
pub fn getdtablesize() -> c_int;
|
||||
pub fn madvise(addr: *c_void, len: size_t, advice: c_int)
|
||||
-> c_int;
|
||||
|
||||
pub unsafe fn mincore(addr: *c_void, len: size_t, vec: *c_uchar)
|
||||
pub fn mincore(addr: *c_void, len: size_t, vec: *c_uchar)
|
||||
-> c_int;
|
||||
}
|
||||
}
|
||||
|
@ -3140,8 +3071,7 @@ pub mod funcs {
|
|||
|
||||
#[abi = "cdecl"]
|
||||
extern {
|
||||
pub unsafe fn _NSGetExecutablePath(buf: *mut c_char,
|
||||
bufsize: *mut u32)
|
||||
pub fn _NSGetExecutablePath(buf: *mut c_char, bufsize: *mut u32)
|
||||
-> c_int;
|
||||
}
|
||||
}
|
||||
|
@ -3173,41 +3103,36 @@ pub mod funcs {
|
|||
|
||||
#[abi = "stdcall"]
|
||||
extern "stdcall" {
|
||||
pub unsafe fn GetEnvironmentVariableW(n: LPCWSTR,
|
||||
pub fn GetEnvironmentVariableW(n: LPCWSTR,
|
||||
v: LPWSTR,
|
||||
nsize: DWORD)
|
||||
-> DWORD;
|
||||
pub unsafe fn SetEnvironmentVariableW(n: LPCWSTR, v: LPCWSTR)
|
||||
pub fn SetEnvironmentVariableW(n: LPCWSTR, v: LPCWSTR)
|
||||
-> BOOL;
|
||||
pub unsafe fn GetEnvironmentStringsA() -> LPTCH;
|
||||
pub unsafe fn FreeEnvironmentStringsA(env_ptr: LPTCH) -> BOOL;
|
||||
|
||||
pub unsafe fn GetModuleFileNameW(hModule: HMODULE,
|
||||
pub fn GetEnvironmentStringsA() -> LPTCH;
|
||||
pub fn FreeEnvironmentStringsA(env_ptr: LPTCH) -> BOOL;
|
||||
pub fn GetModuleFileNameW(hModule: HMODULE,
|
||||
lpFilename: LPWSTR,
|
||||
nSize: DWORD)
|
||||
-> DWORD;
|
||||
pub unsafe fn CreateDirectoryW(lpPathName: LPCWSTR,
|
||||
pub fn CreateDirectoryW(lpPathName: LPCWSTR,
|
||||
lpSecurityAttributes:
|
||||
LPSECURITY_ATTRIBUTES)
|
||||
-> BOOL;
|
||||
pub unsafe fn CopyFileW(lpExistingFileName: LPCWSTR,
|
||||
pub fn CopyFileW(lpExistingFileName: LPCWSTR,
|
||||
lpNewFileName: LPCWSTR,
|
||||
bFailIfExists: BOOL)
|
||||
-> BOOL;
|
||||
pub unsafe fn DeleteFileW(lpPathName: LPCWSTR) -> BOOL;
|
||||
pub unsafe fn RemoveDirectoryW(lpPathName: LPCWSTR) -> BOOL;
|
||||
pub unsafe fn SetCurrentDirectoryW(lpPathName: LPCWSTR)
|
||||
-> BOOL;
|
||||
|
||||
pub unsafe fn GetLastError() -> DWORD;
|
||||
pub unsafe fn FindFirstFileW(fileName: *u16,
|
||||
findFileData: HANDLE)
|
||||
pub fn DeleteFileW(lpPathName: LPCWSTR) -> BOOL;
|
||||
pub fn RemoveDirectoryW(lpPathName: LPCWSTR) -> BOOL;
|
||||
pub fn SetCurrentDirectoryW(lpPathName: LPCWSTR) -> BOOL;
|
||||
pub fn GetLastError() -> DWORD;
|
||||
pub fn FindFirstFileW(fileName: *u16, findFileData: HANDLE)
|
||||
-> HANDLE;
|
||||
pub unsafe fn FindNextFileW(findFile: HANDLE,
|
||||
findFileData: HANDLE)
|
||||
pub fn FindNextFileW(findFile: HANDLE, findFileData: HANDLE)
|
||||
-> BOOL;
|
||||
pub unsafe fn FindClose(findFile: HANDLE) -> BOOL;
|
||||
pub unsafe fn DuplicateHandle(hSourceProcessHandle: HANDLE,
|
||||
pub fn FindClose(findFile: HANDLE) -> BOOL;
|
||||
pub fn DuplicateHandle(hSourceProcessHandle: HANDLE,
|
||||
hSourceHandle: HANDLE,
|
||||
hTargetProcessHandle: HANDLE,
|
||||
lpTargetHandle: LPHANDLE,
|
||||
|
@ -3215,13 +3140,13 @@ pub mod funcs {
|
|||
bInheritHandle: BOOL,
|
||||
dwOptions: DWORD)
|
||||
-> BOOL;
|
||||
pub unsafe fn CloseHandle(hObject: HANDLE) -> BOOL;
|
||||
pub unsafe fn OpenProcess(dwDesiredAccess: DWORD,
|
||||
pub fn CloseHandle(hObject: HANDLE) -> BOOL;
|
||||
pub fn OpenProcess(dwDesiredAccess: DWORD,
|
||||
bInheritHandle: BOOL,
|
||||
dwProcessId: DWORD)
|
||||
-> HANDLE;
|
||||
pub unsafe fn GetCurrentProcess() -> HANDLE;
|
||||
pub unsafe fn CreateProcessA(lpApplicationName: LPCTSTR,
|
||||
pub fn GetCurrentProcess() -> HANDLE;
|
||||
pub fn CreateProcessA(lpApplicationName: LPCTSTR,
|
||||
lpCommandLine: LPTSTR,
|
||||
lpProcessAttributes:
|
||||
LPSECURITY_ATTRIBUTES,
|
||||
|
@ -3235,56 +3160,50 @@ pub mod funcs {
|
|||
lpProcessInformation:
|
||||
LPPROCESS_INFORMATION)
|
||||
-> BOOL;
|
||||
pub unsafe fn WaitForSingleObject(hHandle: HANDLE,
|
||||
pub fn WaitForSingleObject(hHandle: HANDLE,
|
||||
dwMilliseconds: DWORD)
|
||||
-> DWORD;
|
||||
pub unsafe fn TerminateProcess(hProcess: HANDLE,
|
||||
uExitCode: c_uint)
|
||||
pub fn TerminateProcess(hProcess: HANDLE, uExitCode: c_uint)
|
||||
-> BOOL;
|
||||
pub unsafe fn GetExitCodeProcess(hProcess: HANDLE,
|
||||
pub fn GetExitCodeProcess(hProcess: HANDLE,
|
||||
lpExitCode: LPDWORD)
|
||||
-> BOOL;
|
||||
|
||||
pub unsafe fn GetSystemInfo(lpSystemInfo: LPSYSTEM_INFO);
|
||||
pub unsafe fn VirtualAlloc(lpAddress: LPVOID,
|
||||
pub fn GetSystemInfo(lpSystemInfo: LPSYSTEM_INFO);
|
||||
pub fn VirtualAlloc(lpAddress: LPVOID,
|
||||
dwSize: SIZE_T,
|
||||
flAllocationType: DWORD,
|
||||
flProtect: DWORD)
|
||||
-> LPVOID;
|
||||
pub unsafe fn VirtualFree(lpAddress: LPVOID,
|
||||
pub fn VirtualFree(lpAddress: LPVOID,
|
||||
dwSize: SIZE_T,
|
||||
dwFreeType: DWORD)
|
||||
-> BOOL;
|
||||
pub unsafe fn VirtualLock(lpAddress: LPVOID, dwSize: SIZE_T)
|
||||
pub fn VirtualLock(lpAddress: LPVOID, dwSize: SIZE_T) -> BOOL;
|
||||
pub fn VirtualUnlock(lpAddress: LPVOID, dwSize: SIZE_T)
|
||||
-> BOOL;
|
||||
pub unsafe fn VirtualUnlock(lpAddress: LPVOID, dwSize: SIZE_T)
|
||||
-> BOOL;
|
||||
pub unsafe fn VirtualProtect(lpAddress: LPVOID,
|
||||
pub fn VirtualProtect(lpAddress: LPVOID,
|
||||
dwSize: SIZE_T,
|
||||
flNewProtect: DWORD,
|
||||
lpflOldProtect: LPDWORD)
|
||||
-> BOOL;
|
||||
pub unsafe fn VirtualQuery(lpAddress: LPCVOID,
|
||||
lpBuffer:
|
||||
LPMEMORY_BASIC_INFORMATION,
|
||||
pub fn VirtualQuery(lpAddress: LPCVOID,
|
||||
lpBuffer: LPMEMORY_BASIC_INFORMATION,
|
||||
dwLength: SIZE_T)
|
||||
-> SIZE_T;
|
||||
|
||||
pub unsafe fn CreateFileMappingW(hFile: HANDLE,
|
||||
lpAttributes:
|
||||
LPSECURITY_ATTRIBUTES,
|
||||
pub fn CreateFileMappingW(hFile: HANDLE,
|
||||
lpAttributes: LPSECURITY_ATTRIBUTES,
|
||||
flProtect: DWORD,
|
||||
dwMaximumSizeHigh: DWORD,
|
||||
dwMaximumSizeLow: DWORD,
|
||||
lpName: LPCTSTR)
|
||||
-> HANDLE;
|
||||
pub unsafe fn MapViewOfFile(hFileMappingObject: HANDLE,
|
||||
pub fn MapViewOfFile(hFileMappingObject: HANDLE,
|
||||
dwDesiredAccess: DWORD,
|
||||
dwFileOffsetHigh: DWORD,
|
||||
dwFileOffsetLow: DWORD,
|
||||
dwNumberOfBytesToMap: SIZE_T)
|
||||
-> LPVOID;
|
||||
pub unsafe fn UnmapViewOfFile(lpBaseAddress: LPCVOID) -> BOOL;
|
||||
pub fn UnmapViewOfFile(lpBaseAddress: LPCVOID) -> BOOL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3295,10 +3214,10 @@ pub mod funcs {
|
|||
#[nolink]
|
||||
extern {
|
||||
#[link_name = "_commit"]
|
||||
pub unsafe fn commit(fd: c_int) -> c_int;
|
||||
pub fn commit(fd: c_int) -> c_int;
|
||||
|
||||
#[link_name = "_get_osfhandle"]
|
||||
pub unsafe fn get_osfhandle(fd: c_int) -> c_long;
|
||||
pub fn get_osfhandle(fd: c_int) -> c_long;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,9 +105,9 @@ pub mod rustrt {
|
|||
use libc;
|
||||
|
||||
extern {
|
||||
pub unsafe fn rust_log_console_on();
|
||||
pub unsafe fn rust_log_console_off();
|
||||
pub unsafe fn rust_log_str(level: u32,
|
||||
pub fn rust_log_console_on();
|
||||
pub fn rust_log_console_off();
|
||||
pub fn rust_log_str(level: u32,
|
||||
string: *libc::c_char,
|
||||
size: libc::size_t);
|
||||
}
|
||||
|
|
|
@ -22,83 +22,84 @@ pub mod c_double_utils {
|
|||
extern {
|
||||
// Alpabetically sorted by link_name
|
||||
|
||||
pub unsafe fn acos(n: c_double) -> c_double;
|
||||
pub unsafe fn asin(n: c_double) -> c_double;
|
||||
pub unsafe fn atan(n: c_double) -> c_double;
|
||||
pub unsafe fn atan2(a: c_double, b: c_double) -> c_double;
|
||||
pub unsafe fn cbrt(n: c_double) -> c_double;
|
||||
pub unsafe fn ceil(n: c_double) -> c_double;
|
||||
pub unsafe fn copysign(x: c_double, y: c_double) -> c_double;
|
||||
pub unsafe fn cos(n: c_double) -> c_double;
|
||||
pub unsafe fn cosh(n: c_double) -> c_double;
|
||||
pub unsafe fn erf(n: c_double) -> c_double;
|
||||
pub unsafe fn erfc(n: c_double) -> c_double;
|
||||
pub unsafe fn exp(n: c_double) -> c_double;
|
||||
pub fn acos(n: c_double) -> c_double;
|
||||
pub fn asin(n: c_double) -> c_double;
|
||||
pub fn atan(n: c_double) -> c_double;
|
||||
pub fn atan2(a: c_double, b: c_double) -> c_double;
|
||||
pub fn cbrt(n: c_double) -> c_double;
|
||||
pub fn ceil(n: c_double) -> c_double;
|
||||
pub fn copysign(x: c_double, y: c_double) -> c_double;
|
||||
pub fn cos(n: c_double) -> c_double;
|
||||
pub fn cosh(n: c_double) -> c_double;
|
||||
pub fn erf(n: c_double) -> c_double;
|
||||
pub fn erfc(n: c_double) -> c_double;
|
||||
pub fn exp(n: c_double) -> c_double;
|
||||
// rename: for consistency with underscore usage elsewhere
|
||||
#[link_name="expm1"] unsafe fn exp_m1(n: c_double) -> c_double;
|
||||
pub unsafe fn exp2(n: c_double) -> c_double;
|
||||
#[link_name="fabs"] unsafe fn abs(n: c_double) -> c_double;
|
||||
#[link_name="expm1"]
|
||||
fn exp_m1(n: c_double) -> c_double;
|
||||
pub fn exp2(n: c_double) -> c_double;
|
||||
#[link_name="fabs"]
|
||||
fn abs(n: c_double) -> c_double;
|
||||
// rename: for clarity and consistency with add/sub/mul/div
|
||||
#[link_name="fdim"]
|
||||
pub unsafe fn abs_sub(a: c_double, b: c_double) -> c_double;
|
||||
pub unsafe fn floor(n: c_double) -> c_double;
|
||||
pub fn abs_sub(a: c_double, b: c_double) -> c_double;
|
||||
pub fn floor(n: c_double) -> c_double;
|
||||
// rename: for clarity and consistency with add/sub/mul/div
|
||||
#[link_name="fma"]
|
||||
pub unsafe fn mul_add(a: c_double, b: c_double, c: c_double)
|
||||
-> c_double;
|
||||
pub fn mul_add(a: c_double, b: c_double, c: c_double) -> c_double;
|
||||
#[link_name="fmax"]
|
||||
pub unsafe fn fmax(a: c_double, b: c_double) -> c_double;
|
||||
pub fn fmax(a: c_double, b: c_double) -> c_double;
|
||||
#[link_name="fmin"]
|
||||
pub unsafe fn fmin(a: c_double, b: c_double) -> c_double;
|
||||
pub fn fmin(a: c_double, b: c_double) -> c_double;
|
||||
#[link_name="nextafter"]
|
||||
pub unsafe fn next_after(x: c_double, y: c_double) -> c_double;
|
||||
pub unsafe fn frexp(n: c_double, value: &mut c_int) -> c_double;
|
||||
pub unsafe fn hypot(x: c_double, y: c_double) -> c_double;
|
||||
pub unsafe fn ldexp(x: c_double, n: c_int) -> c_double;
|
||||
pub fn next_after(x: c_double, y: c_double) -> c_double;
|
||||
pub fn frexp(n: c_double, value: &mut c_int) -> c_double;
|
||||
pub fn hypot(x: c_double, y: c_double) -> c_double;
|
||||
pub fn ldexp(x: c_double, n: c_int) -> c_double;
|
||||
#[cfg(unix)]
|
||||
#[link_name="lgamma_r"]
|
||||
pub unsafe fn lgamma(n: c_double, sign: &mut c_int) -> c_double;
|
||||
pub fn lgamma(n: c_double, sign: &mut c_int) -> c_double;
|
||||
#[cfg(windows)]
|
||||
#[link_name="__lgamma_r"]
|
||||
pub unsafe fn lgamma(n: c_double, sign: &mut c_int) -> c_double;
|
||||
pub fn lgamma(n: c_double, sign: &mut c_int) -> c_double;
|
||||
// renamed: ln seems more natural
|
||||
#[link_name="log"]
|
||||
pub unsafe fn ln(n: c_double) -> c_double;
|
||||
pub fn ln(n: c_double) -> c_double;
|
||||
// renamed: "logb" /often/ is confused for log2 by beginners
|
||||
#[link_name="logb"]
|
||||
pub unsafe fn log_radix(n: c_double) -> c_double;
|
||||
pub fn log_radix(n: c_double) -> c_double;
|
||||
// renamed: to be consitent with log as ln
|
||||
#[link_name="log1p"]
|
||||
pub unsafe fn ln_1p(n: c_double) -> c_double;
|
||||
pub unsafe fn log10(n: c_double) -> c_double;
|
||||
pub unsafe fn log2(n: c_double) -> c_double;
|
||||
pub fn ln_1p(n: c_double) -> c_double;
|
||||
pub fn log10(n: c_double) -> c_double;
|
||||
pub fn log2(n: c_double) -> c_double;
|
||||
#[link_name="ilogb"]
|
||||
pub unsafe fn ilog_radix(n: c_double) -> c_int;
|
||||
pub unsafe fn modf(n: c_double, iptr: &mut c_double) -> c_double;
|
||||
pub unsafe fn pow(n: c_double, e: c_double) -> c_double;
|
||||
pub fn ilog_radix(n: c_double) -> c_int;
|
||||
pub fn modf(n: c_double, iptr: &mut c_double) -> c_double;
|
||||
pub fn pow(n: c_double, e: c_double) -> c_double;
|
||||
// FIXME (#1379): enable when rounding modes become available
|
||||
// unsafe fn rint(n: c_double) -> c_double;
|
||||
pub unsafe fn round(n: c_double) -> c_double;
|
||||
// fn rint(n: c_double) -> c_double;
|
||||
pub fn round(n: c_double) -> c_double;
|
||||
// rename: for consistency with logradix
|
||||
#[link_name="scalbn"]
|
||||
pub unsafe fn ldexp_radix(n: c_double, i: c_int) -> c_double;
|
||||
pub unsafe fn sin(n: c_double) -> c_double;
|
||||
pub unsafe fn sinh(n: c_double) -> c_double;
|
||||
pub unsafe fn sqrt(n: c_double) -> c_double;
|
||||
pub unsafe fn tan(n: c_double) -> c_double;
|
||||
pub unsafe fn tanh(n: c_double) -> c_double;
|
||||
pub unsafe fn tgamma(n: c_double) -> c_double;
|
||||
pub unsafe fn trunc(n: c_double) -> c_double;
|
||||
pub fn ldexp_radix(n: c_double, i: c_int) -> c_double;
|
||||
pub fn sin(n: c_double) -> c_double;
|
||||
pub fn sinh(n: c_double) -> c_double;
|
||||
pub fn sqrt(n: c_double) -> c_double;
|
||||
pub fn tan(n: c_double) -> c_double;
|
||||
pub fn tanh(n: c_double) -> c_double;
|
||||
pub fn tgamma(n: c_double) -> c_double;
|
||||
pub fn trunc(n: c_double) -> c_double;
|
||||
|
||||
// These are commonly only available for doubles
|
||||
|
||||
pub unsafe fn j0(n: c_double) -> c_double;
|
||||
pub unsafe fn j1(n: c_double) -> c_double;
|
||||
pub unsafe fn jn(i: c_int, n: c_double) -> c_double;
|
||||
pub fn j0(n: c_double) -> c_double;
|
||||
pub fn j1(n: c_double) -> c_double;
|
||||
pub fn jn(i: c_int, n: c_double) -> c_double;
|
||||
|
||||
pub unsafe fn y0(n: c_double) -> c_double;
|
||||
pub unsafe fn y1(n: c_double) -> c_double;
|
||||
pub unsafe fn yn(i: c_int, n: c_double) -> c_double;
|
||||
pub fn y0(n: c_double) -> c_double;
|
||||
pub fn y1(n: c_double) -> c_double;
|
||||
pub fn yn(i: c_int, n: c_double) -> c_double;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,98 +112,98 @@ pub mod c_float_utils {
|
|||
// Alpabetically sorted by link_name
|
||||
|
||||
#[link_name="acosf"]
|
||||
pub unsafe fn acos(n: c_float) -> c_float;
|
||||
pub fn acos(n: c_float) -> c_float;
|
||||
#[link_name="asinf"]
|
||||
pub unsafe fn asin(n: c_float) -> c_float;
|
||||
pub fn asin(n: c_float) -> c_float;
|
||||
#[link_name="atanf"]
|
||||
pub unsafe fn atan(n: c_float) -> c_float;
|
||||
pub fn atan(n: c_float) -> c_float;
|
||||
#[link_name="atan2f"]
|
||||
pub unsafe fn atan2(a: c_float, b: c_float) -> c_float;
|
||||
pub fn atan2(a: c_float, b: c_float) -> c_float;
|
||||
#[link_name="cbrtf"]
|
||||
pub unsafe fn cbrt(n: c_float) -> c_float;
|
||||
pub fn cbrt(n: c_float) -> c_float;
|
||||
#[link_name="ceilf"]
|
||||
pub unsafe fn ceil(n: c_float) -> c_float;
|
||||
pub fn ceil(n: c_float) -> c_float;
|
||||
#[link_name="copysignf"]
|
||||
pub unsafe fn copysign(x: c_float, y: c_float) -> c_float;
|
||||
pub fn copysign(x: c_float, y: c_float) -> c_float;
|
||||
#[link_name="cosf"]
|
||||
pub unsafe fn cos(n: c_float) -> c_float;
|
||||
pub fn cos(n: c_float) -> c_float;
|
||||
#[link_name="coshf"]
|
||||
pub unsafe fn cosh(n: c_float) -> c_float;
|
||||
pub fn cosh(n: c_float) -> c_float;
|
||||
#[link_name="erff"]
|
||||
pub unsafe fn erf(n: c_float) -> c_float;
|
||||
pub fn erf(n: c_float) -> c_float;
|
||||
#[link_name="erfcf"]
|
||||
pub unsafe fn erfc(n: c_float) -> c_float;
|
||||
pub fn erfc(n: c_float) -> c_float;
|
||||
#[link_name="expf"]
|
||||
pub unsafe fn exp(n: c_float) -> c_float;
|
||||
pub fn exp(n: c_float) -> c_float;
|
||||
#[link_name="expm1f"]
|
||||
pub unsafe fn exp_m1(n: c_float) -> c_float;
|
||||
pub fn exp_m1(n: c_float) -> c_float;
|
||||
#[link_name="exp2f"]
|
||||
pub unsafe fn exp2(n: c_float) -> c_float;
|
||||
pub fn exp2(n: c_float) -> c_float;
|
||||
#[link_name="fabsf"]
|
||||
pub unsafe fn abs(n: c_float) -> c_float;
|
||||
pub fn abs(n: c_float) -> c_float;
|
||||
#[link_name="fdimf"]
|
||||
pub unsafe fn abs_sub(a: c_float, b: c_float) -> c_float;
|
||||
pub fn abs_sub(a: c_float, b: c_float) -> c_float;
|
||||
#[link_name="floorf"]
|
||||
pub unsafe fn floor(n: c_float) -> c_float;
|
||||
pub fn floor(n: c_float) -> c_float;
|
||||
#[link_name="frexpf"]
|
||||
pub unsafe fn frexp(n: c_float, value: &mut c_int) -> c_float;
|
||||
pub fn frexp(n: c_float, value: &mut c_int) -> c_float;
|
||||
#[link_name="fmaf"]
|
||||
pub unsafe fn mul_add(a: c_float, b: c_float, c: c_float) -> c_float;
|
||||
pub fn mul_add(a: c_float, b: c_float, c: c_float) -> c_float;
|
||||
#[link_name="fmaxf"]
|
||||
pub unsafe fn fmax(a: c_float, b: c_float) -> c_float;
|
||||
pub fn fmax(a: c_float, b: c_float) -> c_float;
|
||||
#[link_name="fminf"]
|
||||
pub unsafe fn fmin(a: c_float, b: c_float) -> c_float;
|
||||
pub fn fmin(a: c_float, b: c_float) -> c_float;
|
||||
#[link_name="nextafterf"]
|
||||
pub unsafe fn next_after(x: c_float, y: c_float) -> c_float;
|
||||
pub fn next_after(x: c_float, y: c_float) -> c_float;
|
||||
#[link_name="hypotf"]
|
||||
pub unsafe fn hypot(x: c_float, y: c_float) -> c_float;
|
||||
pub fn hypot(x: c_float, y: c_float) -> c_float;
|
||||
#[link_name="ldexpf"]
|
||||
pub unsafe fn ldexp(x: c_float, n: c_int) -> c_float;
|
||||
pub fn ldexp(x: c_float, n: c_int) -> c_float;
|
||||
|
||||
#[cfg(unix)]
|
||||
#[link_name="lgammaf_r"]
|
||||
pub unsafe fn lgamma(n: c_float, sign: &mut c_int) -> c_float;
|
||||
pub fn lgamma(n: c_float, sign: &mut c_int) -> c_float;
|
||||
|
||||
#[cfg(windows)]
|
||||
#[link_name="__lgammaf_r"]
|
||||
pub unsafe fn lgamma(n: c_float, sign: &mut c_int) -> c_float;
|
||||
pub fn lgamma(n: c_float, sign: &mut c_int) -> c_float;
|
||||
|
||||
#[link_name="logf"]
|
||||
pub unsafe fn ln(n: c_float) -> c_float;
|
||||
pub fn ln(n: c_float) -> c_float;
|
||||
#[link_name="logbf"]
|
||||
pub unsafe fn log_radix(n: c_float) -> c_float;
|
||||
pub fn log_radix(n: c_float) -> c_float;
|
||||
#[link_name="log1pf"]
|
||||
pub unsafe fn ln_1p(n: c_float) -> c_float;
|
||||
pub fn ln_1p(n: c_float) -> c_float;
|
||||
#[link_name="log2f"]
|
||||
pub unsafe fn log2(n: c_float) -> c_float;
|
||||
pub fn log2(n: c_float) -> c_float;
|
||||
#[link_name="log10f"]
|
||||
pub unsafe fn log10(n: c_float) -> c_float;
|
||||
pub fn log10(n: c_float) -> c_float;
|
||||
#[link_name="ilogbf"]
|
||||
pub unsafe fn ilog_radix(n: c_float) -> c_int;
|
||||
pub fn ilog_radix(n: c_float) -> c_int;
|
||||
#[link_name="modff"]
|
||||
pub unsafe fn modf(n: c_float, iptr: &mut c_float) -> c_float;
|
||||
pub fn modf(n: c_float, iptr: &mut c_float) -> c_float;
|
||||
#[link_name="powf"]
|
||||
pub unsafe fn pow(n: c_float, e: c_float) -> c_float;
|
||||
pub fn pow(n: c_float, e: c_float) -> c_float;
|
||||
// FIXME (#1379): enable when rounding modes become available
|
||||
// #[link_name="rintf"] unsafe fn rint(n: c_float) -> c_float;
|
||||
// #[link_name="rintf"] fn rint(n: c_float) -> c_float;
|
||||
#[link_name="roundf"]
|
||||
pub unsafe fn round(n: c_float) -> c_float;
|
||||
pub fn round(n: c_float) -> c_float;
|
||||
#[link_name="scalbnf"]
|
||||
pub unsafe fn ldexp_radix(n: c_float, i: c_int) -> c_float;
|
||||
pub fn ldexp_radix(n: c_float, i: c_int) -> c_float;
|
||||
#[link_name="sinf"]
|
||||
pub unsafe fn sin(n: c_float) -> c_float;
|
||||
pub fn sin(n: c_float) -> c_float;
|
||||
#[link_name="sinhf"]
|
||||
pub unsafe fn sinh(n: c_float) -> c_float;
|
||||
pub fn sinh(n: c_float) -> c_float;
|
||||
#[link_name="sqrtf"]
|
||||
pub unsafe fn sqrt(n: c_float) -> c_float;
|
||||
pub fn sqrt(n: c_float) -> c_float;
|
||||
#[link_name="tanf"]
|
||||
pub unsafe fn tan(n: c_float) -> c_float;
|
||||
pub fn tan(n: c_float) -> c_float;
|
||||
#[link_name="tanhf"]
|
||||
pub unsafe fn tanh(n: c_float) -> c_float;
|
||||
pub fn tanh(n: c_float) -> c_float;
|
||||
#[link_name="tgammaf"]
|
||||
pub unsafe fn tgamma(n: c_float) -> c_float;
|
||||
pub fn tgamma(n: c_float) -> c_float;
|
||||
#[link_name="truncf"]
|
||||
pub unsafe fn trunc(n: c_float) -> c_float;
|
||||
pub fn trunc(n: c_float) -> c_float;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,11 +61,11 @@ pub mod rustrt {
|
|||
use libc;
|
||||
|
||||
extern {
|
||||
pub unsafe fn rust_get_argc() -> c_int;
|
||||
pub unsafe fn rust_get_argv() -> **c_char;
|
||||
pub unsafe fn rust_path_is_dir(path: *libc::c_char) -> c_int;
|
||||
pub unsafe fn rust_path_exists(path: *libc::c_char) -> c_int;
|
||||
pub unsafe fn rust_set_exit_status(code: libc::intptr_t);
|
||||
pub fn rust_get_argc() -> c_int;
|
||||
pub fn rust_get_argv() -> **c_char;
|
||||
pub fn rust_path_is_dir(path: *libc::c_char) -> c_int;
|
||||
pub fn rust_path_exists(path: *libc::c_char) -> c_int;
|
||||
pub fn rust_set_exit_status(code: libc::intptr_t);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,7 @@ pub fn env() -> ~[(~str,~str)] {
|
|||
#[cfg(unix)]
|
||||
unsafe fn get_env_pairs() -> ~[~str] {
|
||||
extern {
|
||||
unsafe fn rust_env_pairs() -> **libc::c_char;
|
||||
fn rust_env_pairs() -> **libc::c_char;
|
||||
}
|
||||
let environ = rust_env_pairs();
|
||||
if (environ as uint == 0) {
|
||||
|
@ -694,7 +694,7 @@ pub fn list_dir(p: &Path) -> ~[~str] {
|
|||
use libc::{dirent_t};
|
||||
use libc::{opendir, readdir, closedir};
|
||||
extern {
|
||||
unsafe fn rust_list_dir_val(ptr: *dirent_t) -> *libc::c_char;
|
||||
fn rust_list_dir_val(ptr: *dirent_t) -> *libc::c_char;
|
||||
}
|
||||
let input = p.to_str();
|
||||
let mut strings = ~[];
|
||||
|
@ -735,9 +735,8 @@ pub fn list_dir(p: &Path) -> ~[~str] {
|
|||
|
||||
#[nolink]
|
||||
extern {
|
||||
unsafe fn rust_list_dir_wfd_size() -> libc::size_t;
|
||||
unsafe fn rust_list_dir_wfd_fp_buf(wfd: *libc::c_void)
|
||||
-> *u16;
|
||||
fn rust_list_dir_wfd_size() -> libc::size_t;
|
||||
fn rust_list_dir_wfd_fp_buf(wfd: *libc::c_void) -> *u16;
|
||||
}
|
||||
fn star(p: &Path) -> Path { p.push("*") }
|
||||
do as_utf16_p(star(p).to_str()) |path_ptr| {
|
||||
|
@ -964,7 +963,7 @@ pub fn errno() -> int {
|
|||
fn errno_location() -> *c_int {
|
||||
#[nolink]
|
||||
extern {
|
||||
unsafe fn __error() -> *c_int;
|
||||
fn __error() -> *c_int;
|
||||
}
|
||||
unsafe {
|
||||
__error()
|
||||
|
@ -976,7 +975,7 @@ pub fn errno() -> int {
|
|||
fn errno_location() -> *c_int {
|
||||
#[nolink]
|
||||
extern {
|
||||
unsafe fn __errno_location() -> *c_int;
|
||||
fn __errno_location() -> *c_int;
|
||||
}
|
||||
unsafe {
|
||||
__errno_location()
|
||||
|
@ -996,7 +995,7 @@ pub fn errno() -> uint {
|
|||
#[link_name = "kernel32"]
|
||||
#[abi = "stdcall"]
|
||||
extern "stdcall" {
|
||||
unsafe fn GetLastError() -> DWORD;
|
||||
fn GetLastError() -> DWORD;
|
||||
}
|
||||
|
||||
unsafe {
|
||||
|
@ -1011,11 +1010,12 @@ pub fn last_os_error() -> ~str {
|
|||
#[cfg(target_os = "macos")]
|
||||
#[cfg(target_os = "android")]
|
||||
#[cfg(target_os = "freebsd")]
|
||||
fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) -> c_int {
|
||||
fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t)
|
||||
-> c_int {
|
||||
#[nolink]
|
||||
extern {
|
||||
unsafe fn strerror_r(errnum: c_int, buf: *mut c_char,
|
||||
buflen: size_t) -> c_int;
|
||||
fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t)
|
||||
-> c_int;
|
||||
}
|
||||
unsafe {
|
||||
strerror_r(errnum, buf, buflen)
|
||||
|
@ -1029,8 +1029,10 @@ pub fn last_os_error() -> ~str {
|
|||
fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) -> c_int {
|
||||
#[nolink]
|
||||
extern {
|
||||
unsafe fn __xpg_strerror_r(errnum: c_int, buf: *mut c_char,
|
||||
buflen: size_t) -> c_int;
|
||||
fn __xpg_strerror_r(errnum: c_int,
|
||||
buf: *mut c_char,
|
||||
buflen: size_t)
|
||||
-> c_int;
|
||||
}
|
||||
unsafe {
|
||||
__xpg_strerror_r(errnum, buf, buflen)
|
||||
|
@ -1058,10 +1060,14 @@ pub fn last_os_error() -> ~str {
|
|||
#[link_name = "kernel32"]
|
||||
#[abi = "stdcall"]
|
||||
extern "stdcall" {
|
||||
unsafe fn FormatMessageA(flags: DWORD, lpSrc: LPVOID,
|
||||
msgId: DWORD, langId: DWORD,
|
||||
buf: LPSTR, nsize: DWORD,
|
||||
args: *c_void) -> DWORD;
|
||||
fn FormatMessageA(flags: DWORD,
|
||||
lpSrc: LPVOID,
|
||||
msgId: DWORD,
|
||||
langId: DWORD,
|
||||
buf: LPSTR,
|
||||
nsize: DWORD,
|
||||
args: *c_void)
|
||||
-> DWORD;
|
||||
}
|
||||
|
||||
static FORMAT_MESSAGE_FROM_SYSTEM: DWORD = 0x00001000;
|
||||
|
|
|
@ -258,19 +258,17 @@ pub mod rustrt {
|
|||
|
||||
extern {
|
||||
#[rust_stack]
|
||||
pub unsafe fn rust_get_task() -> *rust_task;
|
||||
pub fn rust_get_task() -> *rust_task;
|
||||
#[rust_stack]
|
||||
pub unsafe fn rust_task_ref(task: *rust_task);
|
||||
pub unsafe fn rust_task_deref(task: *rust_task);
|
||||
pub fn rust_task_ref(task: *rust_task);
|
||||
pub fn rust_task_deref(task: *rust_task);
|
||||
|
||||
#[rust_stack]
|
||||
pub unsafe fn task_clear_event_reject(task: *rust_task);
|
||||
pub fn task_clear_event_reject(task: *rust_task);
|
||||
|
||||
pub unsafe fn task_wait_event(this: *rust_task,
|
||||
killed: &mut *libc::c_void)
|
||||
pub fn task_wait_event(this: *rust_task, killed: &mut *libc::c_void)
|
||||
-> bool;
|
||||
pub unsafe fn task_signal_event(target: *rust_task,
|
||||
event: *libc::c_void);
|
||||
pub fn task_signal_event(target: *rust_task, event: *libc::c_void);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -252,8 +252,8 @@ pub mod rustrt {
|
|||
use libc::size_t;
|
||||
|
||||
extern {
|
||||
pub unsafe fn rand_seed_size() -> size_t;
|
||||
pub unsafe fn rand_gen_seed(buf: *mut u8, sz: size_t);
|
||||
pub fn rand_seed_size() -> size_t;
|
||||
pub fn rand_gen_seed(buf: *mut u8, sz: size_t);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1085,10 +1085,9 @@ mod test {
|
|||
pub enum rust_rng {}
|
||||
|
||||
extern {
|
||||
pub unsafe fn rand_new_seeded(buf: *u8, sz: size_t)
|
||||
-> *rust_rng;
|
||||
pub unsafe fn rand_next(rng: *rust_rng) -> u32;
|
||||
pub unsafe fn rand_free(rng: *rust_rng);
|
||||
pub fn rand_new_seeded(buf: *u8, sz: size_t) -> *rust_rng;
|
||||
pub fn rand_next(rng: *rust_rng) -> u32;
|
||||
pub fn rand_free(rng: *rust_rng);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ pub unsafe fn local_free(ptr: *libc::c_char) {
|
|||
|
||||
extern {
|
||||
#[fast_ffi]
|
||||
unsafe fn rust_upcall_free_noswitch(ptr: *libc::c_char);
|
||||
fn rust_upcall_free_noswitch(ptr: *libc::c_char);
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
|
|
|
@ -49,7 +49,7 @@ impl Drop for Thread {
|
|||
}
|
||||
|
||||
extern {
|
||||
pub unsafe fn rust_raw_thread_start(f: &(~fn())) -> *raw_thread;
|
||||
pub unsafe fn rust_raw_thread_join(thread: *raw_thread);
|
||||
pub unsafe fn rust_raw_thread_delete(thread: *raw_thread);
|
||||
pub fn rust_raw_thread_start(f: &(~fn())) -> *raw_thread;
|
||||
pub fn rust_raw_thread_join(thread: *raw_thread);
|
||||
pub fn rust_raw_thread_delete(thread: *raw_thread);
|
||||
}
|
||||
|
|
|
@ -639,8 +639,8 @@ fn spawn_process_os(prog: &str, args: &[~str],
|
|||
|
||||
#[abi = "cdecl"]
|
||||
extern {
|
||||
pub unsafe fn rust_unset_sigprocmask();
|
||||
pub unsafe fn rust_set_environ(envp: *c_void);
|
||||
pub fn rust_unset_sigprocmask();
|
||||
pub fn rust_set_environ(envp: *c_void);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,9 +27,7 @@ pub mod rustrt {
|
|||
|
||||
extern {
|
||||
#[rust_stack]
|
||||
pub unsafe fn rust_upcall_fail(expr: *c_char,
|
||||
file: *c_char,
|
||||
line: size_t);
|
||||
pub fn rust_upcall_fail(expr: *c_char, file: *c_char, line: size_t);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1078,12 +1078,12 @@ mod testrt {
|
|||
|
||||
#[nolink]
|
||||
extern {
|
||||
pub unsafe fn rust_dbg_lock_create() -> *libc::c_void;
|
||||
pub unsafe fn rust_dbg_lock_destroy(lock: *libc::c_void);
|
||||
pub unsafe fn rust_dbg_lock_lock(lock: *libc::c_void);
|
||||
pub unsafe fn rust_dbg_lock_unlock(lock: *libc::c_void);
|
||||
pub unsafe fn rust_dbg_lock_wait(lock: *libc::c_void);
|
||||
pub unsafe fn rust_dbg_lock_signal(lock: *libc::c_void);
|
||||
pub fn rust_dbg_lock_create() -> *libc::c_void;
|
||||
pub fn rust_dbg_lock_destroy(lock: *libc::c_void);
|
||||
pub fn rust_dbg_lock_lock(lock: *libc::c_void);
|
||||
pub fn rust_dbg_lock_unlock(lock: *libc::c_void);
|
||||
pub fn rust_dbg_lock_wait(lock: *libc::c_void);
|
||||
pub fn rust_dbg_lock_signal(lock: *libc::c_void);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -296,16 +296,16 @@ extern "rust-intrinsic" {
|
|||
/// `init` is unsafe because it returns a zeroed-out datum,
|
||||
/// which is unsafe unless T is POD. We don't have a POD
|
||||
/// kind yet. (See #4074).
|
||||
pub unsafe fn init<T>() -> T;
|
||||
pub fn init<T>() -> T;
|
||||
|
||||
/// Create an uninitialized value.
|
||||
pub unsafe fn uninit<T>() -> T;
|
||||
pub fn uninit<T>() -> T;
|
||||
|
||||
/// Move a value out of scope without running drop glue.
|
||||
///
|
||||
/// `forget` is unsafe because the caller is responsible for
|
||||
/// ensuring the argument is deallocated already.
|
||||
pub unsafe fn forget<T>(_: T) -> ();
|
||||
pub fn forget<T>(_: T) -> ();
|
||||
pub fn transmute<T,U>(e: T) -> U;
|
||||
|
||||
/// Returns `true` if a type requires drop glue.
|
||||
|
|
|
@ -28,17 +28,12 @@ pub mod rustrt {
|
|||
|
||||
extern {
|
||||
#[rust_stack]
|
||||
pub unsafe fn rust_upcall_malloc(td: *c_char, size: uintptr_t)
|
||||
-> *c_char;
|
||||
|
||||
pub fn rust_upcall_malloc(td: *c_char, size: uintptr_t) -> *c_char;
|
||||
#[rust_stack]
|
||||
pub unsafe fn rust_upcall_free(ptr: *c_char);
|
||||
|
||||
pub fn rust_upcall_free(ptr: *c_char);
|
||||
#[fast_ffi]
|
||||
pub unsafe fn rust_upcall_malloc_noswitch(td: *c_char,
|
||||
size: uintptr_t)
|
||||
pub fn rust_upcall_malloc_noswitch(td: *c_char, size: uintptr_t)
|
||||
-> *c_char;
|
||||
|
||||
#[rust_stack]
|
||||
pub fn rust_try_get_task() -> *rust_task;
|
||||
}
|
||||
|
|
|
@ -1077,7 +1077,7 @@ pub struct foreign_item {
|
|||
|
||||
#[deriving(Eq, Encodable, Decodable,IterBytes)]
|
||||
pub enum foreign_item_ {
|
||||
foreign_item_fn(fn_decl, purity, Generics),
|
||||
foreign_item_fn(fn_decl, Generics),
|
||||
foreign_item_static(Ty, /* is_mutbl */ bool),
|
||||
}
|
||||
|
||||
|
|
|
@ -223,7 +223,7 @@ fn noop_fold_foreign_item(ni: @foreign_item, fld: @ast_fold)
|
|||
attrs: ni.attrs.map(|x| fold_attribute(*x)),
|
||||
node:
|
||||
match ni.node {
|
||||
foreign_item_fn(ref fdec, purity, ref generics) => {
|
||||
foreign_item_fn(ref fdec, ref generics) => {
|
||||
foreign_item_fn(
|
||||
ast::fn_decl {
|
||||
inputs: fdec.inputs.map(|a|
|
||||
|
@ -231,7 +231,6 @@ fn noop_fold_foreign_item(ni: @foreign_item, fld: @ast_fold)
|
|||
output: fld.fold_ty(&fdec.output),
|
||||
cf: fdec.cf,
|
||||
},
|
||||
purity,
|
||||
fold_generics(generics, fld))
|
||||
}
|
||||
foreign_item_static(ref t, m) => {
|
||||
|
|
|
@ -339,7 +339,7 @@ pub fn visit_pat<E:Clone>(p: &pat, (e, v): (E, vt<E>)) {
|
|||
|
||||
pub fn visit_foreign_item<E:Clone>(ni: &foreign_item, (e, v): (E, vt<E>)) {
|
||||
match ni.node {
|
||||
foreign_item_fn(ref fd, _, ref generics) => {
|
||||
foreign_item_fn(ref fd, ref generics) => {
|
||||
visit_fn_decl(fd, (e.clone(), v));
|
||||
(v.visit_generics)(generics, (e, v));
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ pub enum ObsoleteSyntax {
|
|||
ObsoleteMultipleLocalDecl,
|
||||
ObsoleteMutWithMultipleBindings,
|
||||
ObsoleteExternVisibility,
|
||||
ObsoleteUnsafeExternFn,
|
||||
}
|
||||
|
||||
impl to_bytes::IterBytes for ObsoleteSyntax {
|
||||
|
@ -246,7 +247,12 @@ impl ParserObsoleteMethods for Parser {
|
|||
"`pub extern` or `priv extern`",
|
||||
"place the `pub` or `priv` on the individual external items \
|
||||
instead"
|
||||
)
|
||||
),
|
||||
ObsoleteUnsafeExternFn => (
|
||||
"unsafe external function",
|
||||
"external functions are always unsafe; remove the `unsafe` \
|
||||
keyword"
|
||||
),
|
||||
};
|
||||
|
||||
self.report(sp, kind, kind_str, desc);
|
||||
|
|
|
@ -84,7 +84,8 @@ use parse::obsolete::{ObsoletePurity, ObsoleteStaticMethod};
|
|||
use parse::obsolete::{ObsoleteConstItem, ObsoleteFixedLengthVectorType};
|
||||
use parse::obsolete::{ObsoleteNamedExternModule, ObsoleteMultipleLocalDecl};
|
||||
use parse::obsolete::{ObsoleteMutWithMultipleBindings};
|
||||
use parse::obsolete::{ObsoleteExternVisibility, ParserObsoleteMethods};
|
||||
use parse::obsolete::{ObsoleteExternVisibility, ObsoleteUnsafeExternFn};
|
||||
use parse::obsolete::{ParserObsoleteMethods};
|
||||
use parse::token::{can_begin_expr, get_ident_interner, ident_to_str, is_ident};
|
||||
use parse::token::{is_ident_or_path};
|
||||
use parse::token::{is_plain_ident, INTERPOLATED, keywords, special_idents};
|
||||
|
@ -4066,14 +4067,20 @@ impl Parser {
|
|||
fn parse_item_foreign_fn(&self, attrs: ~[Attribute]) -> @foreign_item {
|
||||
let lo = self.span.lo;
|
||||
let vis = self.parse_visibility();
|
||||
|
||||
// Parse obsolete purity.
|
||||
let purity = self.parse_fn_purity();
|
||||
if purity != impure_fn {
|
||||
self.obsolete(*self.last_span, ObsoleteUnsafeExternFn);
|
||||
}
|
||||
|
||||
let (ident, generics) = self.parse_fn_header();
|
||||
let decl = self.parse_fn_decl();
|
||||
let hi = self.span.hi;
|
||||
self.expect(&token::SEMI);
|
||||
@ast::foreign_item { ident: ident,
|
||||
attrs: attrs,
|
||||
node: foreign_item_fn(decl, purity, generics),
|
||||
node: foreign_item_fn(decl, generics),
|
||||
id: self.get_id(),
|
||||
span: mk_sp(lo, hi),
|
||||
vis: vis }
|
||||
|
|
|
@ -454,8 +454,8 @@ pub fn print_foreign_item(s: @ps, item: &ast::foreign_item) {
|
|||
maybe_print_comment(s, item.span.lo);
|
||||
print_outer_attributes(s, item.attrs);
|
||||
match item.node {
|
||||
ast::foreign_item_fn(ref decl, purity, ref generics) => {
|
||||
print_fn(s, decl, Some(purity), AbiSet::Rust(), item.ident, generics, None,
|
||||
ast::foreign_item_fn(ref decl, ref generics) => {
|
||||
print_fn(s, decl, None, AbiSet::Rust(), item.ident, generics, None,
|
||||
item.vis);
|
||||
end(s); // end head-ibox
|
||||
word(s.s, ";");
|
||||
|
|
|
@ -317,7 +317,7 @@ pub fn visit_foreign_item<E:Clone>(visitor: @Visitor<E>,
|
|||
foreign_item: &foreign_item,
|
||||
env: E) {
|
||||
match foreign_item.node {
|
||||
foreign_item_fn(ref function_declaration, _, ref generics) => {
|
||||
foreign_item_fn(ref function_declaration, ref generics) => {
|
||||
visit_fn_decl(visitor, function_declaration, env.clone());
|
||||
visitor.visit_generics(generics, env)
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ fn main() {
|
|||
|
||||
foreach y in range(0, 256) {
|
||||
foreach x in range(0, 256) {
|
||||
print((symbols[pixels[y*256+x] / 0.2f32) as int]);
|
||||
print(symbols[(pixels[y*256+x] / 0.2f32) as int]);
|
||||
}
|
||||
println("");
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
mod test {
|
||||
#[abi = "cdecl"]
|
||||
extern {
|
||||
pub unsafe fn free();
|
||||
pub fn free();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
extern {
|
||||
pub unsafe fn free(p: *u8);
|
||||
pub fn free(p: *u8);
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue