diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-10-12 13:11:15 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-12 13:11:15 +0000 |
commit | 1a871569f66cdf1a0aabb3a50d5877a8b1c9db85 (patch) | |
tree | 3635bbbc3e2f8b599c1f108587ab8377be9111f7 /gcc | |
parent | 3e7320510e7bb774295ecbd8089a9f51d6475959 (diff) | |
parent | 4134055f1855ea5293fa598fc3503e07a11d1d9d (diff) | |
download | gcc-1a871569f66cdf1a0aabb3a50d5877a8b1c9db85.zip gcc-1a871569f66cdf1a0aabb3a50d5877a8b1c9db85.tar.gz gcc-1a871569f66cdf1a0aabb3a50d5877a8b1c9db85.tar.bz2 |
Merge #1570
1570: Apply #1560 master r=CohenArthur a=CohenArthur
Same as #1560, but in a single more descriptive commit. I'll hold on doing the other fixes until you're okay with the process `@philberty`
Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/lang.opt | 6 | ||||
-rw-r--r-- | gcc/rust/rust-lang.cc | 7 |
2 files changed, 10 insertions, 3 deletions
diff --git a/gcc/rust/lang.opt b/gcc/rust/lang.opt index bb3b998..40297ad 100644 --- a/gcc/rust/lang.opt +++ b/gcc/rust/lang.opt @@ -39,7 +39,7 @@ Rust ; Documented in c.opt Wunused-variable -Rust Var(warn_unused_variable) Init(1) Warning +Rust Var(warn_unused_variable) Warning ; documented in common.opt Wunused-const-variable @@ -47,11 +47,11 @@ Rust Warning Alias(Wunused-const-variable=, 2, 0) Warn when a const variable is unused. Wunused-const-variable= -Rust Joined RejectNegative UInteger Var(warn_unused_const_variable) Init(1) Warning LangEnabledBy(Rust,Wunused-variable, 1, 0) IntegerRange(0, 2) +Rust Joined RejectNegative UInteger Var(warn_unused_const_variable) Warning LangEnabledBy(Rust,Wunused-variable, 1, 0) IntegerRange(0, 2) Warn when a const variable is unused. Wunused-result -Rust Var(warn_unused_result) Init(1) Warning +Rust Var(warn_unused_result) Warning Warn if a caller of a function, marked with attribute warn_unused_result, does not use its return value. frust-crate= diff --git a/gcc/rust/rust-lang.cc b/gcc/rust/rust-lang.cc index ed822cc..34778c8 100644 --- a/gcc/rust/rust-lang.cc +++ b/gcc/rust/rust-lang.cc @@ -160,6 +160,13 @@ grs_langhook_init_options_struct (struct gcc_options *opts) * builtins */ opts->x_flag_wrapv = 1; + /* We need to warn on unused variables by default */ + opts->x_warn_unused_variable = 1; + /* For const variables too */ + opts->x_warn_unused_const_variable = 1; + /* And finally unused result for #[must_use] */ + opts->x_warn_unused_result = 1; + // nothing yet - used by frontends to change specific options for the language Rust::Session::get_instance ().init_options (); } |