auto merge of #9606 : steveklabnik/rust/abi_removal, r=alexcrichton

They've been replaced by putting the name on the extern block.

  #[abi = "foo"]

goes to

  extern "foo" { }

Closes #9483.
This commit is contained in:
bors 2013-10-14 07:26:47 -07:00
commit c8e77d5586
34 changed files with 4 additions and 77 deletions

View File

@ -415,21 +415,18 @@ fn main() {
Most foreign code exposes a C ABI, and Rust uses the platform's C calling convention by default when
calling foreign functions. Some foreign functions, most notably the Windows API, use other calling
conventions. Rust provides the `abi` attribute as a way to hint to the compiler which calling
convention to use:
conventions. Rust provides a way to tell the compiler which convention to use:
~~~~
#[cfg(target_os = "win32")]
#[abi = "stdcall"]
#[link_name = "kernel32"]
extern {
extern "stdcall" {
fn SetEnvironmentVariableA(n: *u8, v: *u8) -> int;
}
~~~~
The `abi` attribute applies to a foreign module (it cannot be applied to a single function within a
module), and must be either `"cdecl"` or `"stdcall"`. The compiler may eventually support other
calling conventions.
This applies to the entire `extern` block, and must be either `"cdecl"` or
`"stdcall"`. The compiler may eventually support other calling conventions.
# Interoperability with foreign code

View File

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

View File

@ -162,7 +162,6 @@ pub mod icu {
// #[link_name = "icuuc"]
#[link_args = "-licuuc"]
#[abi = "cdecl"]
extern {
pub fn u_hasBinaryProperty(c: UChar32, which: UProperty) -> UBool;
pub fn u_isdigit(c: UChar32) -> UBool;

View File

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

View File

@ -76,7 +76,6 @@ pub type fd_t = c_int;
pub mod rustrt {
use libc;
#[abi = "cdecl"]
#[link_name = "rustrt"]
extern {
pub fn rust_get_stdin() -> *libc::FILE;

View File

@ -2663,7 +2663,6 @@ pub mod funcs {
pub mod c95 {
#[nolink]
#[abi = "cdecl"]
pub mod ctype {
use libc::types::os::arch::c95::{c_char, c_int};
@ -2685,7 +2684,6 @@ pub mod funcs {
}
#[nolink]
#[abi = "cdecl"]
pub mod stdio {
use libc::types::common::c95::{FILE, c_void, fpos_t};
use libc::types::os::arch::c95::{c_char, c_int, c_long, size_t};
@ -2742,7 +2740,6 @@ pub mod funcs {
}
#[nolink]
#[abi = "cdecl"]
pub mod stdlib {
use libc::types::common::c95::c_void;
use libc::types::os::arch::c95::{c_char, c_double, c_int};
@ -2776,7 +2773,6 @@ pub mod funcs {
}
#[nolink]
#[abi = "cdecl"]
pub mod string {
use libc::types::common::c95::c_void;
use libc::types::os::arch::c95::{c_char, c_int, size_t};
@ -2826,7 +2822,6 @@ pub mod funcs {
#[cfg(target_os = "win32")]
pub mod posix88 {
#[nolink]
#[abi = "cdecl"]
pub mod stat_ {
use libc::types::os::common::posix01::stat;
use libc::types::os::arch::c95::{c_int, c_char};
@ -2844,7 +2839,6 @@ pub mod funcs {
}
#[nolink]
#[abi = "cdecl"]
pub mod stdio {
use libc::types::common::c95::FILE;
use libc::types::os::arch::c95::{c_int, c_char};
@ -2862,7 +2856,6 @@ pub mod funcs {
}
#[nolink]
#[abi = "cdecl"]
pub mod fcntl {
use libc::types::os::arch::c95::{c_int, c_char};
extern {
@ -2875,13 +2868,11 @@ pub mod funcs {
}
#[nolink]
#[abi = "cdecl"]
pub mod dirent {
// Not supplied at all.
}
#[nolink]
#[abi = "cdecl"]
pub mod unistd {
use libc::types::common::c95::c_void;
use libc::types::os::arch::c95::{c_int, c_uint, c_char,
@ -2949,7 +2940,6 @@ pub mod funcs {
use libc::types::os::arch::posix88::mode_t;
#[nolink]
#[abi = "cdecl"]
extern {
pub fn chmod(path: *c_char, mode: mode_t) -> c_int;
pub fn fchmod(fd: c_int, mode: mode_t) -> c_int;
@ -2978,7 +2968,6 @@ pub mod funcs {
}
#[nolink]
#[abi = "cdecl"]
pub mod stdio {
use libc::types::common::c95::FILE;
use libc::types::os::arch::c95::{c_char, c_int};
@ -2992,7 +2981,6 @@ pub mod funcs {
}
#[nolink]
#[abi = "cdecl"]
pub mod fcntl {
use libc::types::os::arch::c95::{c_char, c_int};
use libc::types::os::arch::posix88::mode_t;
@ -3006,7 +2994,6 @@ pub mod funcs {
}
#[nolink]
#[abi = "cdecl"]
pub mod dirent {
use libc::types::common::posix88::{DIR, dirent_t};
use libc::types::os::arch::c95::{c_char, c_int, c_long};
@ -3040,7 +3027,6 @@ pub mod funcs {
}
#[nolink]
#[abi = "cdecl"]
pub mod unistd {
use libc::types::common::c95::c_void;
use libc::types::os::arch::c95::{c_char, c_int, c_long, c_uint};
@ -3100,7 +3086,6 @@ pub mod funcs {
}
#[nolink]
#[abi = "cdecl"]
pub mod signal {
use libc::types::os::arch::c95::{c_int};
use libc::types::os::arch::posix88::{pid_t};
@ -3111,7 +3096,6 @@ pub mod funcs {
}
#[nolink]
#[abi = "cdecl"]
pub mod mman {
use libc::types::common::c95::{c_void};
use libc::types::os::arch::c95::{size_t, c_int, c_char};
@ -3150,7 +3134,6 @@ pub mod funcs {
#[cfg(target_os = "freebsd")]
pub mod posix01 {
#[nolink]
#[abi = "cdecl"]
pub mod stat_ {
use libc::types::os::arch::c95::{c_char, c_int};
use libc::types::os::arch::posix01::stat;
@ -3168,7 +3151,6 @@ pub mod funcs {
}
#[nolink]
#[abi = "cdecl"]
pub mod unistd {
use libc::types::os::arch::c95::{c_char, c_int, size_t};
use libc::types::os::arch::posix88::{ssize_t};
@ -3195,7 +3177,6 @@ pub mod funcs {
}
#[nolink]
#[abi = "cdecl"]
pub mod wait {
use libc::types::os::arch::c95::{c_int};
use libc::types::os::arch::posix88::{pid_t};
@ -3207,7 +3188,6 @@ pub mod funcs {
}
#[nolink]
#[abi = "cdecl"]
pub mod glob {
use libc::types::os::arch::c95::{c_char, c_int};
use libc::types::os::common::posix01::{glob_t};
@ -3223,7 +3203,6 @@ pub mod funcs {
}
#[nolink]
#[abi = "cdecl"]
pub mod mman {
use libc::types::common::c95::{c_void};
use libc::types::os::arch::c95::{c_int, size_t};
@ -3271,7 +3250,6 @@ pub mod funcs {
use libc::types::os::arch::c95::{c_char, c_uchar, c_int, c_uint,
size_t};
#[abi = "cdecl"]
extern {
pub fn sysctl(name: *c_int,
namelen: c_uint,
@ -3305,7 +3283,6 @@ pub mod funcs {
use libc::types::common::c95::{c_void};
use libc::types::os::arch::c95::{c_uchar, c_int, size_t};
#[abi = "cdecl"]
extern {
pub fn getdtablesize() -> c_int;
pub fn madvise(addr: *c_void, len: size_t, advice: c_int)
@ -3325,7 +3302,6 @@ pub mod funcs {
pub mod extra {
use libc::types::os::arch::c95::{c_char, c_int};
#[abi = "cdecl"]
extern {
pub fn _NSGetExecutablePath(buf: *mut c_char, bufsize: *mut u32)
-> c_int;
@ -3358,7 +3334,6 @@ pub mod funcs {
use libc::types::os::arch::extra::{HANDLE, LPHANDLE};
#[cfg(target_arch = "x86")]
#[abi = "stdcall"]
extern "stdcall" {
pub fn GetEnvironmentVariableW(n: LPCWSTR,
v: LPWSTR,
@ -3572,7 +3547,6 @@ pub mod funcs {
pub mod msvcrt {
use libc::types::os::arch::c95::{c_int, c_long};
#[abi = "cdecl"]
#[nolink]
extern {
#[link_name = "_commit"]

View File

@ -18,7 +18,6 @@ pub mod c_double_utils {
use libc::{c_double, c_int};
#[link_name = "m"]
#[abi = "cdecl"]
extern {
// Alpabetically sorted by link_name
@ -107,7 +106,6 @@ pub mod c_float_utils {
use libc::{c_float, c_int};
#[link_name = "m"]
#[abi = "cdecl"]
extern {
// Alpabetically sorted by link_name

View File

@ -1039,7 +1039,6 @@ pub fn errno() -> uint {
#[cfg(target_arch = "x86")]
#[link_name = "kernel32"]
#[abi = "stdcall"]
extern "stdcall" {
fn GetLastError() -> DWORD;
}
@ -1118,7 +1117,6 @@ pub fn last_os_error() -> ~str {
#[cfg(target_arch = "x86")]
#[link_name = "kernel32"]
#[abi = "stdcall"]
extern "stdcall" {
fn FormatMessageW(flags: DWORD,
lpSrc: LPVOID,

View File

@ -84,7 +84,6 @@ pub unsafe fn get(key: Key) -> *mut c_void {
}
#[cfg(windows, target_arch = "x86")]
#[abi = "stdcall"]
extern "stdcall" {
fn TlsAlloc() -> DWORD;
fn TlsSetValue(dwTlsIndex: DWORD, lpTlsvalue: LPVOID) -> BOOL;

View File

@ -170,7 +170,6 @@ pub trait TyVisitor {
fn visit_closure_ptr(&mut self, ck: uint) -> bool;
}
#[abi = "rust-intrinsic"]
extern "rust-intrinsic" {
/// Atomic compare and exchange, sequentially consistent.

View File

@ -1059,7 +1059,6 @@ pub fn std_macros() -> @str {
// It is intended to be used like:
//
// externfn!(#[nolink]
// #[abi = \"cdecl\"]
// fn memcmp(cx: *u8, ct: *u8, n: u32) -> u32)
//
// Due to limitations in the macro parser, this pattern must be

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[abi = "cdecl"];
#[link_name = "rustrt"];
#[link(name = "anonexternmod",
vers = "0.1")];

View File

@ -9,7 +9,6 @@
// except according to those terms.
pub mod rusti {
#[abi = "rust-intrinsic"]
extern "rust-intrinsic" {
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;

View File

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

View File

@ -10,7 +10,6 @@
use std::libc;
#[abi = "cdecl"]
#[link_name = "rustrt"]
extern {
fn rust_get_test_int() -> libc::intptr_t;

View File

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

View File

@ -11,7 +11,6 @@
mod libc {
use std::libc::{c_char, c_long, c_longlong};
#[abi = "cdecl"]
#[nolink]
extern {
pub fn atol(x: *c_char) -> c_long;

View File

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

View File

@ -14,7 +14,6 @@
mod rustrt1 {
use std::libc;
#[abi = "cdecl"]
#[link_name = "rustrt"]
extern {
pub fn rust_get_test_int() -> libc::intptr_t;
@ -24,7 +23,6 @@ mod rustrt1 {
mod rustrt2 {
use std::libc;
#[abi = "cdecl"]
#[link_name = "rustrt"]
extern {
pub fn rust_get_test_int() -> libc::intptr_t;

View File

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

View File

@ -9,13 +9,11 @@
// except according to those terms.
mod bar {
#[abi = "cdecl"]
#[nolink]
extern {}
}
mod zed {
#[abi = "cdecl"]
#[nolink]
extern {}
}
@ -23,7 +21,6 @@ mod zed {
mod libc {
use std::libc::{c_int, c_void, size_t, ssize_t};
#[abi = "cdecl"]
#[nolink]
extern {
pub fn write(fd: c_int, buf: *c_void, count: size_t) -> ssize_t;
@ -31,7 +28,6 @@ mod libc {
}
mod baz {
#[abi = "cdecl"]
#[nolink]
extern {}
}

View File

@ -11,7 +11,6 @@
// xfail-fast Does not work with main in a submodule
mod rusti {
#[abi = "rust-intrinsic"]
extern "rust-intrinsic" {
pub fn pref_align_of<T>() -> uint;
pub fn min_align_of<T>() -> uint;

View File

@ -9,7 +9,6 @@
// except according to those terms.
mod rusti {
#[abi = "rust-intrinsic"]
extern "rust-intrinsic" {
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;

View File

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

View File

@ -9,7 +9,6 @@
// except according to those terms.
mod rusti {
#[abi = "rust-intrinsic"]
extern "rust-intrinsic" {
pub fn move_val_init<T>(dst: &mut T, src: T);
pub fn move_val<T>(dst: &mut T, src: T);

View File

@ -9,7 +9,6 @@
// except according to those terms.
mod rusti {
#[abi = "rust-intrinsic"]
extern "rust-intrinsic" {
pub fn uninit<T>() -> T;
}

View File

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

View File

@ -13,7 +13,6 @@
#[feature(globs)];
mod rusti {
#[abi = "rust-intrinsic"]
extern "rust-intrinsic" {
pub fn sqrtf32(x: f32) -> f32;
pub fn sqrtf64(x: f64) -> f64;

View File

@ -30,7 +30,6 @@ mod m {
use std::libc::{c_double, c_int};
#[link_name = "m"]
#[abi = "cdecl"]
extern {
#[cfg(unix)]
#[link_name="lgamma_r"]

View File

@ -39,7 +39,6 @@ mod test_single_attr_outer {
pub mod rustrt {
#[attr = "val"]
#[abi = "cdecl"]
extern {}
}
}
@ -60,7 +59,6 @@ mod test_multi_attr_outer {
pub mod rustrt {
#[attr1 = "val"]
#[attr2 = "val"]
#[abi = "cdecl"]
extern {}
}
@ -83,7 +81,6 @@ mod test_stmt_single_attr_outer {
mod rustrt {
#[attr = "val"]
#[abi = "cdecl"]
extern {
}
}
@ -110,7 +107,6 @@ mod test_stmt_multi_attr_outer {
pub mod rustrt {
#[attr1 = "val"]
#[attr2 = "val"]
#[abi = "cdecl"]
extern {
}
}
@ -169,7 +165,6 @@ mod test_foreign_items {
pub mod rustrt {
use std::libc;
#[abi = "cdecl"]
extern {
#[attr];

View File

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

View File

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

View File

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

View File

@ -18,7 +18,6 @@ pub type BOOL = u8;
mod kernel32 {
use super::{HANDLE, DWORD, SIZE_T, LPVOID, BOOL};
#[abi = "stdcall"]
extern "stdcall" {
pub fn GetProcessHeap() -> HANDLE;
pub fn HeapAlloc(hHeap: HANDLE, dwFlags: DWORD, dwBytes: SIZE_T)