aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/Cprint.ml
diff options
context:
space:
mode:
authorxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2012-12-18 07:54:35 +0000
committerxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2012-12-18 07:54:35 +0000
commit712f3cbae6bfd3c6f6cc40d44f438aa0affcd371 (patch)
tree913762a241b5f97b3ef4df086ba6adaeb2ff45c4 /cparser/Cprint.ml
parentc629161139899e43a2fe7c5af59ca926cdab370e (diff)
downloadcompcert-kvx-712f3cbae6bfd3c6f6cc40d44f438aa0affcd371.tar.gz
compcert-kvx-712f3cbae6bfd3c6f6cc40d44f438aa0affcd371.zip
Support for inline assembly (asm statements).
cparser: add primitive support for enum types. bitfield emulation: for bitfields with enum type, choose signed/unsigned as appropriate git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2074 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'cparser/Cprint.ml')
-rw-r--r--cparser/Cprint.ml12
1 files changed, 8 insertions, 4 deletions
diff --git a/cparser/Cprint.ml b/cparser/Cprint.ml
index 2548f3b9..e97f0411 100644
--- a/cparser/Cprint.ml
+++ b/cparser/Cprint.ml
@@ -172,6 +172,8 @@ let rec dcl pp ty n =
fprintf pp "struct %a%a%t" ident id attributes a n
| TUnion(id, a) ->
fprintf pp "union %a%a%t" ident id attributes a n
+ | TEnum(id, a) ->
+ fprintf pp "enum %a%a%t" ident id attributes a n
let typ pp ty =
dcl pp ty (fun _ -> ())
@@ -424,6 +426,8 @@ let rec stmt pp s =
fprintf pp "@[<v 2>{@ %a@;<0 -2>}@]" stmt_block s
| Sdecl d ->
full_decl pp d
+ | Sasm txt ->
+ fprintf pp "asm(%a);" const (CStr txt)
and slabel pp = function
| Slabel s ->
@@ -486,17 +490,17 @@ let globdecl pp g =
fprintf pp "@;<0 -2>};@]@ @ "
| Gtypedef(id, ty) ->
fprintf pp "@[<hov 2>typedef %a;@]@ @ " simple_decl (id, ty)
- | Genumdef(id, fields) ->
- fprintf pp "@[<v 2>enum %a {" ident id;
+ | Genumdef(id, attrs, vals) ->
+ fprintf pp "@[<v 2>enum%a %a {" attributes attrs ident id;
List.iter
- (fun (name, opt_e) ->
+ (fun (name, v, opt_e) ->
fprintf pp "@ %a" ident name;
begin match opt_e with
| None -> ()
| Some e -> fprintf pp " = %a" exp (0, e)
end;
fprintf pp ",")
- fields;
+ vals;
fprintf pp "@;<0 -2>};@]@ @ "
| Gpragma s ->
fprintf pp "#pragma %s@ @ " s