Skip to content

Commit

Permalink
remove redundant type_alignment function (#24434)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson authored Nov 3, 2017
1 parent 1bb71e9 commit 8cd97c5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
2 changes: 0 additions & 2 deletions base/reflection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,6 @@ function fieldindex(T::DataType, name::Symbol, err::Bool=true)
return Int(ccall(:jl_field_index, Cint, (Any, Any, Cint), T, name, err)+1)
end

type_alignment(x::DataType) = (@_pure_meta; ccall(:jl_get_alignment, Csize_t, (Any,), x))

"""
fieldcount(t::Type)
Expand Down
7 changes: 0 additions & 7 deletions src/datatype.c
Original file line number Diff line number Diff line change
Expand Up @@ -855,13 +855,6 @@ JL_DLLEXPORT size_t jl_get_field_offset(jl_datatype_t *ty, int field)
return jl_field_offset(ty, field - 1);
}

JL_DLLEXPORT size_t jl_get_alignment(jl_datatype_t *ty)
{
if (ty->layout == NULL)
jl_error("non-leaf type doesn't have an alignment");
return jl_datatype_align(ty);
}

#ifdef __cplusplus
}
#endif
6 changes: 3 additions & 3 deletions test/reflection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -342,13 +342,13 @@ tlayout = TLayout(5,7,11)
@test_throws BoundsError fieldname(NTuple{3, Int}, 0)
@test_throws BoundsError fieldname(NTuple{3, Int}, 4)

import Base: isstructtype, type_alignment, return_types
import Base: isstructtype, datatype_alignment, return_types
@test !isstructtype(Union{})
@test !isstructtype(Union{Int,Float64})
@test !isstructtype(Int)
@test isstructtype(TLayout)
@test type_alignment(UInt16) == 2
@test type_alignment(TLayout) == 4
@test datatype_alignment(UInt16) == 2
@test datatype_alignment(TLayout) == 4
let rts = return_types(TLayout)
@test length(rts) >= 3 # general constructor, specific constructor, and call-to-convert adapter(s)
@test all(rts .== TLayout)
Expand Down

0 comments on commit 8cd97c5

Please sign in to comment.