1
Fork 0

librustc: Remove pub extern and priv extern from the language.

Place `pub` or `priv` on individual items instead.
This commit is contained in:
Patrick Walton 2013-07-18 19:08:57 -07:00
parent bb8ca1f52c
commit 06594ed96b
85 changed files with 818 additions and 694 deletions

View file

@ -25,7 +25,7 @@ pub mod rustrt {
use std::unstable::intrinsics::{TyDesc}; use std::unstable::intrinsics::{TyDesc};
#[abi = "cdecl"] #[abi = "cdecl"]
pub extern { extern {
pub unsafe fn debug_tydesc(td: *TyDesc); pub unsafe fn debug_tydesc(td: *TyDesc);
pub unsafe fn debug_opaque(td: *TyDesc, x: *()); pub unsafe fn debug_opaque(td: *TyDesc, x: *());
pub unsafe fn debug_box(td: *TyDesc, x: *()); pub unsafe fn debug_box(td: *TyDesc, x: *());

View file

@ -24,18 +24,18 @@ pub mod rustrt {
use std::libc::{c_int, c_void, size_t}; use std::libc::{c_int, c_void, size_t};
#[link_name = "rustrt"] #[link_name = "rustrt"]
pub extern { extern {
unsafe fn tdefl_compress_mem_to_heap(psrc_buf: *const c_void, pub unsafe fn tdefl_compress_mem_to_heap(psrc_buf: *const c_void,
src_buf_len: size_t, src_buf_len: size_t,
pout_len: *mut size_t, pout_len: *mut size_t,
flags: c_int) flags: c_int)
-> *c_void; -> *c_void;
unsafe fn tinfl_decompress_mem_to_heap(psrc_buf: *const c_void, pub unsafe fn tinfl_decompress_mem_to_heap(psrc_buf: *const c_void,
src_buf_len: size_t, src_buf_len: size_t,
pout_len: *mut size_t, pout_len: *mut size_t,
flags: c_int) flags: c_int)
-> *c_void; -> *c_void;
} }
} }

View file

@ -35,11 +35,11 @@ pub mod rustrt {
use std::libc; use std::libc;
#[nolink] #[nolink]
pub extern { extern {
unsafe fn rust_uv_current_kernel_malloc(size: libc::c_uint) pub unsafe fn rust_uv_current_kernel_malloc(size: libc::c_uint)
-> *libc::c_void; -> *libc::c_void;
unsafe fn rust_uv_current_kernel_free(mem: *libc::c_void); pub unsafe fn rust_uv_current_kernel_free(mem: *libc::c_void);
unsafe fn rust_uv_helper_uv_tcp_t_size() -> libc::c_uint; pub unsafe fn rust_uv_helper_uv_tcp_t_size() -> libc::c_uint;
} }
} }

View file

@ -19,7 +19,7 @@ use std::str;
pub mod rustrt { pub mod rustrt {
use std::libc::{c_char, c_int}; use std::libc::{c_char, c_int};
pub extern { extern {
pub unsafe fn linenoise(prompt: *c_char) -> *c_char; pub unsafe fn linenoise(prompt: *c_char) -> *c_char;
pub unsafe fn linenoiseHistoryAdd(line: *c_char) -> c_int; pub unsafe fn linenoiseHistoryAdd(line: *c_char) -> c_int;
pub unsafe fn linenoiseHistorySetMaxLen(len: c_int) -> c_int; pub unsafe fn linenoiseHistorySetMaxLen(len: c_int) -> c_int;

View file

@ -22,7 +22,7 @@ pub mod rustrt {
use super::Tm; use super::Tm;
#[abi = "cdecl"] #[abi = "cdecl"]
pub extern { extern {
pub unsafe fn get_time(sec: &mut i64, nsec: &mut i32); pub unsafe fn get_time(sec: &mut i64, nsec: &mut i32);
pub unsafe fn precise_time_ns(ns: &mut u64); pub unsafe fn precise_time_ns(ns: &mut u64);

View file

@ -161,15 +161,15 @@ pub mod icu {
pub mod libicu { pub mod libicu {
#[link_name = "icuuc"] #[link_name = "icuuc"]
#[abi = "cdecl"] #[abi = "cdecl"]
pub extern { extern {
unsafe fn u_hasBinaryProperty(c: UChar32, which: UProperty) pub unsafe fn u_hasBinaryProperty(c: UChar32, which: UProperty)
-> UBool; -> UBool;
unsafe fn u_isdigit(c: UChar32) -> UBool; pub unsafe fn u_isdigit(c: UChar32) -> UBool;
unsafe fn u_islower(c: UChar32) -> UBool; pub unsafe fn u_islower(c: UChar32) -> UBool;
unsafe fn u_isspace(c: UChar32) -> UBool; pub unsafe fn u_isspace(c: UChar32) -> UBool;
unsafe fn u_isupper(c: UChar32) -> UBool; pub unsafe fn u_isupper(c: UChar32) -> UBool;
unsafe fn u_tolower(c: UChar32) -> UChar32; pub unsafe fn u_tolower(c: UChar32) -> UChar32;
unsafe fn u_toupper(c: UChar32) -> UChar32; pub unsafe fn u_toupper(c: UChar32) -> UChar32;
} }
} }
} }

View file

@ -273,7 +273,7 @@ pub mod llvm {
#[link_args = "-Lrustllvm -lrustllvm"] #[link_args = "-Lrustllvm -lrustllvm"]
#[link_name = "rustllvm"] #[link_name = "rustllvm"]
#[abi = "cdecl"] #[abi = "cdecl"]
pub extern { extern {
/* Create and destroy contexts. */ /* Create and destroy contexts. */
#[fast_ffi] #[fast_ffi]
pub unsafe fn LLVMContextCreate() -> ContextRef; pub unsafe fn LLVMContextCreate() -> ContextRef;

View file

@ -166,7 +166,7 @@ pub mod rustrt {
use libc::c_void; use libc::c_void;
#[link_name = "rustrt"] #[link_name = "rustrt"]
pub extern { extern {
#[rust_stack] #[rust_stack]
// FIXME (#4386): Unable to make following method private. // FIXME (#4386): Unable to make following method private.
pub unsafe fn rust_get_task() -> *c_void; pub unsafe fn rust_get_task() -> *c_void;

View file

@ -64,7 +64,7 @@ pub mod rustrt {
use super::StackSegment; use super::StackSegment;
#[link_name = "rustrt"] #[link_name = "rustrt"]
pub extern { extern {
#[rust_stack] #[rust_stack]
pub unsafe fn rust_gc_metadata() -> *Word; pub unsafe fn rust_gc_metadata() -> *Word;

View file

@ -77,10 +77,10 @@ pub mod rustrt {
#[abi = "cdecl"] #[abi = "cdecl"]
#[link_name = "rustrt"] #[link_name = "rustrt"]
pub extern { extern {
unsafe fn rust_get_stdin() -> *libc::FILE; pub unsafe fn rust_get_stdin() -> *libc::FILE;
unsafe fn rust_get_stdout() -> *libc::FILE; pub unsafe fn rust_get_stdout() -> *libc::FILE;
unsafe fn rust_get_stderr() -> *libc::FILE; pub unsafe fn rust_get_stderr() -> *libc::FILE;
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -104,11 +104,11 @@ fn newsched_log_str(msg: ~str) {
pub mod rustrt { pub mod rustrt {
use libc; use libc;
pub extern { extern {
unsafe fn rust_log_console_on(); pub unsafe fn rust_log_console_on();
unsafe fn rust_log_console_off(); pub unsafe fn rust_log_console_off();
unsafe fn rust_log_str(level: u32, pub unsafe fn rust_log_str(level: u32,
string: *libc::c_char, string: *libc::c_char,
size: libc::size_t); size: libc::size_t);
} }
} }

View file

@ -19,81 +19,86 @@ pub mod c_double_utils {
#[link_name = "m"] #[link_name = "m"]
#[abi = "cdecl"] #[abi = "cdecl"]
pub extern { extern {
// Alpabetically sorted by link_name // Alpabetically sorted by link_name
unsafe fn acos(n: c_double) -> c_double; pub unsafe fn acos(n: c_double) -> c_double;
unsafe fn asin(n: c_double) -> c_double; pub unsafe fn asin(n: c_double) -> c_double;
unsafe fn atan(n: c_double) -> c_double; pub unsafe fn atan(n: c_double) -> c_double;
unsafe fn atan2(a: c_double, b: c_double) -> c_double; pub unsafe fn atan2(a: c_double, b: c_double) -> c_double;
unsafe fn cbrt(n: c_double) -> c_double; pub unsafe fn cbrt(n: c_double) -> c_double;
unsafe fn ceil(n: c_double) -> c_double; pub unsafe fn ceil(n: c_double) -> c_double;
unsafe fn copysign(x: c_double, y: c_double) -> c_double; pub unsafe fn copysign(x: c_double, y: c_double) -> c_double;
unsafe fn cos(n: c_double) -> c_double; pub unsafe fn cos(n: c_double) -> c_double;
unsafe fn cosh(n: c_double) -> c_double; pub unsafe fn cosh(n: c_double) -> c_double;
unsafe fn erf(n: c_double) -> c_double; pub unsafe fn erf(n: c_double) -> c_double;
unsafe fn erfc(n: c_double) -> c_double; pub unsafe fn erfc(n: c_double) -> c_double;
unsafe fn exp(n: c_double) -> c_double; pub unsafe fn exp(n: c_double) -> c_double;
// rename: for consistency with underscore usage elsewhere // rename: for consistency with underscore usage elsewhere
#[link_name="expm1"] unsafe fn exp_m1(n: c_double) -> c_double; #[link_name="expm1"] unsafe fn exp_m1(n: c_double) -> c_double;
unsafe fn exp2(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="fabs"] unsafe fn abs(n: c_double) -> c_double;
// rename: for clarity and consistency with add/sub/mul/div // rename: for clarity and consistency with add/sub/mul/div
#[link_name="fdim"] #[link_name="fdim"]
unsafe fn abs_sub(a: c_double, b: c_double) -> c_double; pub unsafe fn abs_sub(a: c_double, b: c_double) -> c_double;
unsafe fn floor(n: c_double) -> c_double; pub unsafe fn floor(n: c_double) -> c_double;
// rename: for clarity and consistency with add/sub/mul/div // rename: for clarity and consistency with add/sub/mul/div
#[link_name="fma"] #[link_name="fma"]
unsafe fn mul_add(a: c_double, b: c_double, c: c_double) -> c_double; pub unsafe fn mul_add(a: c_double, b: c_double, c: c_double)
-> c_double;
#[link_name="fmax"] #[link_name="fmax"]
unsafe fn fmax(a: c_double, b: c_double) -> c_double; pub unsafe fn fmax(a: c_double, b: c_double) -> c_double;
#[link_name="fmin"] #[link_name="fmin"]
unsafe fn fmin(a: c_double, b: c_double) -> c_double; pub unsafe fn fmin(a: c_double, b: c_double) -> c_double;
#[link_name="nextafter"] #[link_name="nextafter"]
unsafe fn next_after(x: c_double, y: c_double) -> c_double; pub unsafe fn next_after(x: c_double, y: c_double) -> c_double;
unsafe fn frexp(n: c_double, value: &mut c_int) -> c_double; pub unsafe fn frexp(n: c_double, value: &mut c_int) -> c_double;
unsafe fn hypot(x: c_double, y: c_double) -> c_double; pub unsafe fn hypot(x: c_double, y: c_double) -> c_double;
unsafe fn ldexp(x: c_double, n: c_int) -> c_double; pub unsafe fn ldexp(x: c_double, n: c_int) -> c_double;
#[cfg(unix)] #[cfg(unix)]
#[link_name="lgamma_r"] #[link_name="lgamma_r"]
unsafe fn lgamma(n: c_double, sign: &mut c_int) -> c_double; pub unsafe fn lgamma(n: c_double, sign: &mut c_int) -> c_double;
#[cfg(windows)] #[cfg(windows)]
#[link_name="__lgamma_r"] #[link_name="__lgamma_r"]
unsafe fn lgamma(n: c_double, sign: &mut c_int) -> c_double; pub unsafe fn lgamma(n: c_double, sign: &mut c_int) -> c_double;
// renamed: log is a reserved keyword; ln seems more natural, too // renamed: ln seems more natural
#[link_name="log"] unsafe fn ln(n: c_double) -> c_double; #[link_name="log"]
pub unsafe fn ln(n: c_double) -> c_double;
// renamed: "logb" /often/ is confused for log2 by beginners // renamed: "logb" /often/ is confused for log2 by beginners
#[link_name="logb"] unsafe fn log_radix(n: c_double) -> c_double; #[link_name="logb"]
pub unsafe fn log_radix(n: c_double) -> c_double;
// renamed: to be consitent with log as ln // renamed: to be consitent with log as ln
#[link_name="log1p"] unsafe fn ln_1p(n: c_double) -> c_double; #[link_name="log1p"]
unsafe fn log10(n: c_double) -> c_double; pub unsafe fn ln_1p(n: c_double) -> c_double;
unsafe fn log2(n: c_double) -> c_double; pub unsafe fn log10(n: c_double) -> c_double;
#[link_name="ilogb"] unsafe fn ilog_radix(n: c_double) -> c_int; pub unsafe fn log2(n: c_double) -> c_double;
unsafe fn modf(n: c_double, iptr: &mut c_double) -> c_double; #[link_name="ilogb"]
unsafe fn pow(n: c_double, e: c_double) -> c_double; 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;
// FIXME (#1379): enable when rounding modes become available // FIXME (#1379): enable when rounding modes become available
// unsafe fn rint(n: c_double) -> c_double; // unsafe fn rint(n: c_double) -> c_double;
unsafe fn round(n: c_double) -> c_double; pub unsafe fn round(n: c_double) -> c_double;
// rename: for consistency with logradix // rename: for consistency with logradix
#[link_name="scalbn"] unsafe fn ldexp_radix(n: c_double, i: c_int) -> #[link_name="scalbn"]
c_double; pub unsafe fn ldexp_radix(n: c_double, i: c_int) -> c_double;
unsafe fn sin(n: c_double) -> c_double; pub unsafe fn sin(n: c_double) -> c_double;
unsafe fn sinh(n: c_double) -> c_double; pub unsafe fn sinh(n: c_double) -> c_double;
unsafe fn sqrt(n: c_double) -> c_double; pub unsafe fn sqrt(n: c_double) -> c_double;
unsafe fn tan(n: c_double) -> c_double; pub unsafe fn tan(n: c_double) -> c_double;
unsafe fn tanh(n: c_double) -> c_double; pub unsafe fn tanh(n: c_double) -> c_double;
unsafe fn tgamma(n: c_double) -> c_double; pub unsafe fn tgamma(n: c_double) -> c_double;
unsafe fn trunc(n: c_double) -> c_double; pub unsafe fn trunc(n: c_double) -> c_double;
// These are commonly only available for doubles // These are commonly only available for doubles
unsafe fn j0(n: c_double) -> c_double; pub unsafe fn j0(n: c_double) -> c_double;
unsafe fn j1(n: c_double) -> c_double; pub unsafe fn j1(n: c_double) -> c_double;
unsafe fn jn(i: c_int, n: c_double) -> c_double; pub unsafe fn jn(i: c_int, n: c_double) -> c_double;
unsafe fn y0(n: c_double) -> c_double; pub unsafe fn y0(n: c_double) -> c_double;
unsafe fn y1(n: c_double) -> c_double; pub unsafe fn y1(n: c_double) -> c_double;
unsafe fn yn(i: c_int, n: c_double) -> c_double; pub unsafe fn yn(i: c_int, n: c_double) -> c_double;
} }
} }
@ -102,73 +107,102 @@ pub mod c_float_utils {
#[link_name = "m"] #[link_name = "m"]
#[abi = "cdecl"] #[abi = "cdecl"]
pub extern { extern {
// Alpabetically sorted by link_name // Alpabetically sorted by link_name
#[link_name="acosf"] unsafe fn acos(n: c_float) -> c_float; #[link_name="acosf"]
#[link_name="asinf"] unsafe fn asin(n: c_float) -> c_float; pub unsafe fn acos(n: c_float) -> c_float;
#[link_name="atanf"] unsafe fn atan(n: c_float) -> c_float; #[link_name="asinf"]
pub unsafe fn asin(n: c_float) -> c_float;
#[link_name="atanf"]
pub unsafe fn atan(n: c_float) -> c_float;
#[link_name="atan2f"] #[link_name="atan2f"]
unsafe fn atan2(a: c_float, b: c_float) -> c_float; pub unsafe fn atan2(a: c_float, b: c_float) -> c_float;
#[link_name="cbrtf"] unsafe fn cbrt(n: c_float) -> c_float; #[link_name="cbrtf"]
#[link_name="ceilf"] unsafe fn ceil(n: c_float) -> c_float; pub unsafe fn cbrt(n: c_float) -> c_float;
#[link_name="copysignf"] unsafe fn copysign(x: c_float, #[link_name="ceilf"]
y: c_float) -> c_float; pub unsafe fn ceil(n: c_float) -> c_float;
#[link_name="cosf"] unsafe fn cos(n: c_float) -> c_float; #[link_name="copysignf"]
#[link_name="coshf"] unsafe fn cosh(n: c_float) -> c_float; pub unsafe fn copysign(x: c_float, y: c_float) -> c_float;
#[link_name="erff"] unsafe fn erf(n: c_float) -> c_float; #[link_name="cosf"]
#[link_name="erfcf"] unsafe fn erfc(n: c_float) -> c_float; pub unsafe fn cos(n: c_float) -> c_float;
#[link_name="expf"] unsafe fn exp(n: c_float) -> c_float; #[link_name="coshf"]
#[link_name="expm1f"]unsafe fn exp_m1(n: c_float) -> c_float; pub unsafe fn cosh(n: c_float) -> c_float;
#[link_name="exp2f"] unsafe fn exp2(n: c_float) -> c_float; #[link_name="erff"]
#[link_name="fabsf"] unsafe fn abs(n: c_float) -> c_float; pub unsafe fn erf(n: c_float) -> c_float;
#[link_name="erfcf"]
pub unsafe fn erfc(n: c_float) -> c_float;
#[link_name="expf"]
pub unsafe fn exp(n: c_float) -> c_float;
#[link_name="expm1f"]
pub unsafe fn exp_m1(n: c_float) -> c_float;
#[link_name="exp2f"]
pub unsafe fn exp2(n: c_float) -> c_float;
#[link_name="fabsf"]
pub unsafe fn abs(n: c_float) -> c_float;
#[link_name="fdimf"] #[link_name="fdimf"]
unsafe fn abs_sub(a: c_float, b: c_float) -> c_float; pub unsafe fn abs_sub(a: c_float, b: c_float) -> c_float;
#[link_name="floorf"] unsafe fn floor(n: c_float) -> c_float; #[link_name="floorf"]
#[link_name="frexpf"] unsafe fn frexp(n: c_float, pub unsafe fn floor(n: c_float) -> c_float;
value: &mut c_int) -> c_float; #[link_name="frexpf"]
pub unsafe fn frexp(n: c_float, value: &mut c_int) -> c_float;
#[link_name="fmaf"] #[link_name="fmaf"]
unsafe fn mul_add(a: c_float, b: c_float, c: c_float) -> c_float; pub unsafe fn mul_add(a: c_float, b: c_float, c: c_float) -> c_float;
#[link_name="fmaxf"] #[link_name="fmaxf"]
unsafe fn fmax(a: c_float, b: c_float) -> c_float; pub unsafe fn fmax(a: c_float, b: c_float) -> c_float;
#[link_name="fminf"] #[link_name="fminf"]
unsafe fn fmin(a: c_float, b: c_float) -> c_float; pub unsafe fn fmin(a: c_float, b: c_float) -> c_float;
#[link_name="nextafterf"] #[link_name="nextafterf"]
unsafe fn next_after(x: c_float, y: c_float) -> c_float; pub unsafe fn next_after(x: c_float, y: c_float) -> c_float;
#[link_name="hypotf"] #[link_name="hypotf"]
unsafe fn hypot(x: c_float, y: c_float) -> c_float; pub unsafe fn hypot(x: c_float, y: c_float) -> c_float;
#[link_name="ldexpf"] #[link_name="ldexpf"]
unsafe fn ldexp(x: c_float, n: c_int) -> c_float; pub unsafe fn ldexp(x: c_float, n: c_int) -> c_float;
#[cfg(unix)] #[cfg(unix)]
#[link_name="lgammaf_r"] unsafe fn lgamma(n: c_float, #[link_name="lgammaf_r"]
sign: &mut c_int) -> c_float; pub unsafe fn lgamma(n: c_float, sign: &mut c_int) -> c_float;
#[cfg(windows)] #[cfg(windows)]
#[link_name="__lgammaf_r"] #[link_name="__lgammaf_r"]
unsafe fn lgamma(n: c_float, sign: &mut c_int) -> c_float; pub unsafe fn lgamma(n: c_float, sign: &mut c_int) -> c_float;
#[link_name="logf"] unsafe fn ln(n: c_float) -> c_float; #[link_name="logf"]
#[link_name="logbf"] unsafe fn log_radix(n: c_float) -> c_float; pub unsafe fn ln(n: c_float) -> c_float;
#[link_name="log1pf"] unsafe fn ln_1p(n: c_float) -> c_float; #[link_name="logbf"]
#[link_name="log2f"] unsafe fn log2(n: c_float) -> c_float; pub unsafe fn log_radix(n: c_float) -> c_float;
#[link_name="log10f"] unsafe fn log10(n: c_float) -> c_float; #[link_name="log1pf"]
#[link_name="ilogbf"] unsafe fn ilog_radix(n: c_float) -> c_int; pub unsafe fn ln_1p(n: c_float) -> c_float;
#[link_name="modff"] unsafe fn modf(n: c_float, #[link_name="log2f"]
iptr: &mut c_float) -> c_float; pub unsafe fn log2(n: c_float) -> c_float;
#[link_name="powf"] unsafe fn pow(n: c_float, e: c_float) -> c_float; #[link_name="log10f"]
pub unsafe fn log10(n: c_float) -> c_float;
#[link_name="ilogbf"]
pub unsafe fn ilog_radix(n: c_float) -> c_int;
#[link_name="modff"]
pub unsafe 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;
// FIXME (#1379): enable when rounding modes become available // FIXME (#1379): enable when rounding modes become available
// #[link_name="rintf"] unsafe fn rint(n: c_float) -> c_float; // #[link_name="rintf"] unsafe fn rint(n: c_float) -> c_float;
#[link_name="roundf"] unsafe fn round(n: c_float) -> c_float; #[link_name="roundf"]
#[link_name="scalbnf"] unsafe fn ldexp_radix(n: c_float, i: c_int) pub unsafe fn round(n: c_float) -> c_float;
-> c_float; #[link_name="scalbnf"]
#[link_name="sinf"] unsafe fn sin(n: c_float) -> c_float; pub unsafe fn ldexp_radix(n: c_float, i: c_int) -> c_float;
#[link_name="sinhf"] unsafe fn sinh(n: c_float) -> c_float; #[link_name="sinf"]
#[link_name="sqrtf"] unsafe fn sqrt(n: c_float) -> c_float; pub unsafe fn sin(n: c_float) -> c_float;
#[link_name="tanf"] unsafe fn tan(n: c_float) -> c_float; #[link_name="sinhf"]
#[link_name="tanhf"] unsafe fn tanh(n: c_float) -> c_float; pub unsafe fn sinh(n: c_float) -> c_float;
#[link_name="tgammaf"] unsafe fn tgamma(n: c_float) -> c_float; #[link_name="sqrtf"]
#[link_name="truncf"] unsafe fn trunc(n: c_float) -> c_float; pub unsafe fn sqrt(n: c_float) -> c_float;
#[link_name="tanf"]
pub unsafe fn tan(n: c_float) -> c_float;
#[link_name="tanhf"]
pub unsafe fn tanh(n: c_float) -> c_float;
#[link_name="tgammaf"]
pub unsafe fn tgamma(n: c_float) -> c_float;
#[link_name="truncf"]
pub unsafe fn trunc(n: c_float) -> c_float;
} }
} }

View file

@ -61,12 +61,12 @@ pub mod rustrt {
use libc::{c_char, c_int}; use libc::{c_char, c_int};
use libc; use libc;
pub extern { extern {
unsafe fn rust_get_argc() -> c_int; pub unsafe fn rust_get_argc() -> c_int;
unsafe fn rust_get_argv() -> **c_char; pub unsafe fn rust_get_argv() -> **c_char;
unsafe fn rust_path_is_dir(path: *libc::c_char) -> c_int; pub unsafe fn rust_path_is_dir(path: *libc::c_char) -> c_int;
unsafe fn rust_path_exists(path: *libc::c_char) -> c_int; pub unsafe fn rust_path_exists(path: *libc::c_char) -> c_int;
unsafe fn rust_set_exit_status(code: libc::intptr_t); pub unsafe fn rust_set_exit_status(code: libc::intptr_t);
} }
} }

View file

@ -256,20 +256,21 @@ pub mod rustrt {
use libc; use libc;
use super::rust_task; use super::rust_task;
pub extern { extern {
#[rust_stack] #[rust_stack]
unsafe fn rust_get_task() -> *rust_task; pub unsafe fn rust_get_task() -> *rust_task;
#[rust_stack] #[rust_stack]
unsafe fn rust_task_ref(task: *rust_task); pub unsafe fn rust_task_ref(task: *rust_task);
unsafe fn rust_task_deref(task: *rust_task); pub unsafe fn rust_task_deref(task: *rust_task);
#[rust_stack] #[rust_stack]
unsafe fn task_clear_event_reject(task: *rust_task); pub unsafe fn task_clear_event_reject(task: *rust_task);
unsafe fn task_wait_event(this: *rust_task, pub unsafe fn task_wait_event(this: *rust_task,
killed: &mut *libc::c_void) killed: &mut *libc::c_void)
-> bool; -> bool;
unsafe fn task_signal_event(target: *rust_task, event: *libc::c_void); pub unsafe fn task_signal_event(target: *rust_task,
event: *libc::c_void);
} }
} }

View file

@ -251,9 +251,9 @@ impl<T: Rand + 'static> Rand for @T {
pub mod rustrt { pub mod rustrt {
use libc::size_t; use libc::size_t;
pub extern { extern {
unsafe fn rand_seed_size() -> size_t; pub unsafe fn rand_seed_size() -> size_t;
unsafe fn rand_gen_seed(buf: *mut u8, sz: size_t); pub unsafe fn rand_gen_seed(buf: *mut u8, sz: size_t);
} }
} }
@ -1087,10 +1087,11 @@ mod tests {
#[allow(non_camel_case_types)] // runtime type #[allow(non_camel_case_types)] // runtime type
pub enum rust_rng {} pub enum rust_rng {}
pub extern { extern {
unsafe fn rand_new_seeded(buf: *u8, sz: size_t) -> *rust_rng; pub unsafe fn rand_new_seeded(buf: *u8, sz: size_t)
unsafe fn rand_next(rng: *rust_rng) -> u32; -> *rust_rng;
unsafe fn rand_free(rng: *rust_rng); pub unsafe fn rand_next(rng: *rust_rng) -> u32;
pub unsafe fn rand_free(rng: *rust_rng);
} }
} }

View file

@ -345,9 +345,9 @@ pub fn context() -> RuntimeContext {
} }
} }
pub extern { extern {
#[rust_stack] #[rust_stack]
fn rust_try_get_task() -> *rust_task; pub fn rust_try_get_task() -> *rust_task;
} }
} }

View file

@ -643,9 +643,9 @@ fn spawn_process_os(prog: &str, args: &[~str],
use libc::c_void; use libc::c_void;
#[abi = "cdecl"] #[abi = "cdecl"]
pub extern { extern {
unsafe fn rust_unset_sigprocmask(); pub unsafe fn rust_unset_sigprocmask();
unsafe fn rust_set_environ(envp: *c_void); pub unsafe fn rust_set_environ(envp: *c_void);
} }
} }

View file

@ -30,11 +30,11 @@ pub struct Closure {
pub mod rustrt { pub mod rustrt {
use libc::{c_char, size_t}; use libc::{c_char, size_t};
pub extern { extern {
#[rust_stack] #[rust_stack]
unsafe fn rust_upcall_fail(expr: *c_char, pub unsafe fn rust_upcall_fail(expr: *c_char,
file: *c_char, file: *c_char,
line: size_t); line: size_t);
} }
} }

View file

@ -995,13 +995,13 @@ mod testrt {
use libc; use libc;
#[nolink] #[nolink]
pub extern { extern {
unsafe fn rust_dbg_lock_create() -> *libc::c_void; pub unsafe fn rust_dbg_lock_create() -> *libc::c_void;
unsafe fn rust_dbg_lock_destroy(lock: *libc::c_void); pub unsafe fn rust_dbg_lock_destroy(lock: *libc::c_void);
unsafe fn rust_dbg_lock_lock(lock: *libc::c_void); pub unsafe fn rust_dbg_lock_lock(lock: *libc::c_void);
unsafe fn rust_dbg_lock_unlock(lock: *libc::c_void); pub unsafe fn rust_dbg_lock_unlock(lock: *libc::c_void);
unsafe fn rust_dbg_lock_wait(lock: *libc::c_void); pub unsafe fn rust_dbg_lock_wait(lock: *libc::c_void);
unsafe fn rust_dbg_lock_signal(lock: *libc::c_void); pub unsafe fn rust_dbg_lock_signal(lock: *libc::c_void);
} }
} }

View file

@ -30,39 +30,39 @@ pub type rust_task = libc::c_void;
#[allow(non_camel_case_types)] // runtime type #[allow(non_camel_case_types)] // runtime type
pub type rust_closure = libc::c_void; pub type rust_closure = libc::c_void;
pub extern { extern {
#[rust_stack] #[rust_stack]
fn rust_task_yield(task: *rust_task) -> bool; pub fn rust_task_yield(task: *rust_task) -> bool;
fn rust_get_sched_id() -> sched_id; pub fn rust_get_sched_id() -> sched_id;
fn rust_new_sched(num_threads: libc::uintptr_t) -> sched_id; pub fn rust_new_sched(num_threads: libc::uintptr_t) -> sched_id;
fn rust_sched_threads() -> libc::size_t; pub fn rust_sched_threads() -> libc::size_t;
fn rust_sched_current_nonlazy_threads() -> libc::size_t; pub fn rust_sched_current_nonlazy_threads() -> libc::size_t;
fn get_task_id() -> task_id; pub fn get_task_id() -> task_id;
#[rust_stack] #[rust_stack]
fn rust_get_task() -> *rust_task; pub fn rust_get_task() -> *rust_task;
fn new_task() -> *rust_task; pub fn new_task() -> *rust_task;
fn rust_new_task_in_sched(id: sched_id) -> *rust_task; pub fn rust_new_task_in_sched(id: sched_id) -> *rust_task;
fn start_task(task: *rust_task, closure: *rust_closure); pub fn start_task(task: *rust_task, closure: *rust_closure);
fn rust_task_is_unwinding(task: *rust_task) -> bool; pub fn rust_task_is_unwinding(task: *rust_task) -> bool;
fn rust_osmain_sched_id() -> sched_id; pub fn rust_osmain_sched_id() -> sched_id;
#[rust_stack] #[rust_stack]
fn rust_task_inhibit_kill(t: *rust_task); pub fn rust_task_inhibit_kill(t: *rust_task);
#[rust_stack] #[rust_stack]
fn rust_task_allow_kill(t: *rust_task); pub fn rust_task_allow_kill(t: *rust_task);
#[rust_stack] #[rust_stack]
fn rust_task_inhibit_yield(t: *rust_task); pub fn rust_task_inhibit_yield(t: *rust_task);
#[rust_stack] #[rust_stack]
fn rust_task_allow_yield(t: *rust_task); pub fn rust_task_allow_yield(t: *rust_task);
fn rust_task_kill_other(task: *rust_task); pub fn rust_task_kill_other(task: *rust_task);
fn rust_task_kill_all(task: *rust_task); pub fn rust_task_kill_all(task: *rust_task);
#[rust_stack] #[rust_stack]
fn rust_get_task_local_data(task: *rust_task) -> *mut *libc::c_void; pub fn rust_get_task_local_data(task: *rust_task) -> *mut *libc::c_void;
#[rust_stack] #[rust_stack]
fn rust_task_local_data_atexit(task: *rust_task, cleanup_fn: *u8); pub fn rust_task_local_data_atexit(task: *rust_task, cleanup_fn: *u8);
} }

View file

@ -41,8 +41,8 @@ pub fn at_exit(f: ~fn()) {
mod rustrt { mod rustrt {
use libc::c_void; use libc::c_void;
pub extern { extern {
fn rust_register_exit_function(runner: *c_void, f: ~~fn()); pub fn rust_register_exit_function(runner: *c_void, f: ~~fn());
} }
} }

View file

@ -158,7 +158,7 @@ pub trait TyVisitor {
} }
#[abi = "rust-intrinsic"] #[abi = "rust-intrinsic"]
pub extern "rust-intrinsic" { extern "rust-intrinsic" {
/// Atomic compare and exchange, sequentially consistent. /// Atomic compare and exchange, sequentially consistent.
pub fn atomic_cxchg(dst: &mut int, old: int, src: int) -> int; pub fn atomic_cxchg(dst: &mut int, old: int, src: int) -> int;

View file

@ -26,22 +26,23 @@ pub mod rustrt {
use unstable::lang::rust_task; use unstable::lang::rust_task;
use libc::{c_char, uintptr_t}; use libc::{c_char, uintptr_t};
pub extern { extern {
#[rust_stack] #[rust_stack]
unsafe fn rust_upcall_malloc(td: *c_char, size: uintptr_t) -> *c_char; pub unsafe fn rust_upcall_malloc(td: *c_char, size: uintptr_t)
-> *c_char;
#[rust_stack] #[rust_stack]
unsafe fn rust_upcall_free(ptr: *c_char); pub unsafe fn rust_upcall_free(ptr: *c_char);
#[fast_ffi] #[fast_ffi]
unsafe fn rust_upcall_malloc_noswitch(td: *c_char, pub unsafe fn rust_upcall_malloc_noswitch(td: *c_char,
size: uintptr_t) size: uintptr_t)
-> *c_char; -> *c_char;
#[rust_stack] #[rust_stack]
fn rust_try_get_task() -> *rust_task; pub fn rust_try_get_task() -> *rust_task;
fn rust_dbg_breakpoint(); pub fn rust_dbg_breakpoint();
} }
} }

View file

@ -63,6 +63,7 @@ pub enum ObsoleteSyntax {
ObsoleteNamedExternModule, ObsoleteNamedExternModule,
ObsoleteMultipleLocalDecl, ObsoleteMultipleLocalDecl,
ObsoleteMutWithMultipleBindings, ObsoleteMutWithMultipleBindings,
ObsoleteExternVisibility,
} }
impl to_bytes::IterBytes for ObsoleteSyntax { impl to_bytes::IterBytes for ObsoleteSyntax {
@ -248,6 +249,11 @@ impl ParserObsoleteMethods for Parser {
"use multiple local declarations instead of e.g. `let mut \ "use multiple local declarations instead of e.g. `let mut \
(x, y) = ...`." (x, y) = ...`."
), ),
ObsoleteExternVisibility => (
"`pub extern` or `priv extern`",
"place the `pub` or `priv` on the individual external items \
instead"
)
}; };
self.report(sp, kind, kind_str, desc); self.report(sp, kind, kind_str, desc);

View file

@ -84,7 +84,7 @@ use parse::obsolete::{ObsoletePurity, ObsoleteStaticMethod};
use parse::obsolete::{ObsoleteConstItem, ObsoleteFixedLengthVectorType}; use parse::obsolete::{ObsoleteConstItem, ObsoleteFixedLengthVectorType};
use parse::obsolete::{ObsoleteNamedExternModule, ObsoleteMultipleLocalDecl}; use parse::obsolete::{ObsoleteNamedExternModule, ObsoleteMultipleLocalDecl};
use parse::obsolete::{ObsoleteMutWithMultipleBindings}; use parse::obsolete::{ObsoleteMutWithMultipleBindings};
use parse::obsolete::{ParserObsoleteMethods}; use parse::obsolete::{ObsoleteExternVisibility, ParserObsoleteMethods};
use parse::token::{can_begin_expr, get_ident_interner, ident_to_str, is_ident}; 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_ident_or_path};
use parse::token::{is_plain_ident, INTERPOLATED, keywords, special_idents}; use parse::token::{is_plain_ident, INTERPOLATED, keywords, special_idents};
@ -4191,16 +4191,23 @@ impl Parser {
self.obsolete(*self.last_span, ObsoleteNamedExternModule); self.obsolete(*self.last_span, ObsoleteNamedExternModule);
} }
// Do not allow visibility to be specified.
if visibility != ast::inherited {
self.obsolete(*self.span, ObsoleteExternVisibility);
}
let abis = opt_abis.get_or_default(AbiSet::C()); let abis = opt_abis.get_or_default(AbiSet::C());
let (inner, next) = self.parse_inner_attrs_and_next(); let (inner, next) = self.parse_inner_attrs_and_next();
let m = self.parse_foreign_mod_items(sort, abis, next); let m = self.parse_foreign_mod_items(sort, abis, next);
self.expect(&token::RBRACE); self.expect(&token::RBRACE);
return iovi_item(self.mk_item(lo, self.last_span.hi, ident, return iovi_item(self.mk_item(lo,
item_foreign_mod(m), visibility, self.last_span.hi,
maybe_append(attrs, ident,
Some(inner)))); item_foreign_mod(m),
public,
maybe_append(attrs, Some(inner))));
} }
if opt_abis.is_some() { if opt_abis.is_some() {

View file

@ -524,7 +524,7 @@ pub fn print_item(s: @ps, item: &ast::item) {
bclose(s, item.span); bclose(s, item.span);
} }
ast::item_foreign_mod(ref nmod) => { ast::item_foreign_mod(ref nmod) => {
head(s, visibility_qualified(item.vis, "extern")); head(s, "extern");
word_nbsp(s, nmod.abis.to_str()); word_nbsp(s, nmod.abis.to_str());
match nmod.sort { match nmod.sort {
ast::named => { ast::named => {

View file

@ -10,22 +10,22 @@
pub mod rusti { pub mod rusti {
#[abi = "rust-intrinsic"] #[abi = "rust-intrinsic"]
pub extern "rust-intrinsic" { extern "rust-intrinsic" {
fn atomic_cxchg(dst: &mut int, old: int, src: int) -> int; pub fn atomic_cxchg(dst: &mut int, old: int, src: int) -> int;
fn atomic_cxchg_acq(dst: &mut int, old: int, src: int) -> int; pub fn atomic_cxchg_acq(dst: &mut int, old: int, src: int) -> int;
fn atomic_cxchg_rel(dst: &mut int, old: int, src: int) -> int; pub fn atomic_cxchg_rel(dst: &mut int, old: int, src: int) -> int;
fn atomic_xchg(dst: &mut int, src: int) -> int; pub fn atomic_xchg(dst: &mut int, src: int) -> int;
fn atomic_xchg_acq(dst: &mut int, src: int) -> int; pub fn atomic_xchg_acq(dst: &mut int, src: int) -> int;
fn atomic_xchg_rel(dst: &mut int, src: int) -> int; pub fn atomic_xchg_rel(dst: &mut int, src: int) -> int;
fn atomic_xadd(dst: &mut int, src: int) -> int; pub fn atomic_xadd(dst: &mut int, src: int) -> int;
fn atomic_xadd_acq(dst: &mut int, src: int) -> int; pub fn atomic_xadd_acq(dst: &mut int, src: int) -> int;
fn atomic_xadd_rel(dst: &mut int, src: int) -> int; pub fn atomic_xadd_rel(dst: &mut int, src: int) -> int;
fn atomic_xsub(dst: &mut int, src: int) -> int; pub fn atomic_xsub(dst: &mut int, src: int) -> int;
fn atomic_xsub_acq(dst: &mut int, src: int) -> int; pub fn atomic_xsub_acq(dst: &mut int, src: int) -> int;
fn atomic_xsub_rel(dst: &mut int, src: int) -> int; pub fn atomic_xsub_rel(dst: &mut int, src: int) -> int;
} }
} }

View file

@ -18,7 +18,7 @@ use std::libc;
pub mod rustrt { pub mod rustrt {
use std::libc; use std::libc;
pub extern { extern {
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t) pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
-> libc::uintptr_t; -> libc::uintptr_t;
} }

View file

@ -13,7 +13,7 @@
pub mod rustrt { pub mod rustrt {
use std::libc; use std::libc;
pub extern { extern {
pub fn rust_get_argc() -> libc::c_int; pub fn rust_get_argc() -> libc::c_int;
} }
} }

View file

@ -12,7 +12,7 @@
mod test { mod test {
#[abi = "cdecl"] #[abi = "cdecl"]
pub extern { extern {
pub unsafe fn free(); pub unsafe fn free();
} }
} }

View file

@ -13,7 +13,7 @@
#[deny(unused_unsafe)]; #[deny(unused_unsafe)];
mod foo { mod foo {
pub extern { extern {
pub fn bar(); pub fn bar();
} }
} }

View file

@ -10,7 +10,7 @@
//error-pattern:libc::c_int or libc::c_long should be used //error-pattern:libc::c_int or libc::c_long should be used
mod xx { mod xx {
pub extern { extern {
pub fn strlen(str: *u8) -> uint; pub fn strlen(str: *u8) -> uint;
pub fn foo(x: int, y: uint); pub fn foo(x: int, y: uint);
} }

View file

@ -18,9 +18,9 @@ use std::task;
mod rustrt { mod rustrt {
use std::libc; use std::libc;
pub extern { extern {
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t) pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
-> libc::uintptr_t; -> libc::uintptr_t;
} }
} }

View file

@ -23,7 +23,7 @@ use std::task;
mod rustrt { mod rustrt {
use std::libc; use std::libc;
pub extern { extern {
pub fn rust_get_argc() -> libc::c_int; pub fn rust_get_argc() -> libc::c_int;
} }
} }

View file

@ -86,7 +86,7 @@ mod test {
#[abi = "cdecl"] #[abi = "cdecl"]
#[nolink] #[nolink]
pub extern { extern {
pub fn rust_get_sched_id() -> libc::intptr_t; pub fn rust_get_sched_id() -> libc::intptr_t;
pub fn get_task_id() -> libc::intptr_t; pub fn get_task_id() -> libc::intptr_t;
} }

View file

@ -14,7 +14,7 @@ mod rustrt {
use std::libc; use std::libc;
#[abi = "cdecl"] #[abi = "cdecl"]
pub extern { extern {
pub fn get_task_id() -> libc::intptr_t; pub fn get_task_id() -> libc::intptr_t;
} }
} }

View file

@ -13,7 +13,7 @@ use std::str;
mod libc { mod libc {
#[abi = "cdecl"] #[abi = "cdecl"]
#[nolink] #[nolink]
pub extern { extern {
pub fn atol(x: *u8) -> int; pub fn atol(x: *u8) -> int;
pub fn atoll(x: *u8) -> i64; pub fn atoll(x: *u8) -> i64;
} }

View file

@ -22,14 +22,14 @@ static b: bool = true;
mod rustrt { mod rustrt {
#[cfg(bogus)] #[cfg(bogus)]
#[abi = "cdecl"] #[abi = "cdecl"]
pub extern { extern {
// This symbol doesn't exist and would be a link error if this // This symbol doesn't exist and would be a link error if this
// module was translated // module was translated
pub fn bogus(); pub fn bogus();
} }
#[abi = "cdecl"] #[abi = "cdecl"]
pub extern {} extern {}
} }
#[cfg(bogus)] #[cfg(bogus)]
@ -110,7 +110,7 @@ fn test_in_fn_ctxt() {
mod test_foreign_items { mod test_foreign_items {
pub mod rustrt { pub mod rustrt {
#[abi = "cdecl"] #[abi = "cdecl"]
pub extern { extern {
#[cfg(bogus)] #[cfg(bogus)]
pub fn rust_get_stdin() -> ~str; pub fn rust_get_stdin() -> ~str;
pub fn rust_get_stdin() -> ~str; pub fn rust_get_stdin() -> ~str;

View file

@ -13,7 +13,7 @@ use std::libc;
mod rustrt { mod rustrt {
use std::libc; use std::libc;
pub extern { extern {
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t) pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
-> libc::uintptr_t; -> libc::uintptr_t;
} }

View file

@ -14,7 +14,7 @@ use std::task;
mod rustrt { mod rustrt {
use std::libc; use std::libc;
pub extern { extern {
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t) pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
-> libc::uintptr_t; -> libc::uintptr_t;
} }

View file

@ -18,7 +18,7 @@ use std::task;
mod rustrt { mod rustrt {
use std::libc; use std::libc;
pub extern { extern {
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t) pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
-> libc::uintptr_t; -> libc::uintptr_t;
} }

View file

@ -13,7 +13,7 @@ use std::libc;
mod rustrt { mod rustrt {
use std::libc; use std::libc;
pub extern { extern {
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t) pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
-> libc::uintptr_t; -> libc::uintptr_t;
} }

View file

@ -18,7 +18,7 @@ struct TwoU16s {
one: u16, two: u16 one: u16, two: u16
} }
pub extern { extern {
pub fn rust_dbg_extern_identity_TwoU16s(v: TwoU16s) -> TwoU16s; pub fn rust_dbg_extern_identity_TwoU16s(v: TwoU16s) -> TwoU16s;
} }

View file

@ -16,7 +16,7 @@ struct TwoU32s {
one: u32, two: u32 one: u32, two: u32
} }
pub extern { extern {
pub fn rust_dbg_extern_identity_TwoU32s(v: TwoU32s) -> TwoU32s; pub fn rust_dbg_extern_identity_TwoU32s(v: TwoU32s) -> TwoU32s;
} }

View file

@ -15,7 +15,7 @@ struct TwoU64s {
one: u64, two: u64 one: u64, two: u64
} }
pub extern { extern {
pub fn rust_dbg_extern_identity_TwoU64s(u: TwoU64s) -> TwoU64s; pub fn rust_dbg_extern_identity_TwoU64s(u: TwoU64s) -> TwoU64s;
} }

View file

@ -20,7 +20,7 @@ struct TwoU64s {
one: u64, two: u64 one: u64, two: u64
} }
pub extern { extern {
pub fn rust_dbg_extern_identity_TwoU64s(v: TwoU64s) -> TwoU64s; pub fn rust_dbg_extern_identity_TwoU64s(v: TwoU64s) -> TwoU64s;
} }

View file

@ -18,7 +18,7 @@ struct TwoU8s {
one: u8, two: u8 one: u8, two: u8
} }
pub extern { extern {
pub fn rust_dbg_extern_identity_TwoU8s(v: TwoU8s) -> TwoU8s; pub fn rust_dbg_extern_identity_TwoU8s(v: TwoU8s) -> TwoU8s;
} }

View file

@ -10,7 +10,7 @@
// Test a function that takes/returns a u8. // Test a function that takes/returns a u8.
pub extern { extern {
pub fn rust_dbg_extern_identity_u8(v: u8) -> u8; pub fn rust_dbg_extern_identity_u8(v: u8) -> u8;
} }

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
pub extern { extern {
pub fn rust_dbg_extern_identity_double(v: f64) -> f64; pub fn rust_dbg_extern_identity_double(v: f64) -> f64;
} }

View file

@ -10,7 +10,7 @@
// Test a function that takes/returns a u32. // Test a function that takes/returns a u32.
pub extern { extern {
pub fn rust_dbg_extern_identity_u32(v: u32) -> u32; pub fn rust_dbg_extern_identity_u32(v: u32) -> u32;
} }

View file

@ -10,7 +10,7 @@
// Test a call to a function that takes/returns a u64. // Test a call to a function that takes/returns a u64.
pub extern { extern {
pub fn rust_dbg_extern_identity_u64(v: u64) -> u64; pub fn rust_dbg_extern_identity_u64(v: u64) -> u64;
} }

View file

@ -15,7 +15,7 @@ struct TwoU16s {
one: u16, two: u16 one: u16, two: u16
} }
pub extern { extern {
pub fn rust_dbg_extern_return_TwoU16s() -> TwoU16s; pub fn rust_dbg_extern_return_TwoU16s() -> TwoU16s;
} }

View file

@ -12,7 +12,7 @@ struct TwoU32s {
one: u32, two: u32 one: u32, two: u32
} }
pub extern { extern {
pub fn rust_dbg_extern_return_TwoU32s() -> TwoU32s; pub fn rust_dbg_extern_return_TwoU32s() -> TwoU32s;
} }

View file

@ -12,7 +12,7 @@ struct TwoU64s {
one: u64, two: u64 one: u64, two: u64
} }
pub extern { extern {
pub fn rust_dbg_extern_return_TwoU64s() -> TwoU64s; pub fn rust_dbg_extern_return_TwoU64s() -> TwoU64s;
} }

View file

@ -15,7 +15,7 @@ struct TwoU8s {
one: u8, two: u8 one: u8, two: u8
} }
pub extern { extern {
pub fn rust_dbg_extern_return_TwoU8s() -> TwoU8s; pub fn rust_dbg_extern_return_TwoU8s() -> TwoU8s;
} }

View file

@ -17,7 +17,7 @@ use std::task;
mod rustrt { mod rustrt {
use std::libc; use std::libc;
pub extern { extern {
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t) pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
-> libc::uintptr_t; -> libc::uintptr_t;
} }

View file

@ -14,7 +14,7 @@ use std::task;
mod rustrt { mod rustrt {
use std::libc; use std::libc;
pub extern { extern {
pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t) pub fn rust_dbg_call(cb: *u8, data: libc::uintptr_t)
-> libc::uintptr_t; -> libc::uintptr_t;
} }

View file

@ -16,7 +16,7 @@ mod rustrt1 {
#[abi = "cdecl"] #[abi = "cdecl"]
#[link_name = "rustrt"] #[link_name = "rustrt"]
pub extern { extern {
pub fn rust_get_argc() -> libc::c_int; pub fn rust_get_argc() -> libc::c_int;
} }
} }
@ -26,7 +26,7 @@ mod rustrt2 {
#[abi = "cdecl"] #[abi = "cdecl"]
#[link_name = "rustrt"] #[link_name = "rustrt"]
pub extern { extern {
pub fn rust_get_argc() -> libc::c_int; pub fn rust_get_argc() -> libc::c_int;
} }
} }

View file

@ -17,7 +17,7 @@ use std::vec;
mod libc { mod libc {
#[nolink] #[nolink]
#[abi = "cdecl"] #[abi = "cdecl"]
pub extern { extern {
#[link_name = "strlen"] #[link_name = "strlen"]
pub fn my_strlen(str: *u8) -> uint; pub fn my_strlen(str: *u8) -> uint;
} }

View file

@ -16,7 +16,7 @@ mod WHATGOESHERE {
// FIXME: I want to name a mod that would not link successfully // FIXME: I want to name a mod that would not link successfully
// wouthout providing a -L argument to the compiler, and that // wouthout providing a -L argument to the compiler, and that
// will also be found successfully at runtime. // will also be found successfully at runtime.
pub extern { extern {
pub fn IDONTKNOW() -> u32; pub fn IDONTKNOW() -> u32;
} }
} }

View file

@ -10,7 +10,7 @@
mod foo { mod foo {
#[nolink] #[nolink]
pub extern { extern {
pub static errno: int; pub static errno: int;
} }
} }

View file

@ -13,7 +13,7 @@
mod rustrt { mod rustrt {
use std::libc; use std::libc;
pub extern { extern {
pub fn get_task_id() -> libc::intptr_t; pub fn get_task_id() -> libc::intptr_t;
} }
} }

View file

@ -17,7 +17,7 @@ mod bindgen {
use super::void; use super::void;
#[nolink] #[nolink]
pub extern { extern {
pub fn printf(v: void); pub fn printf(v: void);
} }
} }

View file

@ -11,28 +11,28 @@
mod bar { mod bar {
#[abi = "cdecl"] #[abi = "cdecl"]
#[nolink] #[nolink]
pub extern {} extern {}
} }
mod zed { mod zed {
#[abi = "cdecl"] #[abi = "cdecl"]
#[nolink] #[nolink]
pub extern {} extern {}
} }
mod libc { mod libc {
#[abi = "cdecl"] #[abi = "cdecl"]
#[nolink] #[nolink]
pub extern { extern {
pub fn write(fd: int, buf: *u8, count: ::std::libc::size_t) pub fn write(fd: int, buf: *u8, count: ::std::libc::size_t)
-> ::std::libc::ssize_t; -> ::std::libc::ssize_t;
} }
} }
mod baz { mod baz {
#[abi = "cdecl"] #[abi = "cdecl"]
#[nolink] #[nolink]
pub extern {} extern {}
} }
pub fn main() { } pub fn main() { }

View file

@ -12,7 +12,7 @@
mod rusti { mod rusti {
#[abi = "rust-intrinsic"] #[abi = "rust-intrinsic"]
pub extern "rust-intrinsic" { extern "rust-intrinsic" {
pub fn pref_align_of<T>() -> uint; pub fn pref_align_of<T>() -> uint;
pub fn min_align_of<T>() -> uint; pub fn min_align_of<T>() -> uint;
} }

View file

@ -10,7 +10,7 @@
mod rusti { mod rusti {
#[abi = "rust-intrinsic"] #[abi = "rust-intrinsic"]
pub extern "rust-intrinsic" { extern "rust-intrinsic" {
pub fn atomic_cxchg(dst: &mut int, old: int, src: int) -> int; pub fn atomic_cxchg(dst: &mut int, old: int, src: int) -> int;
pub fn atomic_cxchg_acq(dst: &mut int, old: int, src: int) -> int; pub fn atomic_cxchg_acq(dst: &mut int, old: int, src: int) -> int;
pub fn atomic_cxchg_rel(dst: &mut int, old: int, src: int) -> int; pub fn atomic_cxchg_rel(dst: &mut int, old: int, src: int) -> int;

View file

@ -12,7 +12,7 @@
mod rusti { mod rusti {
#[abi = "rust-intrinsic"] #[abi = "rust-intrinsic"]
pub extern "rust-intrinsic" { extern "rust-intrinsic" {
pub fn frame_address(f: &once fn(*u8)); pub fn frame_address(f: &once fn(*u8));
} }
} }

View file

@ -10,7 +10,7 @@
mod rusti { mod rusti {
#[abi = "rust-intrinsic"] #[abi = "rust-intrinsic"]
pub extern "rust-intrinsic" { extern "rust-intrinsic" {
pub fn move_val_init<T>(dst: &mut T, src: T); pub fn move_val_init<T>(dst: &mut T, src: T);
pub fn move_val<T>(dst: &mut T, src: T); pub fn move_val<T>(dst: &mut T, src: T);
} }

View file

@ -10,7 +10,7 @@
mod rusti { mod rusti {
#[abi = "rust-intrinsic"] #[abi = "rust-intrinsic"]
pub extern "rust-intrinsic" { extern "rust-intrinsic" {
fn uninit<T>() -> T; fn uninit<T>() -> T;
} }
} }

View file

@ -14,7 +14,7 @@ extern mod extra;
mod rusti { mod rusti {
#[abi = "rust-intrinsic"] #[abi = "rust-intrinsic"]
pub extern "rust-intrinsic" { extern "rust-intrinsic" {
fn ctpop8(x: i8) -> i8; fn ctpop8(x: i8) -> i8;
fn ctpop16(x: i16) -> i16; fn ctpop16(x: i16) -> i16;
fn ctpop32(x: i32) -> i32; fn ctpop32(x: i32) -> i32;

View file

@ -14,37 +14,37 @@ use std::f64;
mod rusti { mod rusti {
#[abi = "rust-intrinsic"] #[abi = "rust-intrinsic"]
pub extern "rust-intrinsic" { extern "rust-intrinsic" {
fn sqrtf32(x: f32) -> f32; pub fn sqrtf32(x: f32) -> f32;
fn sqrtf64(x: f64) -> f64; pub fn sqrtf64(x: f64) -> f64;
fn powif32(a: f32, x: i32) -> f32; pub fn powif32(a: f32, x: i32) -> f32;
fn powif64(a: f64, x: i32) -> f64; pub fn powif64(a: f64, x: i32) -> f64;
fn sinf32(x: f32) -> f32; pub fn sinf32(x: f32) -> f32;
fn sinf64(x: f64) -> f64; pub fn sinf64(x: f64) -> f64;
fn cosf32(x: f32) -> f32; pub fn cosf32(x: f32) -> f32;
fn cosf64(x: f64) -> f64; pub fn cosf64(x: f64) -> f64;
fn powf32(a: f32, x: f32) -> f32; pub fn powf32(a: f32, x: f32) -> f32;
fn powf64(a: f64, x: f64) -> f64; pub fn powf64(a: f64, x: f64) -> f64;
fn expf32(x: f32) -> f32; pub fn expf32(x: f32) -> f32;
fn expf64(x: f64) -> f64; pub fn expf64(x: f64) -> f64;
fn exp2f32(x: f32) -> f32; pub fn exp2f32(x: f32) -> f32;
fn exp2f64(x: f64) -> f64; pub fn exp2f64(x: f64) -> f64;
fn logf32(x: f32) -> f32; pub fn logf32(x: f32) -> f32;
fn logf64(x: f64) -> f64; pub fn logf64(x: f64) -> f64;
fn log10f32(x: f32) -> f32; pub fn log10f32(x: f32) -> f32;
fn log10f64(x: f64) -> f64; pub fn log10f64(x: f64) -> f64;
fn log2f32(x: f32) -> f32; pub fn log2f32(x: f32) -> f32;
fn log2f64(x: f64) -> f64; pub fn log2f64(x: f64) -> f64;
fn fmaf32(a: f32, b: f32, c: f32) -> f32; pub fn fmaf32(a: f32, b: f32, c: f32) -> f32;
fn fmaf64(a: f64, b: f64, c: f64) -> f64; pub fn fmaf64(a: f64, b: f64, c: f64) -> f64;
fn fabsf32(x: f32) -> f32; pub fn fabsf32(x: f32) -> f32;
fn fabsf64(x: f64) -> f64; pub fn fabsf64(x: f64) -> f64;
fn floorf32(x: f32) -> f32; pub fn floorf32(x: f32) -> f32;
fn floorf64(x: f64) -> f64; pub fn floorf64(x: f64) -> f64;
fn ceilf32(x: f32) -> f32; pub fn ceilf32(x: f32) -> f32;
fn ceilf64(x: f64) -> f64; pub fn ceilf64(x: f64) -> f64;
fn truncf32(x: f32) -> f32; pub fn truncf32(x: f32) -> f32;
fn truncf64(x: f64) -> f64; pub fn truncf64(x: f64) -> f64;
} }
} }

View file

@ -13,7 +13,7 @@
mod rustrt { mod rustrt {
use std::libc; use std::libc;
pub extern { extern {
pub fn get_task_id() -> libc::intptr_t; pub fn get_task_id() -> libc::intptr_t;
} }
} }

View file

@ -13,7 +13,7 @@ mod a {
pub type rust_task = uint; pub type rust_task = uint;
pub mod rustrt { pub mod rustrt {
use super::rust_task; use super::rust_task;
pub extern { extern {
pub fn rust_task_is_unwinding(rt: *rust_task) -> bool; pub fn rust_task_is_unwinding(rt: *rust_task) -> bool;
} }
} }
@ -23,7 +23,7 @@ mod b {
pub type rust_task = bool; pub type rust_task = bool;
pub mod rustrt { pub mod rustrt {
use super::rust_task; use super::rust_task;
pub extern { extern {
pub fn rust_task_is_unwinding(rt: *rust_task) -> bool; pub fn rust_task_is_unwinding(rt: *rust_task) -> bool;
} }
} }

View file

@ -31,7 +31,7 @@ mod m {
#[link_name = "m"] #[link_name = "m"]
#[abi = "cdecl"] #[abi = "cdecl"]
pub extern { extern {
#[cfg(unix)] #[cfg(unix)]
#[link_name="lgamma_r"] #[link_name="lgamma_r"]
pub fn lgamma(n: c_double, sign: &mut c_int) -> c_double; pub fn lgamma(n: c_double, sign: &mut c_int) -> c_double;

View file

@ -40,7 +40,7 @@ mod test_single_attr_outer {
pub mod rustrt { pub mod rustrt {
#[attr = "val"] #[attr = "val"]
#[abi = "cdecl"] #[abi = "cdecl"]
pub extern {} extern {}
} }
} }
@ -61,7 +61,7 @@ mod test_multi_attr_outer {
#[attr1 = "val"] #[attr1 = "val"]
#[attr2 = "val"] #[attr2 = "val"]
#[abi = "cdecl"] #[abi = "cdecl"]
pub extern {} extern {}
} }
#[attr1 = "val"] #[attr1 = "val"]
@ -84,7 +84,7 @@ mod test_stmt_single_attr_outer {
mod rustrt { mod rustrt {
#[attr = "val"] #[attr = "val"]
#[abi = "cdecl"] #[abi = "cdecl"]
pub extern { extern {
} }
} }
} }
@ -111,7 +111,7 @@ mod test_stmt_multi_attr_outer {
#[attr1 = "val"] #[attr1 = "val"]
#[attr2 = "val"] #[attr2 = "val"]
#[abi = "cdecl"] #[abi = "cdecl"]
pub extern { extern {
} }
} }
*/ */
@ -170,7 +170,7 @@ mod test_foreign_items {
use std::libc; use std::libc;
#[abi = "cdecl"] #[abi = "cdecl"]
pub extern { extern {
#[attr]; #[attr];
#[attr] #[attr]

View file

@ -11,7 +11,7 @@
mod rusti { mod rusti {
#[nolink] #[nolink]
#[abi = "rust-intrinsic"] #[abi = "rust-intrinsic"]
pub extern "rust-intrinsic" { extern "rust-intrinsic" {
pub fn morestack_addr() -> *(); pub fn morestack_addr() -> *();
} }
} }

View file

@ -17,7 +17,7 @@ use std::task;
mod rustrt { mod rustrt {
use std::libc; use std::libc;
pub extern { extern {
pub fn debug_get_stk_seg() -> *u8; pub fn debug_get_stk_seg() -> *u8;
pub fn rust_get_sched_id() -> libc::intptr_t; pub fn rust_get_sched_id() -> libc::intptr_t;

View file

@ -11,7 +11,7 @@
// Issue #901 // Issue #901
mod libc { mod libc {
#[nolink] #[nolink]
pub extern { extern {
pub fn printf(x: ()); pub fn printf(x: ());
} }
} }

View file

@ -14,7 +14,7 @@ use std::sys;
mod rusti { mod rusti {
#[abi = "rust-intrinsic"] #[abi = "rust-intrinsic"]
pub extern "rust-intrinsic" { extern "rust-intrinsic" {
pub fn pref_align_of<T>() -> uint; pub fn pref_align_of<T>() -> uint;
pub fn min_align_of<T>() -> uint; pub fn min_align_of<T>() -> uint;
} }

View file

@ -14,7 +14,7 @@ use std::sys;
mod rusti { mod rusti {
#[abi = "rust-intrinsic"] #[abi = "rust-intrinsic"]
pub extern "rust-intrinsic" { extern "rust-intrinsic" {
pub fn pref_align_of<T>() -> uint; pub fn pref_align_of<T>() -> uint;
pub fn min_align_of<T>() -> uint; pub fn min_align_of<T>() -> uint;
} }

View file

@ -25,7 +25,7 @@ mod rustrt {
use std::libc; use std::libc;
pub extern { extern {
pub fn rust_new_sched(num_threads: libc::uintptr_t) -> sched_id; pub fn rust_new_sched(num_threads: libc::uintptr_t) -> sched_id;
pub fn rust_get_sched_id() -> sched_id; pub fn rust_get_sched_id() -> sched_id;
pub fn rust_new_task_in_sched(id: sched_id) -> task_id; pub fn rust_new_task_in_sched(id: sched_id) -> task_id;

View file

@ -15,7 +15,7 @@ mod rustrt {
use super::{Floats, Quad}; use super::{Floats, Quad};
#[nolink] #[nolink]
pub extern { extern {
pub fn debug_abi_1(q: Quad) -> Quad; pub fn debug_abi_1(q: Quad) -> Quad;
pub fn debug_abi_2(f: Floats) -> Floats; pub fn debug_abi_2(f: Floats) -> Floats;
} }

View file

@ -14,7 +14,7 @@
mod libc { mod libc {
#[nolink] #[nolink]
pub extern { extern {
pub fn malloc(size: int) -> *u8; pub fn malloc(size: int) -> *u8;
} }
} }

View file

@ -19,7 +19,7 @@ mod kernel32 {
#[cfg(target_os = "win32")] #[cfg(target_os = "win32")]
#[abi = "stdcall"] #[abi = "stdcall"]
pub extern "stdcall" { extern "stdcall" {
pub fn GetProcessHeap() -> HANDLE; pub fn GetProcessHeap() -> HANDLE;
pub fn HeapAlloc(hHeap: HANDLE, dwFlags: DWORD, dwBytes: SIZE_T) pub fn HeapAlloc(hHeap: HANDLE, dwFlags: DWORD, dwBytes: SIZE_T)
-> LPVOID; -> LPVOID;