diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2014-04-23 09:18:51 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2014-04-23 09:18:51 +0000 |
commit | 2f643e4419e8237c63d6823720da8100da9c8b11 (patch) | |
tree | 8a243fe800541597beffe8fec152f20d6bada549 /cparser/Cutil.ml | |
parent | 214ab56c02860a9c472f701b601cbf6c9cf5fd69 (diff) | |
download | compcert-kvx-2f643e4419e8237c63d6823720da8100da9c8b11.tar.gz compcert-kvx-2f643e4419e8237c63d6823720da8100da9c8b11.zip |
Clean-up pass on C types:
- Ctypes: add useful functions on attributes; remove attrs in typeconv
(because attributes are meaningless on r-values)
- C2C: fixed missing or redundant Evalof
- Cop: ignore attributes in ptr + int and ptr - int (meaningless on r-values);
add sanity check between typeconv/classify_binarith and the C99 standard.
- cparser: fixed several cases where incorrect type annotations were put
on expressions.
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2457 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'cparser/Cutil.ml')
-rw-r--r-- | cparser/Cutil.ml | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/cparser/Cutil.ml b/cparser/Cutil.ml index 22ef187a..11693468 100644 --- a/cparser/Cutil.ml +++ b/cparser/Cutil.ml @@ -92,6 +92,13 @@ let attr_array_applicable = function | AConst | AVolatile | ARestrict | AAlignas _ -> false | Attr _ -> true +(* Is an attribute of a composite type applicable to members of this type + when they are accessed? *) + +let attr_inherited_by_members = function + | AConst | AVolatile | ARestrict -> true + | AAlignas _ | Attr _ -> false + (* Adding top-level attributes to a type. Doesn't need to unroll defns. *) (* For array types, standard attrs are pushed to the element type. *) @@ -574,17 +581,20 @@ let unary_conversion env t = | TInt(kind, attr) -> begin match kind with | IBool | IChar | ISChar | IUChar | IShort | IUShort -> - TInt(IInt, attr) + TInt(IInt, []) | IInt | IUInt | ILong | IULong | ILongLong | IULongLong -> - TInt(kind, attr) + TInt(kind, []) end (* Enums are like signed ints *) - | TEnum(id, attr) -> TInt(enum_ikind, attr) + | TEnum(id, attr) -> TInt(enum_ikind, []) (* Arrays and functions decay automatically to pointers *) | TArray(ty, _, _) -> TPtr(ty, []) | TFun _ as ty -> TPtr(ty, []) - (* Other types are not changed *) - | t -> t + (* Float types and pointer types lose their attributes *) + | TFloat(kind, attr) -> TFloat(kind, []) + | TPtr(ty, attr) -> TPtr(ty, []) + (* Other types should not occur, but in doubt... *) + | _ -> t (* The usual binary conversions (H&S 6.3.4). Applies only to arithmetic types. |