diff --git a/README.md b/README.md index f11ac8ad4..fb2adf7d4 100644 --- a/README.md +++ b/README.md @@ -94,8 +94,6 @@ Currently, the `@compat` macro supports the following syntaxes: * `Compat.split` and `Compat.rsplit` accept `keepempty` keyword argument if `splitter` is given as second argument ([#26634]) -* `cfunction` is now `@cfunction` ([#26486]). - * `vecnorm` and `vecdot` are now `Compat.norm` and `Compat.dot`, respectively, while the old `norm(A::AbstractMatrix, p=2)` is now `Compat.opnorm` ([#27401]). `import Compat: ⋅` to get `Compat.dot` as the binary operator `⋅`. diff --git a/src/Compat.jl b/src/Compat.jl index ca9502732..2625d6254 100644 --- a/src/Compat.jl +++ b/src/Compat.jl @@ -78,14 +78,6 @@ end end end -# 0.7.0-DEV.4762 -@static if !isdefined(Base, Symbol("@cfunction")) - macro cfunction(f, rt, tup) - :(Base.cfunction($(esc(f)), $(esc(rt)), Tuple{$(esc(tup))...})) - end - export @cfunction -end - if VERSION < v"0.7.0-DEV.2920" # julia#24999 Base.length(s::AbstractString, i::Integer, j::Integer) = length(s, Int(i), Int(j)) function Base.length(s::AbstractString, i::Int, j::Int) diff --git a/test/old.jl b/test/old.jl index 870746898..f75455ad2 100644 --- a/test/old.jl +++ b/test/old.jl @@ -1079,3 +1079,18 @@ end # 0.7.0-DEV.4905 @test isbitstype(Int) @test !isbitstype(Vector{Int}) + +# 0.7.0-DEV.4762 +let ptr = @cfunction(+, Int, (Int, Int)) + @test ptr isa Ptr{Cvoid} + @test ptr != C_NULL + @test ccall(ptr, Int, (Int, Int), 2, 3) == 5 +end +# issue #565 +issue565(x) = x + 1 +const Issue565 = Int +let bar() = @cfunction(issue565, Issue565, (Issue565,)), ptr = bar() + @test ptr isa Ptr{Cvoid} + @test ptr != C_NULL + @test ccall(ptr, Int, (Int,), 2) === 3 +end diff --git a/test/runtests.jl b/test/runtests.jl index d6207e928..564dfdeff 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -94,21 +94,6 @@ end @test length(Compat.CartesianIndices((1:2,))) == 2 @test length(Compat.CartesianIndices((1:2, -1:1))) == 6 -# 0.7.0-DEV.4762 -let ptr = @cfunction(+, Int, (Int, Int)) - @test ptr isa Ptr{Cvoid} - @test ptr != C_NULL - @test ccall(ptr, Int, (Int, Int), 2, 3) == 5 -end -# issue #565 -issue565(x) = x + 1 -const Issue565 = Int -let bar() = @cfunction(issue565, Issue565, (Issue565,)), ptr = bar() - @test ptr isa Ptr{Cvoid} - @test ptr != C_NULL - @test ccall(ptr, Int, (Int,), 2) === 3 -end - # 0.7.0-DEV.5278 @test something(nothing, 1) === 1 @test something(Some(2)) === 2