From 9d32d891087bde292ec53783f9c9a8d95fd87add Mon Sep 17 00:00:00 2001 From: Alain Frisch Date: Fri, 29 Jun 2012 09:49:52 +0000 Subject: [PATCH] Better error report. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12654 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02 --- experimental/frisch/ifdef.ml | 6 ++++-- experimental/frisch/test_ifdef.ml | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/experimental/frisch/ifdef.ml b/experimental/frisch/ifdef.ml index 166736032..78278f71e 100644 --- a/experimental/frisch/ifdef.ml +++ b/experimental/frisch/ifdef.ml @@ -27,8 +27,10 @@ let ifdef = else this # module_expr body_not_def - | {pmod_desc = Pmod_ident {txt = Lident "IFDEF"}} -> - failwith "Improper use of IFDEF" (* todo: location *) + | {pmod_desc = Pmod_ident {txt = Lident "IFDEF"}; pmod_loc = loc} -> + Format.printf "%a@.Improper use of IFDEF. The correct form is: IFDEF()()()@." + Location.print_loc loc; + exit 2 | x -> super # module_expr x end diff --git a/experimental/frisch/test_ifdef.ml b/experimental/frisch/test_ifdef.ml index 77fe01568..18fdaf87a 100644 --- a/experimental/frisch/test_ifdef.ml +++ b/experimental/frisch/test_ifdef.ml @@ -1,5 +1,7 @@ include IFDEF(XHOME)(struct let () = print_endline "Defined!" -end)(struct +end) +(*(struct let () = print_endline "Not defined!" end) +*)