Skip to content

Commit b5b35f1

Browse files
authored
Rollup merge of #143683 - jieyouxu:rms-cleanup, r=Kobzol
Assorted `run-make-support` maintenance This PR should contain no functional changes. - Commit 1: Removes the support library's CHANGELOG. In the very beginning, I thought maybe we would try to version this library. But this is a purely internal test support library, and it's just extra busywork trying to maintain changelog/versions. It's also hopelessly outdated. - Commit 2: Resets version number to `0.0.0`. Ditto on busywork. - Commit 3: Bump `run-make-support` to Edition 2024. The support library was already "compliant" with Edition 2024. - Commit 4: Slightly organizes the support library dependencies. - Commit 5: Previously, I tried hopelessly to maintain some manual formatting, but that was annoying because it required skipping rustfmt (so export ordering etc. could not be extra formatted). Give up, and do some rearrangements / module prefix tricks to get the `lib.rs` looking at least *reasonable*. IMO this is not a strict improvement, but I rather regain the ability to auto-format it with rustfmt. - Commit {6,7}: Noticed in #143669 that we apparently had *both* {`is_msvc`, `is_windows_msvc`}. This PR removes `is_msvc` in favor of `is_windows_msvc` to make it unambiguous (and only retain one way of gating) as there are some UEFI targets which are MSVC but not Windows. Best reviewed commit-by-commit. r? `@Kobzol`
2 parents 8c5398a + 3f4f23a commit b5b35f1

File tree

33 files changed

+143
-242
lines changed

33 files changed

