Mercurial > octave
changeset 24458:516437d2194d
don't allow function parameters (in or out) to be persistent
* symrec.h (symbol_record::symbol_record_rep::mark_persistent):
Also error if this object is a function argument.
* __unimplemented__.m, imformats.m, odedefaults.m:
Don't make function parameters persistent.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 23 Dec 2017 14:58:27 -0500 |
parents | e3751f50e8ef |
children | b728b7ac1601 |
files | libinterp/corefcn/symrec.h scripts/help/__unimplemented__.m scripts/image/imformats.m scripts/ode/private/odedefaults.m |
diffstat | 4 files changed, 14 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/symrec.h Sat Dec 23 14:15:31 2017 -0500 +++ b/libinterp/corefcn/symrec.h Sat Dec 23 14:58:27 2017 -0500 @@ -381,6 +381,8 @@ if (is_global ()) error ("can't make global variable %s persistent", m_name.c_str ()); + if (is_formal ()) + error ("can't make function parameter %s persistent", m_name.c_str ()); m_storage_class |= persistent; }
--- a/scripts/help/__unimplemented__.m Sat Dec 23 14:15:31 2017 -0500 +++ b/scripts/help/__unimplemented__.m Sat Dec 23 14:58:27 2017 -0500 @@ -546,7 +546,7 @@ endfunction -function list = missing_functions () +function rlist = missing_functions () persistent list = { "addcats", "addCause", @@ -841,6 +841,8 @@ "xmlwrite", "xslt", }; + + rlist = list; endfunction %!test
--- a/scripts/image/imformats.m Sat Dec 23 14:15:31 2017 -0500 +++ b/scripts/image/imformats.m Sat Dec 23 14:58:27 2017 -0500 @@ -142,7 +142,7 @@ endfunction -function formats = default_formats () +function rformats = default_formats () ## The available formats are dependent on what the user has installed at ## a given time, and how GraphicsMagick was built. Checking for @@ -178,6 +178,7 @@ ## there's no need to go and calculate it all over again if we are ## requested to reset back to factory. if (! isempty (formats)) + rformats = formats; return; endif @@ -257,6 +258,8 @@ ## fills rest of format information by checking with GraphicsMagick formats = __magick_formats__ (formats); + rformats = formats; + endfunction function is_valid_format (format)
--- a/scripts/ode/private/odedefaults.m Sat Dec 23 14:15:31 2017 -0500 +++ b/scripts/ode/private/odedefaults.m Sat Dec 23 14:58:27 2017 -0500 @@ -22,7 +22,7 @@ ## Undocumented internal function. ## @end deftypefn -function [defaults, classes, attributes] = odedefaults (n, t0, tf) +function [rdefaults, rclasses, rattributes] = odedefaults (n, t0, tf) persistent defaults = struct ("AbsTol", 1e-6, "BDF", "off", @@ -100,4 +100,8 @@ attributes.InitialSlope = {"real", "vector", "numel", n}; attributes.OutputSel = {"vector", "integer", "positive", ">", 0, "<=", n}; + rdefaults = defaults; + rclasses = classes; + rattributes = attributes; + endfunction