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

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