public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-7521] gccrs: enable -Winfinite-recursion warnings by default
@ 2024-01-16 17:41 Arthur Cohen
  0 siblings, 0 replies; only message in thread
From: Arthur Cohen @ 2024-01-16 17:41 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:50c549ef3db6276a6a89bead477bea5f74f07adc

commit r14-7521-g50c549ef3db6276a6a89bead477bea5f74f07adc
Author: Philip Herron <herron.philip@googlemail.com>
Date:   Thu Apr 20 12:06:21 2023 +0100

    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 <herron.philip@googlemail.com>

Diff:
---
 gcc/rust/lang.opt     | 4 ++++
 gcc/rust/rust-lang.cc | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/gcc/rust/lang.opt b/gcc/rust/lang.opt
index 1c3b5b0dbf2..3a5981e4c85 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=<name>             Set the crate name for the compilation
diff --git a/gcc/rust/rust-lang.cc b/gcc/rust/rust-lang.cc
index f61d315ae50..084f74c9121 100644
--- a/gcc/rust/rust-lang.cc
+++ b/gcc/rust/rust-lang.cc
@@ -159,6 +159,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 ();

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-16 17:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-16 17:41 [gcc r14-7521] gccrs: enable -Winfinite-recursion warnings by default Arthur Cohen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).