diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-09-15 20:55:12 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-15 20:55:12 +0200 |
| commit | 0daa636b93540579573f1b92d05536b20da2252a (patch) | |
| tree | 504e197f0f49aae0482588e327aae7aae754572a /compiler/rustc_session/src | |
| parent | 8c2c9a9ef527edb453bcee638d34beb0e7b4616b (diff) | |
| parent | 914d8f4bca7990768ca9b5c8d6227d7177b55b4a (diff) | |
| download | rust-0daa636b93540579573f1b92d05536b20da2252a.tar.gz rust-0daa636b93540579573f1b92d05536b20da2252a.zip | |
Rollup merge of #129897 - RalfJung:soft-float-ignored, r=Urgau
deprecate -Csoft-float because it is unsound (and not fixable) See https://github.com/rust-lang/rust/issues/129893 for details. The general sentiment there seems to be that this flag has no use and sound alternatives exist, so let's add this warning and see if anyone out there disagrees. Also show a different warning on targets where it does nothing (as documented since https://github.com/rust-lang/rust/pull/36261): it seems to correspond to `-mfloat-abi` in GCC/clang, which is an ARM-specific option. To be really sure it does nothing, only forward the flag to LLVM for eabihf targets. This should not change behavior but makes me sleep better ;)
Diffstat (limited to 'compiler/rustc_session/src')
| -rw-r--r-- | compiler/rustc_session/src/errors.rs | 11 | ||||
| -rw-r--r-- | compiler/rustc_session/src/options.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_session/src/session.rs | 10 |
3 files changed, 25 insertions, 1 deletions
diff --git a/compiler/rustc_session/src/errors.rs b/compiler/rustc_session/src/errors.rs index 462e2a97c33..dbb74d1e244 100644 --- a/compiler/rustc_session/src/errors.rs +++ b/compiler/rustc_session/src/errors.rs @@ -490,3 +490,14 @@ pub(crate) struct FunctionReturnThunkExternRequiresNonLargeCodeModel; pub(crate) struct FailedToCreateProfiler { pub(crate) err: String, } + +#[derive(Diagnostic)] +#[diag(session_soft_float_ignored)] +#[note] +pub(crate) struct SoftFloatIgnored; + +#[derive(Diagnostic)] +#[diag(session_soft_float_deprecated)] +#[note] +#[note(session_soft_float_deprecated_issue)] +pub(crate) struct SoftFloatDeprecated; diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index e487a2501e3..62d3482a7f1 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -1515,6 +1515,7 @@ options! { // - src/doc/rustc/src/codegen-options/index.md // tidy-alphabetical-start + #[rustc_lint_opt_deny_field_access("documented to do nothing")] ar: String = (String::new(), parse_string, [UNTRACKED], "this option is deprecated and does nothing"), #[rustc_lint_opt_deny_field_access("use `Session::code_model` instead of this field")] @@ -1547,6 +1548,7 @@ options! { "force use of unwind tables"), incremental: Option<String> = (None, parse_opt_string, [UNTRACKED], "enable incremental compilation"), + #[rustc_lint_opt_deny_field_access("documented to do nothing")] inline_threshold: Option<u32> = (None, parse_opt_number, [TRACKED], "this option is deprecated and does nothing \ (consider using `-Cllvm-args=--inline-threshold=...`)"), @@ -1583,6 +1585,7 @@ options! { "give an empty list of passes to the pass manager"), no_redzone: Option<bool> = (None, parse_opt_bool, [TRACKED], "disable the use of the redzone"), + #[rustc_lint_opt_deny_field_access("documented to do nothing")] no_stack_check: bool = (false, parse_no_flag, [UNTRACKED], "this option is deprecated and does nothing"), no_vectorize_loops: bool = (false, parse_no_flag, [TRACKED], @@ -1619,7 +1622,7 @@ options! { save_temps: bool = (false, parse_bool, [UNTRACKED], "save all temporary output files during compilation (default: no)"), soft_float: bool = (false, parse_bool, [TRACKED], - "use soft float ABI (*eabihf targets only) (default: no)"), + "deprecated option: use soft float ABI (*eabihf targets only) (default: no)"), #[rustc_lint_opt_deny_field_access("use `Session::split_debuginfo` instead of this field")] split_debuginfo: Option<SplitDebuginfo> = (None, parse_split_debuginfo, [TRACKED], "how to handle split-debuginfo, a platform-specific option"), diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 387ae1b78c4..2d90177ccea 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -1348,6 +1348,16 @@ fn validate_commandline_args_with_session_available(sess: &Session) { } } } + + if sess.opts.cg.soft_float { + if sess.target.arch == "arm" && sess.target.abi == "eabihf" { + sess.dcx().emit_warn(errors::SoftFloatDeprecated); + } else { + // All `use_softfp` does is the equivalent of `-mfloat-abi` in GCC/clang, which only exists on ARM targets. + // We document this flag to only affect `*eabihf` targets, so let's show a warning for all other targets. + sess.dcx().emit_warn(errors::SoftFloatIgnored); + } + } } /// Holds data on the current incremental compilation session, if there is one. |
