Blame SOURCES/0016-Suppress-warning-with-Wno-overwrite-recursive.patch

ca6e07
From 9bf3b68e118a749ab87f52649fd56aca059470e8 Mon Sep 17 00:00:00 2001
ca6e07
From: Mark Eggleston <markeggleston@codethink.com>
ca6e07
Date: Tue, 16 Apr 2019 09:09:12 +0100
ca6e07
Subject: [PATCH 16/16] Suppress warning with -Wno-overwrite-recursive
ca6e07
ca6e07
The message "Warning: Flag '-fno-automatic' overwrites '-frecursive'" is
ca6e07
output by default when -fno-automatic and -frecursive are used together.
ca6e07
It warns that recursion may be broken, however if all the relavent variables
ca6e07
in the recursive procedure have automatic attributes the warning is
ca6e07
unnecessary so -Wno-overwrite-recursive can be used to suppress it. This
ca6e07
will allow compilation when warnings are regarded as errors.
ca6e07
ca6e07
Suppress warning with -Wno-overwrite-recursive
ca6e07
---
ca6e07
 gcc/fortran/lang.opt  | 4 ++++
ca6e07
 gcc/fortran/options.c | 2 +-
ca6e07
 2 files changed, 5 insertions(+), 1 deletion(-)
ca6e07
ca6e07
diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt
ca6e07
index dca3fd27aa3..e5074f614e3 100644
ca6e07
--- a/gcc/fortran/lang.opt
ca6e07
+++ b/gcc/fortran/lang.opt
ca6e07
@@ -293,6 +293,10 @@ Wopenmp-simd
ca6e07
 Fortran
ca6e07
 ; Documented in C
ca6e07
 
ca6e07
+Woverwrite-recursive
ca6e07
+Fortran Warning Var(warn_overwrite_recursive) Init(1)
ca6e07
+Warn that -fno-automatic may break recursion.
ca6e07
+
ca6e07
 Wpedantic
ca6e07
 Fortran
ca6e07
 ; Documented in common.opt
ca6e07
diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
ca6e07
index f417f48f6a7..6cbc64bf1ae 100644
ca6e07
--- a/gcc/fortran/options.c
ca6e07
+++ b/gcc/fortran/options.c
ca6e07
@@ -418,7 +418,7 @@ gfc_post_options (const char **pfilename)
ca6e07
       && flag_max_stack_var_size != 0)
ca6e07
     gfc_warning_now (0, "Flag %<-fno-automatic%> overwrites %<-fmax-stack-var-size=%d%>",
ca6e07
 		     flag_max_stack_var_size);
ca6e07
-  else if (!flag_automatic && flag_recursive)
ca6e07
+  else if (!flag_automatic && flag_recursive && warn_overwrite_recursive)
ca6e07
     gfc_warning_now (0, "Flag %<-fno-automatic%> overwrites %<-frecursive%>");
ca6e07
   else if (!flag_automatic && flag_openmp)
ca6e07
     gfc_warning_now (0, "Flag %<-fno-automatic%> overwrites %<-frecursive%> implied by "
ca6e07
-- 
ca6e07
2.11.0
ca6e07