Skip to content

Commit 77c3bfa

Browse files
committed
std: Remove cfg(cargobuild) annotations
These are all now no longer needed that we've only got rustbuild in tree.
1 parent ce4abc3 commit 77c3bfa

File tree

25 files changed

+7
-205
lines changed

25 files changed

+7
-205
lines changed

CONTRIBUTING.md

-5
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,6 @@ system internals, try asking in [`#rust-internals`][pound-rust-internals].
9393

9494
[bootstrap]: https://github.com/rust-lang/rust/tree/master/src/bootstrap/
9595

96-
> **Note**: the build system was recently rewritten from a jungle of makefiles
97-
> to the current incarnation you'll see in `src/bootstrap`. If you experience
98-
> bugs you can temporarily revert back to the makefiles with
99-
> `--disable-rustbuild` passed to `./configure`.
100-
10196
### Configuration
10297

10398
Before you can start building the compiler you need to configure the build for

src/liballoc_jemalloc/build.rs

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use std::process::Command;
2121
use build_helper::{run, rerun_if_changed_anything_in_dir, up_to_date};
2222

2323
fn main() {
24-
println!("cargo:rustc-cfg=cargobuild");
2524
println!("cargo:rerun-if-changed=build.rs");
2625

2726
// FIXME: This is a hack to support building targets that don't

src/liballoc_jemalloc/lib.rs

-16
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,6 @@ pub use imp::*;
3030
mod imp {
3131
use libc::{c_int, c_void, size_t};
3232

33-
// Linkage directives to pull in jemalloc and its dependencies.
34-
//
35-
// On some platforms we need to be sure to link in `pthread` which jemalloc
36-
// depends on, and specifically on android we need to also link to libgcc.
37-
// Currently jemalloc is compiled with gcc which will generate calls to
38-
// intrinsics that are libgcc specific (e.g. those intrinsics aren't present in
39-
// libcompiler-rt), so link that in to get that support.
40-
#[link(name = "jemalloc", kind = "static")]
41-
#[cfg_attr(target_os = "android", link(name = "gcc"))]
42-
#[cfg_attr(all(not(windows),
43-
not(target_os = "android"),
44-
not(target_env = "musl")),
45-
link(name = "pthread"))]
46-
#[cfg(not(cargobuild))]
47-
extern "C" {}
48-
4933
// Note that the symbols here are prefixed by default on OSX and Windows (we
5034
// don't explicitly request it), and on Android and DragonFly we explicitly
5135
// request it as unprefixing cause segfaults (mismatches in allocators).

src/libflate/build.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
extern crate gcc;
1212

1313
fn main() {
14-
println!("cargo:rustc-cfg=cargobuild");
1514
gcc::Config::new()
1615
.file("../rt/miniz.c")
1716
.compile("libminiz.a");

src/libflate/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,6 @@ impl Drop for Bytes {
7474
}
7575
}
7676

