From 42578676fb6ec8419745259b68d99d0d1cb69b36 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Mon, 25 Feb 2019 14:56:53 +0100
Subject: [PATCH] Provisions for Octave 5

(cherry picked from commit d4217c02b0fe47b12fd82fd640398659a0ff1c92)
---
 matlab/dynare_config.m  | 8 ++++----
 matlab/warning_config.m | 1 +
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/matlab/dynare_config.m b/matlab/dynare_config.m
index 9be0d84583..6bb1da89aa 100644
--- a/matlab/dynare_config.m
+++ b/matlab/dynare_config.m
@@ -82,8 +82,8 @@ if ~isoctave
     p{end+1} = '/missing/vec';
 end
 
-% ordeig() doesn't exist in Octave
-if isoctave
+% ordeig() doesn't exist in Octave < 5
+if isoctave && octave_ver_less_than('5')
     p{end+1} = '/missing/ordeig';
 end
 
@@ -119,8 +119,8 @@ if ~exist('struct2array')
     p{end+1} = '/missing/struct2array';
 end
 
-% isfile is missing in Octave and Matlab<R2017b
-if isoctave || matlab_ver_less_than('9.3')
+% isfile is missing in Octave < 5 and Matlab < R2017b
+if (isoctave && octave_ver_less_than('5')) || (~isoctave && matlab_ver_less_than('9.3'))
     p{end+1} = '/missing/isfile';
 end
 
diff --git a/matlab/warning_config.m b/matlab/warning_config.m
index 720f5aae61..dce08026fe 100644
--- a/matlab/warning_config.m
+++ b/matlab/warning_config.m
@@ -51,6 +51,7 @@ if isoctave
     warning('off', 'Octave:variable-switch-label');
     warning('off', 'Octave:fortran-indexing');
     warning('off', 'Octave:classdef-to-struct');
+    warning('off', 'Octave:legacy-function'); % For strmatch and isdir
 else
     % In MATLAB >= 7.7, don't display a warning if we use deprecated
     % interface to set seed of random number generators
-- 
GitLab