Skip to content

Commit 4d15510

Browse files
author
Damien Doligez
committed
6893: "tag not used" warning when using (p)dep to declare linking tags
git-svn-id: http://caml.inria.fr/svn/ocaml/version/4.02@16162 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
1 parent 0e515bc commit 4d15510

File tree

5 files changed

+20
-5
lines changed

5 files changed

+20
-5
lines changed

Changes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,8 @@ Bug fixes:
208208
(Jacques Garrigue, report by Valentin Gatien-Baron)
209209
- PR#6889: ast_mapper fails to rewrite class attributes
210210
(Sébastien Briais)
211+
- PR#6893: ocamlbuild: "tag not used" warning when using (p)dep
212+
(Gabriel Scherer, report by Christiano Haesbaert)
211213
- GPR#143: fix getsockopt behaviour for boolean socket options
212214
(Anil Madhavapeddy and Andrew Ray)
213215
- GPR#190: typo in pervasives

ocamlbuild/command.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,9 @@ let pdep tags ptag deps =
393393
Param_tags.declare ptag
394394
(fun param -> dep (Param_tags.make ptag param :: tags) (deps param))
395395

396+
let list_all_deps () =
397+
!all_deps_of_tags
398+
396399
(*
397400
let to_string_for_digest x =
398401
let rec cmd_of_spec =

ocamlbuild/command.mli

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,6 @@ val dep : Tags.elt list -> pathname list -> unit
4646

4747
val pdep : Tags.elt list -> Tags.elt -> (string -> pathname list) -> unit
4848

49+
val list_all_deps : unit -> (Tags.t * pathname list) list
50+
4951
val file_or_exe_exists: string -> bool

ocamlbuild/configuration.ml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,11 @@ let tag_any tags =
8181
let check_tags_usage useful_tags =
8282
let check_tag (tag, loc) =
8383
if not (Tags.mem tag useful_tags) then
84-
Log.eprintf "%aWarning: the tag %S is not used in any flag declaration, \
85-
so it will have no effect; it may be a typo. Otherwise use \
86-
`mark_tag_used` in your myocamlbuild.ml to disable \
87-
this warning."
84+
85+
Log.eprintf "%aWarning: the tag %S is not used in any flag or dependency \
86+
declaration, so it will have no effect; it may be a typo. \
87+
Otherwise you can use `mark_tag_used` in your myocamlbuild.ml \
88+
to disable this warning."
8889
Loc.print_loc loc tag
8990
in
9091
let check_conf (_, values) =

ocamlbuild/main.ml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,14 @@ let proceed () =
205205
raise Exit_silently
206206
end;
207207

208-
let all_tags = Tags.union builtin_useful_tags (Flags.get_used_tags ()) in
208+
let all_tags =
209+
let builtin = builtin_useful_tags in
210+
let used_in_flags = Flags.get_used_tags () in
211+
let used_in_deps =
212+
List.fold_left (fun acc (tags, _deps) -> Tags.union acc tags)
213+
Tags.empty (Command.list_all_deps ())
214+
in
215+
Tags.union builtin (Tags.union used_in_flags used_in_deps) in
209216
Configuration.check_tags_usage all_tags;
210217

211218
Digest_cache.init ();

0 commit comments

Comments
 (0)