diff --git a/compiler/obc/c/c.ml b/compiler/obc/c/c.ml index 40b699a..1b5d884 100644 --- a/compiler/obc/c/c.ml +++ b/compiler/obc/c/c.ml @@ -149,12 +149,12 @@ and cfile_desc = elements of the list [l] via the function [f], separated by [sep] strings and breakable spaces. *) let rec pp_list1 f sep fmt l = match l with - | [] -> fprintf fmt "" + | [] -> () | [x] -> fprintf fmt "%a" f x | h :: t -> fprintf fmt "%a%s@ %a" f h sep (pp_list1 f sep) t let rec pp_list f sep fmt l = match l with - | [] -> fprintf fmt "" + | [] -> () | h :: t -> fprintf fmt "@ %a%s%a" f h sep (pp_list f sep) t let pp_string fmt s = @@ -229,7 +229,9 @@ and pp_cstm fmt stm = match stm with fprintf fmt "@[@[if (%a) {%a@]@ @[} else {%a@]@ }@]" pp_cexpr c pp_cstm_list t pp_cstm_list e | Cfor(x, lower, upper, e) -> - fprintf fmt "@[@[for (int %a = %a; %a < %a; ++%a) {%a@]@ }@]" + fprintf fmt + "@[@[{@\nint %a;@\n@[for (%a = %a; %a < %a; ++%a) {%a@]@ }@]@\n}@]" + pp_string x pp_string x pp_cexpr lower pp_string x pp_cexpr upper pp_string x pp_cstm_list e | Cwhile (e, b) ->