77-
#[link(name = "miniz", kind = "static")]
78-
#[cfg(not(cargobuild))]
79-
extern "C" {}
80-
8177
extern "C" {
8278
/// Raw miniz compression function.
8379
fn tdefl_compress_mem_to_heap(psrc_buf: *const c_void,

src/libpanic_unwind/gcc.rs

-4
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,6 @@ unsafe extern "C" fn rust_eh_unwind_resume(panic_ctx: *mut u8) -> ! {
301301
// with any GCC runtime.
302302
#[cfg(all(target_os="windows", target_arch = "x86", target_env="gnu"))]
303303
pub mod eh_frame_registry {
304-
#[link(name = "gcc_eh")]
305-
#[cfg(not(cargobuild))]
306-
extern "C" {}
307-
308304
extern "C" {
309305
fn __register_frame_info(eh_frame_begin: *const u8, object: *mut u8);
310306
fn __deregister_frame_info(eh_frame_begin: *const u8, object: *mut u8);

src/librustc_llvm/build.rs

-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ fn detect_llvm_link(llvm_config: &Path) -> (&'static str, Option<&'static str>)
4747
}
4848

4949
fn main() {
50-
println!("cargo:rustc-cfg=cargobuild");
51-
5250
let target = env::var("TARGET").expect("TARGET was not set");
5351
let llvm_config = env::var_os("LLVM_CONFIG")
5452
.map(PathBuf::from)

src/librustc_llvm/lib.rs

-10
Original file line numberDiff line numberDiff line change
@@ -422,13 +422,3 @@ impl Drop for OperandBundleDef {
422422
}
423423
}
424424
}
425-
426-
// The module containing the native LLVM dependencies, generated by the build system
427-
// Note that this must come after the rustllvm extern declaration so that
428-
// parts of LLVM that rustllvm depends on aren't thrown away by the linker.
429-
// Works to the above fix for #15460 to ensure LLVM dependencies that
430-
// are only used by rustllvm don't get stripped by the linker.
431-
#[cfg(not(cargobuild))]
432-
mod llvmdeps {
433-
include! { env!("CFG_LLVM_LINKAGE_FILE") }
434-
}

src/librustdoc/build.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
extern crate gcc;
1212

1313
fn main() {
14-
println!("cargo:rustc-cfg=cargobuild");
1514
let mut cfg = gcc::Config::new();
1615
cfg.file("../rt/hoedown/src/autolink.c")
1716
.file("../rt/hoedown/src/buffer.c")

src/librustdoc/html/markdown.rs

-5
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,6 @@ struct hoedown_buffer {
162162
unit: libc::size_t,
163163
}
164164

165-
// hoedown FFI
166-
#[link(name = "hoedown", kind = "static")]
167-
#[cfg(not(cargobuild))]
168-
extern {}
169-
170165
extern {
171166
fn hoedown_html_renderer_new(render_flags: libc::c_uint,
172167
nesting_level: libc::c_int)

src/libstd/build.rs

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use std::process::Command;
2121
use build_helper::{run, rerun_if_changed_anything_in_dir, up_to_date};
2222

2323
fn main() {
24-
println!("cargo:rustc-cfg=cargobuild");
2524
println!("cargo:rerun-if-changed=build.rs");
2625

2726
let target = env::var("TARGET").expect("TARGET was not set");

src/libstd/lib.rs

-3
Original file line numberDiff line numberDiff line change
@@ -463,9 +463,6 @@ mod panicking;
463463
mod rand;
464464
mod memchr;
465465

466-
// This module just defines per-platform native library dependencies
467-
mod rtdeps;
468-
469466
// The runtime entry point and a few unstable public functions used by the
470467
// compiler
471468
pub mod rt;

src/libstd/panicking.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -311,12 +311,12 @@ impl<'a> Location<'a> {
311311
}
312312

313313
fn default_hook(info: &PanicInfo) {
314-
#[cfg(any(not(cargobuild), feature = "backtrace"))]
314+
#[cfg(feature = "backtrace")]
315315
use sys_common::backtrace;
316316

317317
// If this is a double panic, make sure that we print a backtrace
318318
// for this panic. Otherwise only print it if logging is enabled.
319-
#[cfg(any(not(cargobuild), feature = "backtrace"))]
319+
#[cfg(feature = "backtrace")]
320320
let log_backtrace = {
321321
let panics = update_panic_count(0);
322322

@@ -341,7 +341,7 @@ fn default_hook(info: &PanicInfo) {
341341
let _ = writeln!(err, "thread '{}' panicked at '{}', {}:{}",
342342
name, msg, file, line);
343343

344-
#[cfg(any(not(cargobuild), feature = "backtrace"))]
344+
#[cfg(feature = "backtrace")]
345345
{
346346
use sync::atomic::{AtomicBool, Ordering};
347347

src/libstd/rtdeps.rs

-68
This file was deleted.

src/libstd/sys/unix/args.rs

-5
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,6 @@ mod imp {
189189
fn objc_msgSend_ul(obj: NsId, sel: Sel, ...) -> NsId;
190190
}
191191

192-
#[link(name = "Foundation", kind = "framework")]
193-
#[link(name = "objc")]
194-
#[cfg(not(cargobuild))]
195-
extern {}
196-
197192
type Sel = *const libc::c_void;
198193
type NsId = *const libc::c_void;
199194

src/libstd/sys/unix/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub mod weak;
3333

3434
pub mod args;
3535
pub mod android;
36-
#[cfg(any(not(cargobuild), feature = "backtrace"))]
36+
#[cfg(feature = "backtrace")]
3737
pub mod backtrace;
3838
pub mod condvar;
3939
pub mod env;

src/libstd/sys/unix/rand.rs

-4
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,6 @@ mod imp {
257257
#[allow(non_upper_case_globals)]
258258
const kSecRandomDefault: *const SecRandom = ptr::null();
259259

260-
#[link(name = "Security", kind = "framework")]
261-
#[cfg(not(cargobuild))]
262-
extern {}
263-
264260
extern {
265261
fn SecRandomCopyBytes(rnd: *const SecRandom,
266262
count: size_t, bytes: *mut u8) -> c_int;

src/libstd/sys/windows/c.rs

-7
Original file line numberDiff line numberDiff line change
@@ -833,13 +833,6 @@ pub struct CONSOLE_READCONSOLE_CONTROL {
833833
}
834834
pub type PCONSOLE_READCONSOLE_CONTROL = *mut CONSOLE_READCONSOLE_CONTROL;
835835

836-
#[link(name = "ws2_32")]
837-
#[link(name = "userenv")]
838-
#[link(name = "shell32")]
839-
#[link(name = "advapi32")]
840-
#[cfg(not(cargobuild))]
841-
extern {}
842-
843836
extern "system" {
844837
pub fn WSAStartup(wVersionRequested: WORD,
845838
lpWSAData: LPWSADATA) -> c_int;

src/libstd/sys_common/gnu/libbacktrace.rs

-3
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ pub fn print(w: &mut Write, idx: isize, addr: *mut libc::c_void,
3939
msg: *const libc::c_char,
4040
errnum: libc::c_int);
4141
enum backtrace_state {}
42-
#[link(name = "backtrace", kind = "static")]
43-
#[cfg(all(not(test), not(cargobuild)))]
44-
extern {}
4542

4643
extern {
4744
fn backtrace_create_state(filename: *const libc::c_char,

src/libstd/sys_common/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use sync::Once;
2929
use sys;
3030

3131
pub mod at_exit_imp;
32-
#[cfg(any(not(cargobuild), feature = "backtrace"))]
32+
#[cfg(feature = "backtrace")]
3333
pub mod backtrace;
3434
pub mod condvar;
3535
pub mod io;
@@ -50,7 +50,7 @@ pub use sys::net;
5050
#[cfg(not(target_os = "redox"))]
5151
pub mod net;
5252

53-
#[cfg(any(not(cargobuild), feature = "backtrace"))]
53+
#[cfg(feature = "backtrace")]
5454
#[cfg(any(all(unix, not(any(target_os = "macos", target_os = "ios", target_os = "emscripten"))),
5555
all(windows, target_env = "gnu")))]
5656
pub mod gnu;

src/libunwind/build.rs

-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
use std::env;
1212

1313
fn main() {
14-
println!("cargo:rustc-cfg=cargobuild");
15-
1614
let target = env::var("TARGET").expect("TARGET was not set");
1715

1816
if target.contains("linux") {

src/libunwind/libunwind.rs

-31
Original file line numberDiff line numberDiff line change
@@ -240,34 +240,3 @@ if #[cfg(not(all(target_os = "ios", target_arch = "arm")))] {
240240
}
241241
}
242242
} // cfg_if!
243-
244-
#[cfg_attr(any(all(target_os = "linux", not(target_env = "musl")),
245-
target_os = "freebsd",
246-
target_os = "solaris",
247-
target_os = "haiku",
248-
all(target_os = "linux",
249-
target_env = "musl",
250-
not(target_arch = "x86"),
251-
not(target_arch = "x86_64"))),
252-
link(name = "gcc_s"))]
253-
#[cfg_attr(all(target_os = "linux",
254-
target_env = "musl",
255-
any(target_arch = "x86", target_arch = "x86_64"),
256-
not(test)),
257-
link(name = "unwind", kind = "static"))]
258-
#[cfg_attr(target_os = "fuchsia",
259-
link(name = "unwind"))]
260-
#[cfg_attr(any(target_os = "android", target_os = "openbsd"),
261-
link(name = "gcc"))]
262-
#[cfg_attr(all(target_os = "netbsd", not(target_vendor = "rumprun")),
263-
link(name = "gcc"))]
264-
#[cfg_attr(all(target_os = "netbsd", target_vendor = "rumprun"),
265-
link(name = "unwind"))]
266-
#[cfg_attr(target_os = "dragonfly",
267-
link(name = "gcc_pic"))]
268-
#[cfg_attr(target_os = "bitrig",
269-
link(name = "c++abi"))]
270-
#[cfg_attr(all(target_os = "windows", target_env = "gnu"),
271-
link(name = "gcc_eh"))]
272-
#[cfg(not(cargobuild))]
273-
extern "C" {}

src/tools/compiletest/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
authors = ["The Rust Project Developers"]
33
name = "compiletest"
44
version = "0.0.0"
5-
build = "build.rs"
65

76
[dependencies]
87
log = "0.3"

src/tools/compiletest/build.rs

-13
This file was deleted.

src/tools/compiletest/src/main.rs

+1-12
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,9 @@
2121
extern crate libc;
2222
extern crate test;
2323
extern crate getopts;
24-
25-
#[cfg(cargobuild)]
2624
extern crate rustc_serialize;
27-
#[cfg(not(cargobuild))]
28-
extern crate serialize as rustc_serialize;
29-
3025
#[macro_use]
3126
extern crate log;
32-
33-
#[cfg(cargobuild)]
3427
extern crate env_logger;
3528

3629
use std::env;
@@ -58,11 +51,7 @@ mod raise_fd_limit;
5851
mod uidiff;
5952

6053
fn main() {
61-
#[cfg(cargobuild)]
62-
fn log_init() { env_logger::init().unwrap(); }
63-
#[cfg(not(cargobuild))]
64-
fn log_init() {}
65-
log_init();
54+
env_logger::init().unwrap();
6655

6756
let config = parse_config(env::args().collect());
6857

0 commit comments

Comments
 (0)