Skip to content

Commit

Permalink
rename Void => Cvoid, Nothing (depending on usage)
Browse files Browse the repository at this point in the history
git ls-files base doc examples src stdlib test | xargs perl -i -ple '/\b(ccall|cglobal|cfunction)\b/ && s/\bVoid\b/Cvoid/g'
git ls-files base doc examples src stdlib test | xargs perl -i -ple 's/\bPtr\{Void\}/Ptr{Cvoid}/g'
git ls-files base doc examples src stdlib test | xargs perl -i -ple 's/\Ref\{Void\}/Ref{Cvoid}/g'
perl -i -ple 's/\bVoid\b/Cvoid/g' base/atomics.jl base/libgit2/status.jl base/random/dSFMT.jl doc/src/manual/calling-c-and-fortran-code.md test/llvmcall.jl test/threads.jl
git ls-files base doc examples src stdlib test | xargs perl -i -ple 's/\bVoid\b/Nothing/g'
  • Loading branch information
StefanKarpinski committed Dec 20, 2017
1 parent 84ce70b commit e5fa92b
Show file tree
Hide file tree
Showing 195 changed files with 1,850 additions and 1,850 deletions.
2 changes: 1 addition & 1 deletion base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1697,7 +1697,7 @@ end
## iteration utilities ##

