From 4c0b2e8c4ec2df8f1833769db1c873486d2b87f7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Fri, 15 Jan 2021 18:08:04 +0100
Subject: [PATCH] Mitigation for spurious warning in Octave

Because of a bug, Octave wrongly complains that matlab/+pac/+bgp/{get,set}.m
shadow built-in functions (see https://savannah.gnu.org/bugs/?46849).

We disable the warning as early as we can after running the dynare command.
However the warning will nevertheless appear two times in a given Octave
session (the first time when the addpath to Dynare is done, the second time
when the dynare command is run).
---
 matlab/warning_config.m | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/matlab/warning_config.m b/matlab/warning_config.m
index 82a7ca5156..b72c7ae064 100644
--- a/matlab/warning_config.m
+++ b/matlab/warning_config.m
@@ -10,7 +10,7 @@ function warning_config()
 % SPECIAL REQUIREMENTS
 %   none
 
-% Copyright (C) 2008-2017 Dynare Team
+% Copyright (C) 2008-2021 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -48,6 +48,11 @@ if isoctave
     warning('off', 'Octave:fortran-indexing');
     warning('off', 'Octave:classdef-to-struct');
     warning('off', 'Octave:legacy-function'); % For strmatch and isdir
+
+    % The following is necessary because of matlab/+pac/+bgp/{get,set}.m
+    % which triggers this bug: https://savannah.gnu.org/bugs/?46849
+    % The warning can be reenabled once the bug is fixed.
+    warning('off', 'Octave:shadowed-function');
 else
     % In MATLAB >= 7.7, don't display a warning if we use deprecated
     % interface to set seed of random number generators
-- 
GitLab