Skip to content

Commit 8672b59

Browse files
authored
Prefix possibly unused generated variable with _ (#673)
In code generated by `@kernel`, the gensym-ed variable may be unused, causing JETLS to show notes on the function definition. Prefixing the generated name with `_` makes the warning go away, greatly reducing noise in downstream packages when going through JETLS diagnostic messages.
1 parent 1f84b17 commit 8672b59

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/macros.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ function emit_cpu(loop)
277277
append!(stmts, loop.allocations)
278278

279279
# private_allocations turn into lhs = ntuple(i->rhs, length(__workitems_iterspace()))
280-
N = gensym(:N)
280+
N = Symbol("_", gensym(:N)) # Prefix name with `_` because it may be unused, but it's ok
281281
push!(stmts, :($N = length($__workitems_iterspace(__ctx__))))
282282

283283
for stmt in loop.private_allocations

0 commit comments

Comments
 (0)