From 712f3cbae6bfd3c6f6cc40d44f438aa0affcd371 Mon Sep 17 00:00:00 2001 From: xleroy Date: Tue, 18 Dec 2012 07:54:35 +0000 Subject: 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 --- cparser/Ceval.ml | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'cparser/Ceval.ml') diff --git a/cparser/Ceval.ml b/cparser/Ceval.ml index 621fbbf7..5770e279 100644 --- a/cparser/Ceval.ml +++ b/cparser/Ceval.ml @@ -71,6 +71,7 @@ let constant = function let is_signed env ty = match unroll env ty with | TInt(ik, _) -> is_signed_ikind ik + | TEnum(_, _) -> is_signed_ikind enum_ikind | _ -> false let cast env ty_to ty_from v = @@ -87,6 +88,8 @@ let cast env ty_to ty_from v = I (normalize_int n ptr_t_ikind) | TPtr(ty, _), (S _ | WS _) -> v + | TEnum(_, _), I n -> + I (normalize_int n enum_ikind) | _, _ -> raise Notconst @@ -255,5 +258,6 @@ let constant_expr env ty e = | TPtr(_, _), I 0L -> Some(CInt(0L, IInt, "")) | TPtr(_, _), S s -> Some(CStr s) | TPtr(_, _), WS s -> Some(CWStr s) + | TEnum(_, _), I n -> Some(CInt(n, enum_ikind, "")) | _ -> None with Notconst -> None -- cgit