diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2006-10-23 09:28:45 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2006-10-23 09:28:45 +0000 |
commit | a543aeafeac6498d1baa085da478a4e9e27e3dc8 (patch) | |
tree | e7f35c14139af1364a47a7fc255d2c191932dd8c /caml | |
parent | ec553a83a01665b4f868a03b91f6fc9e5c69b642 (diff) | |
download | compcert-a543aeafeac6498d1baa085da478a4e9e27e3dc8.tar.gz compcert-a543aeafeac6498d1baa085da478a4e9e27e3dc8.zip |
Relaxation des contraintes sur les struct recursives
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@128 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'caml')
-rw-r--r-- | caml/Cil2Csyntax.ml | 22 | ||||
-rw-r--r-- | 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 |