diff options
-rw-r--r-- | ocamlbuild/configuration.ml | 2 | ||||
-rw-r--r-- | ocamlbuild/param_tags.ml | 16 | ||||
-rw-r--r-- | ocamlbuild/param_tags.mli | 2 |
3 files changed, 11 insertions, 9 deletions
diff --git a/ocamlbuild/configuration.ml b/ocamlbuild/configuration.ml index 2969444d3..551acae6d 100644 --- a/ocamlbuild/configuration.ml +++ b/ocamlbuild/configuration.ml @@ -19,7 +19,7 @@ open Lexers type t = Lexers.conf let acknowledge_config config = - let ack (tag, _loc) = Param_tags.acknowledge tag in + let ack (tag, loc) = Param_tags.acknowledge (Some loc) tag in List.iter (fun (_, config) -> List.iter ack config.plus_tags) config let cache = Hashtbl.create 107 diff --git a/ocamlbuild/param_tags.ml b/ocamlbuild/param_tags.ml index 2d4f4ae6c..1ccccc604 100644 --- a/ocamlbuild/param_tags.ml +++ b/ocamlbuild/param_tags.ml @@ -34,23 +34,25 @@ let declare name action = let parse tag = Lexers.tag_gen (Lexing.from_string tag) -let acknowledge tag = - acknowledged_tags := parse tag :: !acknowledged_tags +let acknowledge maybe_loc tag = + acknowledged_tags := (parse tag, maybe_loc) :: !acknowledged_tags -let really_acknowledge ?(quiet=false) (name, param) = +let really_acknowledge ?(quiet=false) ((name, param), maybe_loc) = match param with | None -> if Hashtbl.mem declared_tags name && not quiet then - Log.eprintf "Warning: tag %S expects a parameter" name + Log.eprintf "%aWarning: tag %S expects a parameter" + Loc.print_loc_option maybe_loc name | Some param -> let actions = List.rev (Hashtbl.find_all declared_tags name) in if actions = [] && not quiet then - Log.eprintf "Warning: tag %S does not expect a parameter, \ - but is used with parameter %S" name param; + Log.eprintf "%aWarning: tag %S does not expect a parameter, \ + but is used with parameter %S" + Loc.print_loc_option maybe_loc name param; List.iter (fun f -> f param) actions let partial_init ?quiet tags = - Tags.iter (fun tag -> really_acknowledge ?quiet (parse tag)) tags + Tags.iter (fun tag -> really_acknowledge ?quiet (parse tag, None)) tags let init () = List.iter really_acknowledge (My_std.List.ordered_unique !acknowledged_tags) diff --git a/ocamlbuild/param_tags.mli b/ocamlbuild/param_tags.mli index 3b978fa79..22c081256 100644 --- a/ocamlbuild/param_tags.mli +++ b/ocamlbuild/param_tags.mli @@ -22,7 +22,7 @@ if a tag of the form [name(param)] is [acknowledge]d. A given tag may be declared several times with different actions. All actions will be executed, in the order they were declared. *) -val acknowledge: string -> unit +val acknowledge: Loc.location option -> string -> unit (** Acknowledge a tag. If the tag is of the form [X(Y)], and have been declared using [declare], |