Skip to content

Commit

Permalink
Added Ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
bergel committed Feb 29, 2024
1 parent 39210dc commit e7cfa78
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/linting/extended_checks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -169,5 +169,4 @@ function check(::Future_Extension, x::EXPR)
end

check(::Wait_Extension, x::EXPR) = generic_check(x, "wait(hole_variable)")

check(::Ptr_Extension, x::EXPR) = generic_check(x, "Ptr{hole_variable}(hole_variable)")
6 changes: 5 additions & 1 deletion test/rai_rules_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ end
"Line 18, column 5: `wait` should be used with extreme caution.")
end

@testset "fetch, @inbounds, Atomic" begin
@testset "fetch, @inbounds, Atomic, Ptr" begin
source = """
function f()
fut = Future{Any}()
Expand All @@ -434,6 +434,8 @@ end
num_created1 = Threads.Atomic{Int}(0);
num_created2 = Atomic{Int}(0);
num_created3 = Atomic(0);
pointer(page) == Ptr{Nothing}(0) && return
end
"""

Expand All @@ -443,6 +445,8 @@ end
@test lint_test(source, "Line 15, column 20: `Atomic` should be used with extreme caution.")
@test lint_test(source, "Line 16, column 20: `Atomic` should be used with extreme caution.")
@test lint_test(source, "Line 17, column 20: `Atomic` should be used with extreme caution.")

@test lint_test(source, "Line 19, column 22: `Ptr` should be used with extreme caution.")
end
end

Expand Down

0 comments on commit e7cfa78

Please sign in to comment.