From a543aeafeac6498d1baa085da478a4e9e27e3dc8 Mon Sep 17 00:00:00 2001 From: xleroy Date: Mon, 23 Oct 2006 09:28:45 +0000 Subject: Relaxation des contraintes sur les struct recursives git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@128 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- caml/Cil2Csyntax.ml | 22 +++++++++------------- caml/PrintCsyntax.ml | 2 +- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/caml/Cil2Csyntax.ml b/caml/Cil2Csyntax.ml index 5fc31820..553229c6 100644 --- a/caml/Cil2Csyntax.ml +++ b/caml/Cil2Csyntax.ml @@ -454,19 +454,15 @@ and convertTypGen env = function end | TNamed (tinfo, _) -> convertTypGen env tinfo.ttype | TComp (c, _) -> - if List.mem c.ckey env then - unsupported "ill-formed recursive structure or union" - else begin - let rec convertFieldList = function - | [] -> Fnil - | {fname=str; ftype=t} :: rem -> - let idf = intern_string str in - let t' = convertTypGen (c.ckey :: env) t in - Fcons(idf, t', convertFieldList rem) in - let fList = convertFieldList c.cfields in - let id = intern_string (Cil.compFullName c) in - if c.cstruct then Tstruct(id, fList) else Tunion(id, fList) - end + let rec convertFieldList = function + | [] -> Fnil + | {fname=str; ftype=t} :: rem -> + let idf = intern_string str in + let t' = convertTypGen (c.ckey :: env) t in + Fcons(idf, t', convertFieldList rem) in + let fList = convertFieldList c.cfields in + let id = intern_string (Cil.compFullName c) in + if c.cstruct then Tstruct(id, fList) else Tunion(id, fList) | TEnum _ -> constInt32 (* enum constants are integers *) | TBuiltin_va_list _ -> unsupported "GCC `builtin va_list' type" diff --git a/caml/PrintCsyntax.ml b/caml/PrintCsyntax.ml index 052581cd..f9abd9a2 100644 --- a/caml/PrintCsyntax.ml +++ b/caml/PrintCsyntax.ml @@ -49,7 +49,7 @@ let name_floattype sz = module StructUnionSet = Set.Make(struct type t = string * fieldlist - let compare = (compare: t -> t -> int) + let compare (n1, _ : t) (n2, _ : t) = compare n1 n2 end) let struct_unions = ref StructUnionSet.empty -- cgit