#5527: use absolute filenames in the message for Warning 31, when requested (-absname).

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12198 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Alain Frisch 2012-03-07 17:27:59 +00:00
parent 515ab27fe3
commit 1be1d4e834
5 changed files with 9 additions and 2 deletions

Binary file not shown.

Binary file not shown.

View File

@ -177,7 +177,7 @@ let check_consistency ppf file_name cu =
begin try
let source = List.assoc cu.cu_name !implementations_defined in
Location.print_warning (Location.in_file file_name) ppf
(Warnings.Multiple_definition(cu.cu_name, file_name, source))
(Warnings.Multiple_definition(cu.cu_name, Location.show_filename file_name, Location.show_filename source))
with Not_found -> ()
end;
implementations_defined :=

View File

@ -214,8 +214,11 @@ let absolute_path s = (* This function could go into Filename *)
in
aux s
let show_filename file =
if !absname then absolute_path file else file
let print_filename ppf file =
Format.fprintf ppf "%s" (if !absname then absolute_path file else file)
Format.fprintf ppf "%s" (show_filename file)
let reset () =
num_loc_lines := 0

View File

@ -60,5 +60,9 @@ val highlight_locations: formatter -> t -> t -> bool
val print: formatter -> t -> unit
val print_filename: formatter -> string -> unit
val show_filename: string -> string
(** In -absname mode, return the absolute path for this filename.
Otherwise, returns the filename unchanged. *)
val absname: bool ref