"""
foreach(f, c...) -> Void
foreach(f, c...) -> Nothing
Call function `f` on each element of iterable `c`.
For multiple iterable arguments, `f` is called elementwise.
Expand Down
2 changes: 1 addition & 1 deletion base/abstractdict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ end

function empty!(t::ObjectIdDict)
resize!(t.ht, 32)
ccall(:memset, Ptr{Void}, (Ptr{Void}, Cint, Csize_t), t.ht, 0, sizeof(t.ht))
ccall(:memset, Ptr{Cvoid}, (Ptr{Cvoid}, Cint, Csize_t), t.ht, 0, sizeof(t.ht))
t.ndel = 0
return t
end
Expand Down
38 changes: 19 additions & 19 deletions base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ segfault your program, in the same manner as C.
function unsafe_copyto!(dest::Ptr{T}, src::Ptr{T}, n) where T
# Do not use this to copy data between pointer arrays.
# It can't be made safe no matter how carefully you checked.
ccall(:memmove, Ptr{Void}, (Ptr{Void}, Ptr{Void}, UInt),
ccall(:memmove, Ptr{Cvoid}, (Ptr{Cvoid}, Ptr{Cvoid}, UInt),
dest, src, n*sizeof(T))
return dest
end
Expand All @@ -182,15 +182,15 @@ function unsafe_copyto!(dest::Array{T}, doffs, src::Array{T}, soffs, n) where T
if isbits(T)
unsafe_copyto!(pointer(dest, doffs), pointer(src, soffs), n)
elseif isbitsunion(T)
ccall(:memmove, Ptr{Void}, (Ptr{Void}, Ptr{Void}, UInt),
ccall(:memmove, Ptr{Cvoid}, (Ptr{Cvoid}, Ptr{Cvoid}, UInt),
pointer(dest, doffs), pointer(src, soffs), n * Base.bitsunionsize(T))
# copy selector bytes
ccall(:memmove, Ptr{Void}, (Ptr{Void}, Ptr{Void}, UInt),
ccall(:memmove, Ptr{Cvoid}, (Ptr{Cvoid}, Ptr{Cvoid}, UInt),
convert(Ptr{UInt8}, pointer(dest)) + length(dest) * Base.bitsunionsize(T) + doffs - 1,
convert(Ptr{UInt8}, pointer(src)) + length(src) * Base.bitsunionsize(T) + soffs - 1,
n)
else
ccall(:jl_array_ptr_copy, Void, (Any, Ptr{Void}, Any, Ptr{Void}, Int),
ccall(:jl_array_ptr_copy, Cvoid, (Any, Ptr{Cvoid}, Any, Ptr{Cvoid}, Int),
dest, pointer(dest, doffs), src, pointer(src, soffs), n)
end
@_gc_preserve_end t2
Expand Down Expand Up @@ -304,7 +304,7 @@ end
getindex(::Type{Any}) = Vector{Any}()

function fill!(a::Union{Array{UInt8}, Array{Int8}}, x::Integer)
ccall(:memset, Ptr{Void}, (Ptr{Void}, Cint, Csize_t), a, x, length(a))
ccall(:memset, Ptr{Cvoid}, (Ptr{Cvoid}, Cint, Csize_t), a, x, length(a))
return a
end

Expand Down Expand Up @@ -727,20 +727,20 @@ setindex!(A::Array{T, N}, x::Number, ::Vararg{Colon, N}) where {T, N} = fill!(A,
# efficiently grow an array

_growbeg!(a::Vector, delta::Integer) =
ccall(:jl_array_grow_beg, Void, (Any, UInt), a, delta)
ccall(:jl_array_grow_beg, Cvoid, (Any, UInt), a, delta)
_growend!(a::Vector, delta::Integer) =
ccall(:jl_array_grow_end, Void, (Any, UInt), a, delta)
ccall(:jl_array_grow_end, Cvoid, (Any, UInt), a, delta)
_growat!(a::Vector, i::Integer, delta::Integer) =
ccall(:jl_array_grow_at, Void, (Any, Int, UInt), a, i - 1, delta)
ccall(:jl_array_grow_at, Cvoid, (Any, Int, UInt), a, i - 1, delta)

# efficiently delete part of an array

_deletebeg!(a::Vector, delta::Integer) =
ccall(:jl_array_del_beg, Void, (Any, UInt), a, delta)
ccall(:jl_array_del_beg, Cvoid, (Any, UInt), a, delta)
_deleteend!(a::Vector, delta::Integer) =
ccall(:jl_array_del_end, Void, (Any, UInt), a, delta)
ccall(:jl_array_del_end, Cvoid, (Any, UInt), a, delta)
_deleteat!(a::Vector, i::Integer, delta::Integer) =
ccall(:jl_array_del_at, Void, (Any, Int, UInt), a, i - 1, delta)
ccall(:jl_array_del_at, Cvoid, (Any, Int, UInt), a, i - 1, delta)

## Dequeue functionality ##

Expand Down Expand Up @@ -918,7 +918,7 @@ julia> a[1:6]
function resize!(a::Vector, nl::Integer)
l = length(a)
if nl > l
ccall(:jl_array_grow_end, Void, (Any, UInt), a, nl-l)
ccall(:jl_array_grow_end, Cvoid, (Any, UInt), a, nl-l)
else
if nl < 0
throw(ArgumentError("new length must be ≥ 0"))
Expand All @@ -936,7 +936,7 @@ Suggest that collection `s` reserve capacity for at least `n` elements. This can
function sizehint! end

function sizehint!(a::Vector, sz::Integer)
ccall(:jl_array_sizehint, Void, (Any, UInt), a, sz)
ccall(:jl_array_sizehint, Cvoid, (Any, UInt), a, sz)
a
end

Expand Down Expand Up @@ -1302,7 +1302,7 @@ function empty!(a::Vector)
return a
end

_memcmp(a, b, len) = ccall(:memcmp, Int32, (Ptr{Void}, Ptr{Void}, Csize_t), a, b, len) % Int
_memcmp(a, b, len) = ccall(:memcmp, Int32, (Ptr{Cvoid}, Ptr{Cvoid}, Csize_t), a, b, len) % Int

# use memcmp for lexcmp on byte arrays
function lexcmp(a::Array{UInt8,1}, b::Array{UInt8,1})
Expand Down Expand Up @@ -1450,24 +1450,24 @@ function vcat(arrays::Vector{T}...) where T
elsz = bitsunionsize(T)
selptr = convert(Ptr{UInt8}, ptr) + n * elsz
else
elsz = Core.sizeof(Ptr{Void})
elsz = Core.sizeof(Ptr{Cvoid})
end
t = @_gc_preserve_begin arr
for a in arrays
na = length(a)
nba = na * elsz
if isbits(T)
ccall(:memcpy, Ptr{Void}, (Ptr{Void}, Ptr{Void}, UInt),
ccall(:memcpy, Ptr{Cvoid}, (Ptr{Cvoid}, Ptr{Cvoid}, UInt),
ptr, a, nba)
elseif isbitsunion(T)
ccall(:memcpy, Ptr{Void}, (Ptr{Void}, Ptr{Void}, UInt),
ccall(:memcpy, Ptr{Cvoid}, (Ptr{Cvoid}, Ptr{Cvoid}, UInt),
ptr, a, nba)
# copy selector bytes
ccall(:memcpy, Ptr{Void}, (Ptr{Void}, Ptr{Void}, UInt),
ccall(:memcpy, Ptr{Cvoid}, (Ptr{Cvoid}, Ptr{Cvoid}, UInt),
selptr, convert(Ptr{UInt8}, pointer(a)) + nba, na)
selptr += na
else
ccall(:jl_array_ptr_copy, Void, (Any, Ptr{Void}, Any, Ptr{Void}, Int),
ccall(:jl_array_ptr_copy, Cvoid, (Any, Ptr{Cvoid}, Any, Ptr{Cvoid}, Int),
arr, ptr, a, pointer(a), na)
end
ptr += nba
Expand Down
2 changes: 1 addition & 1 deletion base/arrayshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ show(io::IO, X::AbstractVector) = show_vector(io, X)
# not set to Any, then the problem would be similar one layer below
# when printing an array like Any[Any[1]]; hence we must treat Any
# specially
function typeinfo_eltype(typeinfo::Type)::Union{Type,Void}
function typeinfo_eltype(typeinfo::Type)::Union{Type,Nothing}
if typeinfo == Any
# the current context knows nothing about what is being displayed, not even
# whether it's a collection or scalar
Expand Down
6 changes: 3 additions & 3 deletions base/atomics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ for typ in atomictypes
%ptr = inttoptr i$WORD_SIZE %0 to $lt*
store atomic $lt %1, $lt* %ptr release, align $(alignment(typ))
ret void
""", Void, Tuple{Ptr{$typ}, $typ}, unsafe_convert(Ptr{$typ}, x), v)
""", Cvoid, Tuple{Ptr{$typ}, $typ}, unsafe_convert(Ptr{$typ}, x), v)

# Note: atomic_cas! succeeded (i.e. it stored "new") if and only if the result is "cmp"
if typ <: Integer
Expand Down Expand Up @@ -421,7 +421,7 @@ for op in [:+, :-, :max, :min]
old = atomic_cas!(var, cmp, new)
reinterpret(IT, old) == reinterpret(IT, cmp) && return new
# Temporary solution before we have gc transition support in codegen.
ccall(:jl_gc_safepoint, Void, ())
ccall(:jl_gc_safepoint, Cvoid, ())
end
end
end
Expand All @@ -444,4 +444,4 @@ For further details, see LLVM's `fence` instruction.
atomic_fence() = llvmcall("""
fence seq_cst
ret void
""", Void, Tuple{})
""", Cvoid, Tuple{})
30 changes: 15 additions & 15 deletions base/bitarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ function push!(B::BitVector, item)

