From ed4dc23a50557da6eecbc29ce4cd116e35f3de6e Mon Sep 17 00:00:00 2001 From: xleroy Date: Mon, 8 Apr 2013 17:36:13 +0000 Subject: List.iteri not in OCaml < 4.00, better not use it. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2182 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- exportclight/ExportClight.ml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/exportclight/ExportClight.ml b/exportclight/ExportClight.ml index 1a8afa4..ef00512 100644 --- a/exportclight/ExportClight.ml +++ b/exportclight/ExportClight.ml @@ -449,6 +449,13 @@ let re_annot_param = Str.regexp "%%\\|%[1-9][0-9]*" type fragment = Text of string | Param of int +(* For compatibility with OCaml < 4.00 *) +let list_iteri f l = + let rec iteri i = function + | [] -> () + | a::l -> f i a; iteri (i + 1) l + in iteri 0 l + let print_assertion p (txt, targs) = let frags = List.map @@ -464,14 +471,14 @@ let print_assertion p (txt, targs) = | Param n -> max_param := max n !max_param) frags; fprintf p " | %ld%%positive, " (P.to_int32 txt); - List.iteri + list_iteri (fun i targ -> match targ with | AA_arg _ -> fprintf p "_x%d :: " (i + 1) | _ -> ()) targs; fprintf p "nil =>@ "; - List.iteri + list_iteri (fun i targ -> match targ with | AA_arg _ -> () -- cgit v1.2.3