Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecate &x in ccall. fixes #6080 #23555

Merged
merged 1 commit into from
Sep 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ Language changes
* Variable bindings local to `while` loop bodies are now freshly allocated on each loop iteration,
matching the behavior of `for` loops.

* Prefix `&` for by-reference arguments to `ccall` has been deprecated in favor of
`Ref` argument types ([#6080]).

Breaking changes
----------------

Expand Down
7 changes: 7 additions & 0 deletions src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -3511,6 +3511,13 @@ f(x) = yt(x)
((call new foreigncall)
(let* ((args
(cond ((eq? (car e) 'foreigncall)
(for-each (lambda (a)
(if (and (length= a 2) (eq? (car a) '&))
(deprecation-message
(string "Syntax \"&argument\"" (linenode-string current-loc)
" is deprecated. Remove the \"&\" and use a \"Ref\" argument "
"type instead."))))
(list-tail e 6))
;; NOTE: 2nd to 5th arguments of ccall must be left in place
;; the 1st should be compiled if an atom.
(append (if (atom? (cadr e))
Expand Down
1 change: 0 additions & 1 deletion test/ccall.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ let a
a = 2.84 + 5.2im

@test_throws MethodError ccall((:cptest, libccalltest), Ptr{Complex{Int}}, (Ptr{Complex{Int}},), a)
@test_throws MethodError ccall((:cptest, libccalltest), Ptr{Complex{Int}}, (Complex{Int},), &a)
end


Expand Down