diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2014-08-21 13:23:30 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2014-08-21 13:23:30 +0000 |
commit | c46b574d5b21fb2728c76c5cab1c46890c0fb1cd (patch) | |
tree | 0ae850f934ef634eaa6cda9c294f0bdd055cb1c1 /cparser/Rename.ml | |
parent | e499b023510259cc96be2093784b08cf090941d2 (diff) | |
download | compcert-c46b574d5b21fb2728c76c5cab1c46890c0fb1cd.tar.gz compcert-c46b574d5b21fb2728c76c5cab1c46890c0fb1cd.zip |
Support C99 compound literals (by expansion in Unblock pass).
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2615 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'cparser/Rename.ml')
-rw-r--r-- | cparser/Rename.ml | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/cparser/Rename.ml b/cparser/Rename.ml index f4bab8ea..2b7ec2ca 100644 --- a/cparser/Rename.ml +++ b/cparser/Rename.ml @@ -105,6 +105,11 @@ and param env (id, ty) = else let (id', env') = rename env id in ((id', typ env' ty), env') +let field env f = + { fld_name = f.fld_name; + fld_typ = typ env f.fld_typ; + fld_bitfield = f.fld_bitfield } + let constant env = function | CEnum(id, v) -> CEnum(ident env id, v) | cst -> cst @@ -121,18 +126,10 @@ and exp_desc env = function | EBinop(op, a, b, ty) -> EBinop(op, exp env a, exp env b, typ env ty) | EConditional(a, b, c) -> EConditional(exp env a, exp env b, exp env c) | ECast(ty, a) -> ECast(typ env ty, exp env a) + | ECompound(ty, ie) -> ECompound(typ env ty, init env ie) | ECall(a, al) -> ECall(exp env a, List.map (exp env) al) -let optexp env = function - | None -> None - | Some a -> Some (exp env a) - -let field env f = - { fld_name = f.fld_name; - fld_typ = typ env f.fld_typ; - fld_bitfield = f.fld_bitfield } - -let rec init env = function +and init env = function | Init_single e -> Init_single(exp env e) | Init_array il -> Init_array (List.map (init env) il) | Init_struct(id, il) -> @@ -141,6 +138,10 @@ let rec init env = function | Init_union(id, f, i) -> Init_union(ident env id, field env f, init env i) +let optexp env = function + | None -> None + | Some a -> Some (exp env a) + let decl env (sto, id, ty, int) = let (id', env') = rename env id in ((sto, |