l = _mod64(length(B))
if l == 0
ccall(:jl_array_grow_end, Void, (Any, UInt), Bc, 1)
ccall(:jl_array_grow_end, Cvoid, (Any, UInt), Bc, 1)
Bc[end] = UInt64(0)
end
B.len += 1
Expand All @@ -755,7 +755,7 @@ function append!(B::BitVector, items::BitVector)
k0 = length(Bc)
k1 = num_bit_chunks(n0 + n1)
if k1 > k0
ccall(:jl_array_grow_end, Void, (Any, UInt), Bc, k1 - k0)
ccall(:jl_array_grow_end, Cvoid, (Any, UInt), Bc, k1 - k0)
Bc[end] = UInt64(0)
end
B.len += n1
Expand All @@ -774,7 +774,7 @@ function prepend!(B::BitVector, items::BitVector)
k0 = length(Bc)
k1 = num_bit_chunks(n0 + n1)
if k1 > k0
ccall(:jl_array_grow_end, Void, (Any, UInt), Bc, k1 - k0)
ccall(:jl_array_grow_end, Cvoid, (Any, UInt), Bc, k1 - k0)
Bc[end] = UInt64(0)
end
B.len += n1
Expand All @@ -787,7 +787,7 @@ prepend!(B::BitVector, items::AbstractVector{Bool}) = prepend!(B, BitArray(items
prepend!(A::Vector{Bool}, items::BitVector) = prepend!(A, Array(items))

function sizehint!(B::BitVector, sz::Integer)
ccall(:jl_array_sizehint, Void, (Any, UInt), B.chunks, num_bit_chunks(sz))
ccall(:jl_array_sizehint, Cvoid, (Any, UInt), B.chunks, num_bit_chunks(sz))
return B
end

Expand All @@ -803,7 +803,7 @@ function resize!(B::BitVector, n::Integer)
k0 = length(Bc)
k1 = num_bit_chunks(Int(n))
if k1 > k0
ccall(:jl_array_grow_end, Void, (Any, UInt), Bc, k1 - k0)
ccall(:jl_array_grow_end, Cvoid, (Any, UInt), Bc, k1 - k0)
Bc[end] = UInt64(0)
end
B.len = n
Expand All @@ -816,7 +816,7 @@ function pop!(B::BitVector)
B[end] = false

l = _mod64(length(B))
l == 1 && ccall(:jl_array_del_end, Void, (Any, UInt), B.chunks, 1)
l == 1 && ccall(:jl_array_del_end, Cvoid, (Any, UInt), B.chunks, 1)
B.len -= 1

return item
Expand All @@ -829,7 +829,7 @@ function unshift!(B::BitVector, item)

l = _mod64(length(B))
if l == 0
ccall(:jl_array_grow_end, Void, (Any, UInt), Bc, 1)
ccall(:jl_array_grow_end, Cvoid, (Any, UInt), Bc, 1)
Bc[end] = UInt64(0)
end
B.len += 1
Expand Down Expand Up @@ -857,7 +857,7 @@ function shift!(B::BitVector)

l = _mod64(length(B))
if l == 1
ccall(:jl_array_del_end, Void, (Any, UInt), Bc, 1)
ccall(:jl_array_del_end, Cvoid, (Any, UInt), Bc, 1)
else
Bc[end] >>>= 1
end
Expand All @@ -878,7 +878,7 @@ function insert!(B::BitVector, i::Integer, item)

l = _mod64(length(B))
if l == 0
ccall(:jl_array_grow_end, Void, (Any, UInt), Bc, 1)
ccall(:jl_array_grow_end, Cvoid, (Any, UInt), Bc, 1)
Bc[end] = UInt64(0)
end
B.len += 1
Expand Down Expand Up @@ -916,7 +916,7 @@ function _deleteat!(B::BitVector, i::Integer)
l = _mod64(length(B))

if l == 1
ccall(:jl_array_del_end, Void, (Any, UInt), Bc, 1)
ccall(:jl_array_del_end, Cvoid, (Any, UInt), Bc, 1)
elseif length(Bc) > k
Bc[end] >>>= 1
end
Expand Down Expand Up @@ -947,7 +947,7 @@ function deleteat!(B::BitVector, r::UnitRange{Int})

copy_chunks!(Bc, i_f, Bc, i_l+1, n-i_l)

delta_k < 0 && ccall(:jl_array_del_end, Void, (Any, UInt), Bc, -delta_k)
delta_k < 0 && ccall(:jl_array_del_end, Cvoid, (Any, UInt), Bc, -delta_k)

B.len = new_l

Expand Down Expand Up @@ -985,7 +985,7 @@ function deleteat!(B::BitVector, inds)
q <= n && copy_chunks!(Bc, p, Bc, q, n-q+1)

delta_k = num_bit_chunks(new_l) - length(Bc)
delta_k < 0 && ccall(:jl_array_del_end, Void, (Any, UInt), Bc, -delta_k)
delta_k < 0 && ccall(:jl_array_del_end, Cvoid, (Any, UInt), Bc, -delta_k)

B.len = new_l

Expand Down Expand Up @@ -1032,12 +1032,12 @@ function splice!(B::BitVector, r::Union{UnitRange{Int}, Integer}, ins::AbstractA
new_l = length(B) + lins - ldel
delta_k = num_bit_chunks(new_l) - length(Bc)

delta_k > 0 && ccall(:jl_array_grow_end, Void, (Any, UInt), Bc, delta_k)
delta_k > 0 && ccall(:jl_array_grow_end, Cvoid, (Any, UInt), Bc, delta_k)

copy_chunks!(Bc, i_f+lins, Bc, i_l+1, n-i_l)
copy_chunks!(Bc, i_f, Bins.chunks, 1, lins)

delta_k < 0 && ccall(:jl_array_del_end, Void, (Any, UInt), Bc, -delta_k)
delta_k < 0 && ccall(:jl_array_del_end, Cvoid, (Any, UInt), Bc, -delta_k)

B.len = new_l

Expand All @@ -1060,7 +1060,7 @@ end


function empty!(B::BitVector)
ccall(:jl_array_del_end, Void, (Any, UInt), B.chunks, length(B.chunks))
ccall(:jl_array_del_end, Cvoid, (Any, UInt), B.chunks, length(B.chunks))
B.len = 0
return B
end
Expand Down
Loading

0 comments on commit e5fa92b

Please sign in to comment.