File tree Expand file tree Collapse file tree 3 files changed +8
-7
lines changed Expand file tree Collapse file tree 3 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -54,9 +54,9 @@ let is_opaque_attribute =
54
54
[ [" opaque" ; " ocaml.opaque" ], true ]
55
55
56
56
57
- let find_attribute p attributes =
57
+ let find_attribute ? mark_used p attributes =
58
58
let inline_attribute =
59
- Builtin_attributes. filter_attributes
59
+ Builtin_attributes. filter_attributes ?mark:mark_used
60
60
(Builtin_attributes.Attributes_filter. create p)
61
61
attributes
62
62
in
@@ -461,9 +461,9 @@ let add_local_attribute expr loc attributes =
461
461
end
462
462
| _ -> expr
463
463
464
- let assume_zero_alloc attributes =
464
+ let assume_zero_alloc ? mark_used attributes =
465
465
let p = Zero_alloc in
466
- let attr = find_attribute (is_property_attribute p) attributes in
466
+ let attr = find_attribute ?mark_used (is_property_attribute p) attributes in
467
467
match parse_property_attribute attr p with
468
468
| Default_check -> false
469
469
| Ignore_assert_all _ -> false
@@ -478,7 +478,7 @@ let get_assume_zero_alloc ~with_warnings attributes =
478
478
that affect [Scoped_location] settings before translation
479
479
of expressions in that scope.
480
480
Warnings will be produced by [add_check_attribute]. *)
481
- Warnings. without_warnings (fun () -> assume_zero_alloc attributes)
481
+ Warnings. without_warnings (fun () -> assume_zero_alloc ~mark_used: false attributes)
482
482
483
483
let add_check_attribute expr loc attributes =
484
484
let to_string = function
Original file line number Diff line number Diff line change @@ -435,11 +435,11 @@ module Attributes_filter = struct
435
435
let create (t : t ) = t
436
436
end
437
437
438
- let filter_attributes (nms_and_conds : Attributes_filter.t ) attrs =
438
+ let filter_attributes ?( mark = true ) (nms_and_conds : Attributes_filter.t ) attrs =
439
439
List. filter (fun a ->
440
440
List. exists (fun (nms , cond ) ->
441
441
if List. mem a.attr_name.txt nms
442
- then (mark_used a.attr_name; cond)
442
+ then (if mark then mark_used a.attr_name; cond)
443
443
else false )
444
444
nms_and_conds
445
445
) attrs
Original file line number Diff line number Diff line change 159
159
count as misplaced if the compiler could use it in some configuration.
160
160
*)
161
161
val filter_attributes :
162
+ ?mark : bool ->
162
163
Attributes_filter .t -> Parsetree .attributes -> Parsetree .attributes
163
164
164
165
val warn_on_literal_pattern : Parsetree .attributes -> bool
You can’t perform that action at this time.
0 commit comments