Skip to content

Commit

Permalink
Remove unused abi attributes.
Browse files Browse the repository at this point in the history
They've been replaced by putting the name on the extern block.

  #[abi = "foo"]

goes to

  extern "foo" { }

Closes #9483.
  • Loading branch information
steveklabnik committed Oct 14, 2013
1 parent 5b10781 commit 16fc6a6
Show file tree
Hide file tree
Showing 34 changed files with 56 additions and 129 deletions.
11 changes: 4 additions & 7 deletions doc/tutorial-ffi.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions src/libextra/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ static NSEC_PER_SEC: i32 = 1_000_000_000_i32;
pub mod rustrt {
use super::Tm;

#[abi = "cdecl"]
extern {
extern "cdecl" {
pub fn get_time(sec: &mut i64, nsec: &mut i32);
pub fn precise_time_ns(ns: &mut u64);
pub fn rust_tzset();
Expand Down
3 changes: 1 addition & 2 deletions src/libextra/unicode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@ pub mod icu {

// #[link_name = "icuuc"]
#[link_args = "-licuuc"]
#[abi = "cdecl"]
extern {
extern "cdecl" {
pub fn u_hasBinaryProperty(c: UChar32, which: UProperty) -> UBool;
pub fn u_isdigit(c: UChar32) -> UBool;
pub fn u_islower(c: UChar32) -> UBool;
Expand Down
3 changes: 1 addition & 2 deletions src/librustc/lib/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,7 @@ pub mod llvm {

#[link_args = "-Lrustllvm -lrustllvm"]
#[link_name = "rustllvm"]
#[abi = "cdecl"]
extern {
extern "cdecl" {
/* Create and destroy contexts. */
pub fn LLVMContextCreate() -> ContextRef;
pub fn LLVMContextDispose(C: ContextRef);
Expand Down
3 changes: 1 addition & 2 deletions src/libstd/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,8 @@ pub type fd_t = c_int;
pub mod rustrt {
use libc;

#[abi = "cdecl"]
#[link_name = "rustrt"]
extern {
extern "cdecl" {
pub fn rust_get_stdin() -> *libc::FILE;
pub fn rust_get_stdout() -> *libc::FILE;
pub fn rust_get_stderr() -> *libc::FILE;
Expand Down
Loading

0 comments on commit 16fc6a6

Please sign in to comment.