diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2012-12-18 07:54:35 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2012-12-18 07:54:35 +0000 |
commit | 712f3cbae6bfd3c6f6cc40d44f438aa0affcd371 (patch) | |
tree | 913762a241b5f97b3ef4df086ba6adaeb2ff45c4 /cparser/Ceval.ml | |
parent | c629161139899e43a2fe7c5af59ca926cdab370e (diff) |
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/Ceval.ml')
-rw-r--r-- | cparser/Ceval.ml | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/cparser/Ceval.ml b/cparser/Ceval.ml index 621fbbf..5770e27 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 |