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

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