Commit 592692b6 authored by POTTIER Francois's avatar POTTIER Francois

Modified [warning] to directly accept a format.

parent c80aabac
......@@ -62,10 +62,9 @@ include WarningStore(struct end)
let datacon_opacity_warning (cd : constructor_declaration) : unit =
if opacity cd.pcd_attributes = Opaque then
warning cd.pcd_loc
(sprintf
"%s: @opaque, attached to a data constructor, is ignored.\n\
It should be attached to a type. Please use parentheses."
plugin)
"%s: @opaque, attached to a data constructor, is ignored.\n\
It should be attached to a type. Please use parentheses."
plugin
(* -------------------------------------------------------------------------- *)
......
......@@ -572,8 +572,8 @@ end
module WarningStore (X : sig end) : sig
(* [warning loc msg] emits a warning. *)
val warning: loc -> string -> unit
(* [warning loc format ...] emits a warning. *)
val warning: loc -> ('a, unit, string, unit) format4 -> 'a
(* [warnings()] returns a list of all warnings emitted so far. *)
val warnings: unit -> structure
......@@ -586,6 +586,9 @@ end = struct
let warning loc msg =
warnings := Ast_mapper.attribute_of_warning loc msg :: !warnings
let warning loc format =
Printf.ksprintf (warning loc) format
let warnings () =
let ws = !warnings in
warnings := [];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment