Skip to content

Remove remaining nolink usages.(fixes #12810) #12826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/doc/rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -1472,7 +1472,6 @@ and are instead terminated by a semicolon.

~~~~
# use std::libc::{c_char, FILE};
# #[nolink]

extern {
fn fopen(filename: *c_char, mode: *c_char) -> *FILE;
Expand Down
1 change: 0 additions & 1 deletion src/libnative/io/file_win32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,6 @@ pub fn readdir(p: &CString) -> IoResult<~[Path]> {
}).map(|path| root.join(path)).collect()
}

#[nolink]
extern {
fn rust_list_dir_wfd_size() -> libc::size_t;
fn rust_list_dir_wfd_fp_buf(wfd: *libc::c_void) -> *u16;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ static other_attrs: &'static [&'static str] = &[
"macro_export", "must_use",

//mod-level
"path", "link_name", "link_args", "nolink", "macro_escape", "no_implicit_prelude",
"path", "link_name", "link_args", "macro_escape", "no_implicit_prelude",

// fn-level
"test", "bench", "should_fail", "ignore", "inline", "lang", "main", "start",
Expand Down
1 change: 0 additions & 1 deletion src/libstd/io/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ mod darwin_fd_limit {
rlim_cur: rlim_t,
rlim_max: rlim_t
}
#[nolink]
extern {
// name probably doesn't need to be mut, but the C function doesn't specify const
fn sysctl(name: *mut libc::c_int, namelen: libc::c_uint,
Expand Down
23 changes: 0 additions & 23 deletions src/libstd/libc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3306,7 +3306,6 @@ pub mod funcs {
// or anything. The same is not true of POSIX.

pub mod c95 {
#[nolink]
pub mod ctype {
use libc::types::os::arch::c95::{c_char, c_int};

Expand All @@ -3327,7 +3326,6 @@ pub mod funcs {
}
}

#[nolink]
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};
Expand Down Expand Up @@ -3383,7 +3381,6 @@ pub mod funcs {
}
}

#[nolink]
pub mod stdlib {
use libc::types::common::c95::c_void;
use libc::types::os::arch::c95::{c_char, c_double, c_int};
Expand Down Expand Up @@ -3416,7 +3413,6 @@ pub mod funcs {
}
}

#[nolink]
pub mod string {
use libc::types::common::c95::c_void;
use libc::types::os::arch::c95::{c_char, c_int, size_t};
Expand Down Expand Up @@ -3461,7 +3457,6 @@ pub mod funcs {

#[cfg(target_os = "win32")]
pub mod posix88 {
#[nolink]
pub mod stat_ {
use libc::types::os::common::posix01::{stat, utimbuf};
use libc::types::os::arch::c95::{c_int, c_char, wchar_t};
Expand All @@ -3486,7 +3481,6 @@ pub mod funcs {
}
}

#[nolink]
pub mod stdio {
use libc::types::common::c95::FILE;
use libc::types::os::arch::c95::{c_int, c_char};
Expand All @@ -3503,7 +3497,6 @@ pub mod funcs {
}
}

#[nolink]
pub mod fcntl {
use libc::types::os::arch::c95::{c_int, c_char, wchar_t};
extern {
Expand All @@ -3518,12 +3511,10 @@ pub mod funcs {
}
}

#[nolink]
pub mod dirent {
// Not supplied at all.
}

#[nolink]
pub mod unistd {
use libc::types::common::c95::c_void;
use libc::types::os::arch::c95::{c_int, c_uint, c_char,
Expand Down Expand Up @@ -3590,7 +3581,6 @@ pub mod funcs {
use libc::types::os::arch::posix01::stat;
use libc::types::os::arch::posix88::mode_t;

#[nolink]
extern {
pub fn chmod(path: *c_char, mode: mode_t) -> c_int;
pub fn fchmod(fd: c_int, mode: mode_t) -> c_int;
Expand Down Expand Up @@ -3618,7 +3608,6 @@ pub mod funcs {
}
}

#[nolink]
pub mod stdio {
use libc::types::common::c95::FILE;
use libc::types::os::arch::c95::{c_char, c_int};
Expand All @@ -3631,7 +3620,6 @@ pub mod funcs {
}
}

#[nolink]
pub mod fcntl {
use libc::types::os::arch::c95::{c_char, c_int};
use libc::types::os::arch::posix88::mode_t;
Expand All @@ -3644,7 +3632,6 @@ pub mod funcs {
}
}

#[nolink]
pub mod dirent {
use libc::types::common::posix88::{DIR, dirent_t};
use libc::types::os::arch::c95::{c_char, c_int, c_long};
Expand Down Expand Up @@ -3678,7 +3665,6 @@ pub mod funcs {
}
}

#[nolink]
pub mod unistd {
use libc::types::common::c95::c_void;
use libc::types::os::arch::c95::{c_char, c_int, c_long, c_uint};
Expand Down Expand Up @@ -3748,7 +3734,6 @@ pub mod funcs {
}
}

#[nolink]
pub mod signal {
use libc::types::os::arch::c95::{c_int};
use libc::types::os::arch::posix88::{pid_t};
Expand All @@ -3758,7 +3743,6 @@ pub mod funcs {
}
}

#[nolink]
pub mod mman {
use libc::types::common::c95::{c_void};
use libc::types::os::arch::c95::{size_t, c_int, c_char};
Expand Down Expand Up @@ -3796,7 +3780,6 @@ pub mod funcs {
#[cfg(target_os = "macos")]
#[cfg(target_os = "freebsd")]
pub mod posix01 {
#[nolink]
pub mod stat_ {
use libc::types::os::arch::c95::{c_char, c_int};
use libc::types::os::arch::posix01::stat;
Expand All @@ -3813,7 +3796,6 @@ pub mod funcs {
}
}

#[nolink]
pub mod unistd {
use libc::types::os::arch::c95::{c_char, c_int, size_t};
use libc::types::os::arch::posix88::{ssize_t, off_t};
Expand Down Expand Up @@ -3841,7 +3823,6 @@ pub mod funcs {
}
}

#[nolink]
pub mod wait {
use libc::types::os::arch::c95::{c_int};
use libc::types::os::arch::posix88::{pid_t};
Expand All @@ -3852,7 +3833,6 @@ pub mod funcs {
}
}

#[nolink]
pub mod glob {
use libc::types::os::arch::c95::{c_char, c_int};
use libc::types::os::common::posix01::{glob_t};
Expand All @@ -3867,7 +3847,6 @@ pub mod funcs {
}
}

#[nolink]
pub mod mman {
use libc::types::common::c95::{c_void};
use libc::types::os::arch::c95::{c_int, size_t};
Expand Down Expand Up @@ -4032,7 +4011,6 @@ pub mod funcs {
}

#[cfg(target_os = "macos")]
#[nolink]
pub mod extra {
use libc::types::os::arch::c95::{c_char, c_int};

Expand Down Expand Up @@ -4256,7 +4234,6 @@ pub mod funcs {
use libc::types::os::arch::c95::{c_int, c_long};
use libc::types::os::arch::c99::intptr_t;

#[nolink]
extern {
#[link_name = "_commit"]
pub fn commit(fd: c_int) -> c_int;
Expand Down
4 changes: 0 additions & 4 deletions src/libstd/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,6 @@ pub fn errno() -> int {
#[cfg(target_os = "macos")]
#[cfg(target_os = "freebsd")]
fn errno_location() -> *c_int {
#[nolink]
extern {
fn __error() -> *c_int;
}
Expand All @@ -627,7 +626,6 @@ pub fn errno() -> int {
#[cfg(target_os = "linux")]
#[cfg(target_os = "android")]
fn errno_location() -> *c_int {
#[nolink]
extern {
fn __errno_location() -> *c_int;
}
Expand Down Expand Up @@ -665,7 +663,6 @@ pub fn last_os_error() -> ~str {
#[cfg(target_os = "freebsd")]
fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: libc::size_t)
-> c_int {
#[nolink]
extern {
fn strerror_r(errnum: c_int, buf: *mut c_char,
buflen: libc::size_t) -> c_int;
Expand All @@ -681,7 +678,6 @@ pub fn last_os_error() -> ~str {
#[cfg(target_os = "linux")]
fn strerror_r(errnum: c_int, buf: *mut c_char,
buflen: libc::size_t) -> c_int {
#[nolink]
extern {
fn __xpg_strerror_r(errnum: c_int,
buf: *mut c_char,
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/attrs-after-extern-mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

use std::libc;

#[nolink]
extern {
static mut rust_dbg_static_mut: libc::c_int;
pub fn rust_dbg_static_mut_check_four();
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/lint-ctypes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

use std::libc;

#[nolink]
extern {
pub fn bare_type1(size: int); //~ ERROR: found rust type
pub fn bare_type2(size: uint); //~ ERROR: found rust type
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/nolink-with-link-args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ the compiler output. */
#[feature(link_args)];

#[link_args = "aFdEfSeVEEE"]
#[nolink]
extern {}

fn main() { }
1 change: 0 additions & 1 deletion src/test/run-pass/c-stack-returning-int64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
mod libc {
use std::libc::{c_char, c_long, c_longlong};

#[nolink]
extern {
pub fn atol(x: *c_char) -> c_long;
pub fn atoll(x: *c_char) -> c_longlong;
Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/foreign-fn-linkname.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ extern crate extra;
mod libc {
use std::libc::{c_char, size_t};

#[nolink]
extern {
#[link_name = "strlen"]
pub fn my_strlen(str: *c_char) -> size_t;
Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/foreign-mod-unused-const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
mod foo {
use std::libc::c_int;

#[nolink]
extern {
pub static errno: c_int;
}
Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/foreign-struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ pub enum void { }
mod bindgen {
use super::void;

#[nolink]
extern {
pub fn printf(v: void);
}
Expand Down
4 changes: 0 additions & 4 deletions src/test/run-pass/foreign2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,22 @@
// except according to those terms.

mod bar {
#[nolink]
extern {}
}

mod zed {
#[nolink]
extern {}
}

mod libc {
use std::libc::{c_int, c_void, size_t, ssize_t};

#[nolink]
extern {
pub fn write(fd: c_int, buf: *c_void, count: size_t) -> ssize_t;
}
}

mod baz {
#[nolink]
extern {}
}

Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/nil-decl-in-foreign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

// Issue #901
mod libc {
#[nolink]
extern {
pub fn printf(x: ());
}
Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/warn-ctypes-inhibit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#[allow(ctypes)];

mod libc {
#[nolink]
extern {
pub fn malloc(size: int) -> *u8;
}
Expand Down