summaryrefslogtreecommitdiff
path: root/cparser/Transform.ml
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2011-05-12 09:41:09 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2011-05-12 09:41:09 +0000
commitfe8baff11737d3785ff51d20ace9ab31665cd295 (patch)
treeedbab0f933283d5ecf455a5f94150c4f09379c51 /cparser/Transform.ml
parent239cbd2ebab8814b11d7ef43c35a17ce56a7ba0b (diff)
cparser: support for attributes over struct and union.
cparser: added experimental emulation of packed structs (PackedStruct.ml) git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1650 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'cparser/Transform.ml')
-rw-r--r--cparser/Transform.ml23
1 files changed, 14 insertions, 9 deletions
diff --git a/cparser/Transform.ml b/cparser/Transform.ml
index 911d613..4fd83ae 100644
--- a/cparser/Transform.ml
+++ b/cparser/Transform.ml
@@ -45,8 +45,10 @@ let get_temps () =
let program
?(decl = fun env d -> d)
?(fundef = fun env fd -> fd)
- ?(composite = fun env su id fl -> fl)
+ ?(composite = fun env su id attr fl -> (attr, fl))
?(typedef = fun env id ty -> ty)
+ ?(enum = fun env id members -> members)
+ ?(pragma = fun env s -> s)
p =
let rec transf_globdecls env accu = function
@@ -59,16 +61,19 @@ let program
| Gfundef f ->
(Gfundef(fundef env f),
Env.add_ident env f.fd_name f.fd_storage (fundef_typ f))
- | Gcompositedecl(su, id) ->
- (Gcompositedecl(su, id),
- Env.add_composite env id (composite_info_decl env su))
- | Gcompositedef(su, id, fl) ->
- (Gcompositedef(su, id, composite env su id fl),
- Env.add_composite env id (composite_info_def env su fl))
+ | Gcompositedecl(su, id, attr) ->
+ (Gcompositedecl(su, id, attr),
+ Env.add_composite env id (composite_info_decl env su attr))
+ | Gcompositedef(su, id, attr, fl) ->
+ let (attr', fl') = composite env su id attr fl in
+ (Gcompositedef(su, id, attr', fl'),
+ Env.add_composite env id (composite_info_def env su attr fl))
| Gtypedef(id, ty) ->
(Gtypedef(id, typedef env id ty), Env.add_typedef env id ty)
- | Genumdef _ as gd -> (gd, env)
- | Gpragma _ as gd -> (gd, env)
+ | Genumdef(id, members) ->
+ (Genumdef(id, enum env id members), env)
+ | Gpragma s ->
+ (Gpragma(pragma env s), env)
in
transf_globdecls env' ({g with gdesc = desc'} :: accu) gl