I’m not aware of such a macro … it seems the information is easily available from the lowered code though and the following might be a start:
macro warn_nonconst_globals(expr)
:(let low = @code_lowered($expr)
walker(x) = if x isa GlobalRef && !isconst(x); println(x) end
MacroTools.postwalk.(Ref(walker), low.code)
nothing
end)
end
julia> @warn_nonconst_globals fun_c(a)
Main.b