From 8f6680458524877c7803eb9821ccf5e83ecfd080 Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Thu, 20 Apr 2023 12:06:21 +0100 Subject: gccrs: enable -Winfinite-recursion warnings by default gcc/rust/ChangeLog: * lang.opt: add lang option flag * rust-lang.cc (grs_langhook_init_options_struct): enable by default Signed-off-by: Philip Herron --- gcc/rust/lang.opt | 4 ++++ gcc/rust/rust-lang.cc | 2 ++ 2 files changed, 6 insertions(+) (limited to 'gcc') diff --git a/gcc/rust/lang.opt b/gcc/rust/lang.opt index 753cea1..e05dd72 100644 --- a/gcc/rust/lang.opt +++ b/gcc/rust/lang.opt @@ -54,6 +54,10 @@ Wunused-result 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. +Winfinite-recursion +Rust Var(warn_infinite_recursion) Warning +Warn for infinitely recursive calls. + frust-crate= Rust Joined RejectNegative -frust-crate= Set the crate name for the compilation diff --git a/gcc/rust/rust-lang.cc b/gcc/rust/rust-lang.cc index f353229..1f04701 100644 --- a/gcc/rust/rust-lang.cc +++ b/gcc/rust/rust-lang.cc @@ -162,6 +162,8 @@ grs_langhook_init_options_struct (struct gcc_options *opts) opts->x_warn_unused_const_variable = 1; /* And finally unused result for #[must_use] */ opts->x_warn_unused_result = 1; + /* lets warn for infinite recursion*/ + opts->x_warn_infinite_recursion = 1; // nothing yet - used by frontends to change specific options for the language Rust::Session::get_instance ().init_options (); -- cgit v1.1