Skip to content

Commit 1365152

Browse files
authored
Merge pull request #137 from JuliaGeometry/teh/warnpcfail
Warn, don't error, on precompile failures
2 parents 97e93aa + 23a88e5 commit 1365152

File tree

1 file changed

+27
-16
lines changed

1 file changed

+27
-16
lines changed

src/precompile.jl

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,39 @@
1+
macro warnpcfail(ex::Expr)
2+
modl = __module__
3+
file = __source__.file === nothing ? "?" : String(__source__.file)
4+
line = __source__.line
5+
quote
6+
$(esc(ex)) || @warn """precompile directive
7+
$($(Expr(:quote, ex)))
8+
failed. Please report an issue in $($modl) (after checking for duplicates) or remove this directive.""" _file=$file _line=$line
9+
end
10+
end
11+
112
function _precompile_()
213
ccall(:jl_generating_output, Cint, ()) == 1 || return nothing
3-
@assert precompile(HyperRectangle{2,Float32}, (Int, Int, Int, Int))
4-
@assert precompile(==, (HyperRectangle{2,Float32}, HyperRectangle{2,Float32}))
5-
@assert precompile(normal_mesh, (Tesselation{3,Float32,Cylinder{3,Float32},1},))
6-
@assert precompile(normal_mesh, (Tesselation{3,Float32,HyperSphere{3,Float32},1},))
7-
@assert precompile(normal_mesh, (HyperSphere{3,Float32},))
8-
@assert precompile(Tuple{typeof(*),SMatrix{4, 4, Float32, 16},HyperRectangle{3, Float32}}) # time: 0.11091917
9-
@assert precompile(Tuple{typeof(coordinates),HyperRectangle{2, Float32},Tuple{Int64, Int64}}) # time: 0.08693867
10-
@assert precompile(union, (HyperRectangle{3, Float32}, HyperRectangle{3, Float32}))
11-
@assert precompile(Tuple{typeof(decompose),Type{Point{2, Float32}},HyperRectangle{2, Float32}}) # time: 0.026609203
12-
@assert precompile(Tuple{Type{HyperRectangle{3, Float32}},HyperRectangle{2, Float32}}) # time: 0.023717888
13-
@assert precompile(Tuple{typeof(+),HyperRectangle{3, Float32},Point{3, Float32}}) # time: 0.006633118
14-
@assert precompile(Tuple{Type{Rect2D{T} where T},Float32,Float32,Float32,Float32}) # time: 0.001636267
15-
@assert precompile(Tuple{typeof(*),HyperRectangle{2, Float32},Float32}) # time: 0.001057589
14+
@warnpcfail precompile(HyperRectangle{2,Float32}, (Int, Int, Int, Int))
15+
@warnpcfail precompile(==, (HyperRectangle{2,Float32}, HyperRectangle{2,Float32}))
16+
@warnpcfail precompile(normal_mesh, (Tesselation{3,Float32,Cylinder{3,Float32},1},))
17+
@warnpcfail precompile(normal_mesh, (Tesselation{3,Float32,HyperSphere{3,Float32},1},))
18+
@warnpcfail precompile(normal_mesh, (HyperSphere{3,Float32},))
19+
@warnpcfail precompile(Tuple{typeof(*),SMatrix{4, 4, Float32, 16},HyperRectangle{3, Float32}}) # time: 0.11091917
20+
@warnpcfail precompile(Tuple{typeof(coordinates),HyperRectangle{2, Float32},Tuple{Int64, Int64}}) # time: 0.08693867
21+
@warnpcfail precompile(union, (HyperRectangle{3, Float32}, HyperRectangle{3, Float32}))
22+
@warnpcfail precompile(Tuple{typeof(decompose),Type{Point{2, Float32}},HyperRectangle{2, Float32}}) # time: 0.026609203
23+
@warnpcfail precompile(Tuple{Type{HyperRectangle{3, Float32}},HyperRectangle{2, Float32}}) # time: 0.023717888
24+
@warnpcfail precompile(Tuple{typeof(+),HyperRectangle{3, Float32},Point{3, Float32}}) # time: 0.006633118
25+
@warnpcfail precompile(Tuple{Type{Rect2D{T} where T},Float32,Float32,Float32,Float32}) # time: 0.001636267
26+
@warnpcfail precompile(Tuple{typeof(*),HyperRectangle{2, Float32},Float32}) # time: 0.001057589
1627

1728
if Base.VERSION >= v"1.6.0-DEV.1083"
18-
@assert precompile(triangle_mesh, (Polygon{2, Float32, Point2f0, LineString{2, Float32, Point2f0,
29+
@warnpcfail precompile(triangle_mesh, (Polygon{2, Float32, Point2f0, LineString{2, Float32, Point2f0,
1930
Base.ReinterpretArray{Line{2, Float32}, 1, Tuple{Point2f0, Point2f0}, TupleView{Tuple{Point2f0, Point2f0}, 2, 1, Vector{Point2f0}}, false}},
2031
Vector{LineString{2, Float32, Point2f0, Base.ReinterpretArray{Line{2, Float32}, 1, Tuple{Point2f0, Point2f0}, TupleView{Tuple{Point2f0, Point2f0}, 2, 1, Vector{Point2f0}}, false}}}},))
2132
else
22-
@assert precompile(triangle_mesh, (Polygon{2, Float32, Point2f0, LineString{2, Float32, Point2f0,
33+
@warnpcfail precompile(triangle_mesh, (Polygon{2, Float32, Point2f0, LineString{2, Float32, Point2f0,
2334
Base.ReinterpretArray{Line{2, Float32}, 1, Tuple{Point2f0, Point2f0}, TupleView{Tuple{Point2f0, Point2f0}, 2, 1, Vector{Point2f0}}}},
2435
Vector{LineString{2, Float32, Point2f0, Base.ReinterpretArray{Line{2, Float32}, 1, Tuple{Point2f0, Point2f0}, TupleView{Tuple{Point2f0, Point2f0}, 2, 1, Vector{Point2f0}}}}}},))
2536
end
2637

27-
@assert precompile(split_intersections, (Vector{Point2f0},))
38+
@warnpcfail precompile(split_intersections, (Vector{Point2f0},))
2839
end

0 commit comments

Comments
 (0)