Skip to content

Commit 057b916

Browse files
authored
Merge pull request #1028 from JuliaControl/autovec_stackoverflow
try to handle stack overflow in linter due to autovec
2 parents b394b96 + 03b8bd8 commit 057b916

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/ControlSystemsBase/src/freqresp.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ sys = ss([-1 0; 0 -2], [1 0; 0 1], [1 1; 0 1], 0)
463463
sv, w = sigma(sys)
464464
```
465465
"""
466-
@autovec (1) function sigma(sys::LTISystem, w::AbstractVector)
466+
@autovec (1,) function sigma(sys::LTISystem, w::AbstractVector)
467467
resp = freqresp(sys, w)
468468
ny, nu = size(sys)
469469
if ny == 1 || nu == 1 # Shortcut available
@@ -476,7 +476,7 @@ sv, w = sigma(sys)
476476
end
477477
return sv, w
478478
end
479-
@autovec (1) sigma(sys::LTISystem) = sigma(sys, _default_freq_vector(sys, Val{:sigma}()))
479+
@autovec (1,) sigma(sys::LTISystem) = sigma(sys, _default_freq_vector(sys, Val{:sigma}()))
480480

481481
function _default_freq_vector(systems::Vector{<:LTISystem}, plot; adaptive=false)
482482
if adaptive

lib/ControlSystemsBase/src/utilities.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,11 @@ the output tuple should be flattened. If the function only has a single output i
155155
(not a tuple with a single item) it should be called as `@autovec () f() = ...`.
156156
`f()` is the original function and `fv()` will be the version with flattened outputs.
157157
"""
158-
macro autovec(indices, f)
158+
macro autovec(indices0, f)
159159
dict = MacroTools.splitdef(f)
160160
rtype = get(dict, :rtype, :Any)
161-
indices = eval(indices)
161+
MacroTools.@capture indices0 (inds__,)
162+
indices = inds
162163

163164
# If indices is empty it means we vec the entire return value
164165
if length(indices) == 0

0 commit comments

Comments
 (0)