Skip to content

Commit

Permalink
Add at-cfunction
Browse files Browse the repository at this point in the history
  • Loading branch information
ararslan committed May 23, 2018
1 parent c5527e9 commit 7b173da
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -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
8 changes: 8 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 6 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7b173da

Please sign in to comment.