diff --git a/README.md b/README.md index 67e9931cf..820c9dbd2 100644 --- a/README.md +++ b/README.md @@ -413,6 +413,8 @@ Currently, the `@compat` macro supports the following syntaxes: * `isalpha` is now `isletter` ([#27077]). +* `cfunction` is now `@cfunction` ([#26486]). + ## New macros * `@__DIR__` has been added ([#18380]) @@ -637,6 +639,7 @@ includes this fix. Find the minimum version from there. [#26369]: https://github.com/JuliaLang/julia/issues/26369 [#26436]: https://github.com/JuliaLang/julia/issues/26436 [#26442]: https://github.com/JuliaLang/julia/issues/26442 +[#26486]: https://github.com/JuliaLang/julia/issues/26486 [#26660]: https://github.com/JuliaLang/julia/issues/26660 [#26670]: https://github.com/JuliaLang/julia/issues/26670 [#27077]: https://github.com/JuliaLang/julia/issues/27077 diff --git a/src/Compat.jl b/src/Compat.jl index 9acef20b5..108d1234f 100644 --- a/src/Compat.jl +++ b/src/Compat.jl @@ -1891,6 +1891,14 @@ end const isletter = isalpha end +# 0.7.0-DEV.4762 +@static if !isdefined(Base, Symbol("@cfunction")) + macro cfunction(f, rt, tup) + :(Base.cfunction($f, $rt, Tuple{$tup...})) + end + export @cfunction +end + include("deprecated.jl") end # module Compat diff --git a/test/runtests.jl b/test/runtests.jl index 8222eff93..7e9ca5e30 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1757,4 +1757,10 @@ end @test isletter('β') @test !isletter('3') +# 0.7.0-DEV.4762 +let ptr = @cfunction(+, Int, (Int, Int)) + @test ptr isa Cvoid + @test ptr != C_NULL +end + nothing