From cdc9b14a4480c9180450bec36e5b7ad076402391 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Pasteur?= Date: Fri, 16 Jul 2010 12:38:45 +0200 Subject: [PATCH] Fixed problem with multidimensional arrays in args --- compiler/obc/c/c.ml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/compiler/obc/c/c.ml b/compiler/obc/c/c.ml index 5b0a421..2843669 100644 --- a/compiler/obc/c/c.ml +++ b/compiler/obc/c/c.ml @@ -161,6 +161,11 @@ let rec pp_array_decl cty = ty, sprintf "%s[%d]" s n | _ -> cty, "" +let rec pp_param_cty fmt = function + | Cty_arr(n, cty') -> + fprintf fmt "%a*" pp_param_cty cty' + | cty -> pp_cty fmt cty + (* pp_vardecl, featuring an ugly hack coping with C's inconsistent concrete syntax! *) let rec pp_vardecl fmt (s, cty) = match cty with @@ -169,7 +174,7 @@ let rec pp_vardecl fmt (s, cty) = match cty with fprintf fmt "%a %s%s" pp_cty ty s indices | _ -> fprintf fmt "%a %s" pp_cty cty s and pp_paramdecl fmt (s, cty) = match cty with - | Cty_arr (n, cty') -> fprintf fmt "%a* %s" pp_cty cty' s + | Cty_arr (n, cty') -> fprintf fmt "%a* %s" pp_param_cty cty' s | _ -> pp_vardecl fmt (s, cty) and pp_param_list fmt l = pp_list1 pp_paramdecl "," fmt l and pp_var_list fmt l = pp_list pp_vardecl ";" fmt l