+143
-242
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3214,7 +3214,7 @@ dependencies = [
32143214

32153215
[[package]]
32163216
name = "run_make_support"
3217-
version = "0.2.0"
3217+
version = "0.0.0"
32183218
dependencies = [
32193219
"bstr",
32203220
"build_helper",

src/tools/run-make-support/CHANGELOG.md

Lines changed: 0 additions & 83 deletions
This file was deleted.

src/tools/run-make-support/Cargo.toml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
11
[package]
22
name = "run_make_support"
3-
version = "0.2.0"
4-
edition = "2021"
3+
version = "0.0.0"
4+
edition = "2024"
55

66
[dependencies]
7+
8+
# These dependencies are either used to implement part of support library
9+
# functionality, or re-exported to test recipe programs via the support library,
10+
# or both.
11+
12+
# tidy-alphabetical-start
713
bstr = "1.12"
14+
gimli = "0.32"
15+
libc = "0.2"
816
object = "0.37"
17+
regex = "1.11"
18+
serde_json = "1.0"
919
similar = "2.7"
1020
wasmparser = { version = "0.219", default-features = false, features = ["std"] }
11-
regex = "1.11"
12-
gimli = "0.32"
21+
# tidy-alphabetical-end
22+
23+
# Shared with bootstrap and compiletest
1324
build_helper = { path = "../../build_helper" }
14-
serde_json = "1.0"
15-
libc = "0.2"
1625

1726
[lib]
1827
crate-type = ["lib", "dylib"]

src/tools/run-make-support/src/artifact_names.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
//! libraries which are target-dependent.
33
44
use crate::target;
5-
use crate::targets::is_msvc;
5+
use crate::targets::is_windows_msvc;
66

77
/// Construct the static library name based on the target.
88
#[track_caller]
99
#[must_use]
1010
pub fn static_lib_name(name: &str) -> String {
1111
assert!(!name.contains(char::is_whitespace), "static library name cannot contain whitespace");
1212

13-
if is_msvc() { format!("{name}.lib") } else { format!("lib{name}.a") }
13+
if is_windows_msvc() { format!("{name}.lib") } else { format!("lib{name}.a") }
1414
}
1515

1616
/// Construct the dynamic library name based on the target.
@@ -45,7 +45,7 @@ pub fn dynamic_lib_extension() -> &'static str {
4545
#[track_caller]
4646
#[must_use]
4747
pub fn msvc_import_dynamic_lib_name(name: &str) -> String {
48-
assert!(is_msvc(), "this function is exclusive to MSVC");
48+
assert!(is_windows_msvc(), "this function is exclusive to MSVC");
4949
assert!(!name.contains(char::is_whitespace), "import library name cannot contain whitespace");
5050

5151
format!("{name}.dll.lib")

src/tools/run-make-support/src/external_deps/c_build.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::artifact_names::{dynamic_lib_name, static_lib_name};
44
use crate::external_deps::c_cxx_compiler::{cc, cxx};
55
use crate::external_deps::llvm::llvm_ar;
66
use crate::path_helpers::path;
7-
use crate::targets::{is_darwin, is_msvc, is_windows};
7+
use crate::targets::{is_darwin, is_windows, is_windows_msvc};
88

99
// FIXME(Oneirical): These native build functions should take a Path-based generic.
1010

@@ -24,20 +24,20 @@ pub fn build_native_static_lib_optimized(lib_name: &str) -> PathBuf {
2424

2525
#[track_caller]
2626
fn build_native_static_lib_internal(lib_name: &str, optimzed: bool) -> PathBuf {
27-
let obj_file = if is_msvc() { format!("{lib_name}") } else { format!("{lib_name}.o") };
27+
let obj_file = if is_windows_msvc() { format!("{lib_name}") } else { format!("{lib_name}.o") };
2828
let src = format!("{lib_name}.c");
2929
let lib_path = static_lib_name(lib_name);
3030

3131
let mut cc = cc();
32-
if !is_msvc() {
32+
if !is_windows_msvc() {
3333
cc.arg("-v");
3434
}
3535
if optimzed {
3636
cc.optimize();
3737
}
3838
cc.arg("-c").out_exe(&obj_file).input(src).optimize().run();
3939

40-
let obj_file = if is_msvc() {
40+
let obj_file = if is_windows_msvc() {
4141
PathBuf::from(format!("{lib_name}.obj"))
4242
} else {
4343
PathBuf::from(format!("{lib_name}.o"))
@@ -50,16 +50,17 @@ fn build_native_static_lib_internal(lib_name: &str, optimzed: bool) -> PathBuf {
5050
/// [`std::env::consts::DLL_PREFIX`] and [`std::env::consts::DLL_EXTENSION`].
5151
#[track_caller]
5252
pub fn build_native_dynamic_lib(lib_name: &str) -> PathBuf {
53-
let obj_file = if is_msvc() { format!("{lib_name}") } else { format!("{lib_name}.o") };
53+
let obj_file = if is_windows_msvc() { format!("{lib_name}") } else { format!("{lib_name}.o") };
5454
let src = format!("{lib_name}.c");
5555
let lib_path = dynamic_lib_name(lib_name);
56-
if is_msvc() {
56+
if is_windows_msvc() {
5757
cc().arg("-c").out_exe(&obj_file).input(src).run();
5858
} else {
5959
cc().arg("-v").arg("-c").out_exe(&obj_file).input(src).run();
6060
};
61-
let obj_file = if is_msvc() { format!("{lib_name}.obj") } else { format!("{lib_name}.o") };
62-
if is_msvc() {
61+
let obj_file =
62+
if is_windows_msvc() { format!("{lib_name}.obj") } else { format!("{lib_name}.o") };
63+
if is_windows_msvc() {
6364
let out_arg = format!("-out:{lib_path}");
6465
cc().input(&obj_file).args(&["-link", "-dll", &out_arg]).run();
6566
} else if is_darwin() {
@@ -79,15 +80,15 @@ pub fn build_native_dynamic_lib(lib_name: &str) -> PathBuf {
7980
/// Built from a C++ file.
8081
#[track_caller]
8182
pub fn build_native_static_lib_cxx(lib_name: &str) -> PathBuf {
82-
let obj_file = if is_msvc() { format!("{lib_name}") } else { format!("{lib_name}.o") };
83+
let obj_file = if is_windows_msvc() { format!("{lib_name}") } else { format!("{lib_name}.o") };
8384
let src = format!("{lib_name}.cpp");
8485
let lib_path = static_lib_name(lib_name);
85-
if is_msvc() {
86+
if is_windows_msvc() {
8687
cxx().arg("-EHs").arg("-c").out_exe(&obj_file).input(src).run();
8788
} else {
8889
cxx().arg("-c").out_exe(&obj_file).input(src).run();
8990
};
90-
let obj_file = if is_msvc() {
91+
let obj_file = if is_windows_msvc() {
9192
PathBuf::from(format!("{lib_name}.obj"))
9293
} else {
9394
PathBuf::from(format!("{lib_name}.o"))

src/tools/run-make-support/src/external_deps/c_cxx_compiler/cc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::path::Path;
22

33
use crate::command::Command;
4-
use crate::{env_var, is_msvc};
4+
use crate::{env_var, is_windows_msvc};
55

66
/// Construct a new platform-specific C compiler invocation.
77
///
@@ -82,7 +82,7 @@ impl Cc {
8282
pub fn out_exe(&mut self, name: &str) -> &mut Self {
8383
let mut path = std::path::PathBuf::from(name);
8484

85-
if is_msvc() {
85+
if is_windows_msvc() {
8686
path.set_extension("exe");
8787
let fe_path = path.clone();
8888
path.set_extension("");
@@ -108,7 +108,7 @@ impl Cc {
108108
/// Optimize the output.
109109
/// Equivalent to `-O3` for GNU-compatible linkers or `-O2` for MSVC linkers.
110110
pub fn optimize(&mut self) -> &mut Self {
111-
if is_msvc() {
111+
if is_windows_msvc() {
112112
self.cmd.arg("-O2");
113113
} else {
114114
self.cmd.arg("-O3");

src/tools/run-make-support/src/external_deps/c_cxx_compiler/extras.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
use crate::{is_msvc, is_win7, is_windows, uname};
1+
use crate::{is_win7, is_windows, is_windows_msvc, uname};
22

33
/// `EXTRACFLAGS`
44
pub fn extra_c_flags() -> Vec<&'static str> {
55
if is_windows() {
6-
if is_msvc() {
6+
if is_windows_msvc() {
77
let mut libs =
88
vec!["ws2_32.lib", "userenv.lib", "bcrypt.lib", "ntdll.lib", "synchronization.lib"];
99
if is_win7() {
@@ -29,7 +29,7 @@ pub fn extra_c_flags() -> Vec<&'static str> {
2929
/// `EXTRACXXFLAGS`
3030
pub fn extra_cxx_flags() -> Vec<&'static str> {
3131
if is_windows() {
32-
if is_msvc() { vec![] } else { vec!["-lstdc++"] }
32+
if is_windows_msvc() { vec![] } else { vec!["-lstdc++"] }
3333
} else {
3434
match &uname()[..] {
3535
"Darwin" => vec!["-lc++"],

src/tools/run-make-support/src/external_deps/rustc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::command::Command;
66
use crate::env::env_var;
77
use crate::path_helpers::cwd;
88
use crate::util::set_host_compiler_dylib_path;
9-
use crate::{is_aix, is_darwin, is_msvc, is_windows, target, uname};
9+
use crate::{is_aix, is_darwin, is_windows, is_windows_msvc, target, uname};
1010

1111
/// Construct a new `rustc` invocation. This will automatically set the library
1212
/// search path as `-L cwd()`. Use [`bare_rustc`] to avoid this.
@@ -377,7 +377,7 @@ impl Rustc {
377377
// So we end up with the following hack: we link use static:-bundle to only
378378
// link the parts of libstdc++ that we actually use, which doesn't include
379379
// the dependency on the pthreads DLL.
380-
if !is_msvc() {
380+
if !is_windows_msvc() {
381381
self.cmd.arg("-lstatic:-bundle=stdc++");
382382
};
383383
} else if is_darwin() {

0 commit comments

Comments
 (0)