aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/Cutil.mli
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2015-01-01 11:08:12 +0100
committerXavier Leroy <xavier.leroy@inria.fr>2015-01-01 11:08:12 +0100
commit442e3140f4a2172bbc1ee7ce260eb1a8fd79ae95 (patch)
tree9dc3613e16330410d361b43cc4f68b1a042c2012 /cparser/Cutil.mli
parent1379deed055fc6b1462915a0177e75f4f9a127eb (diff)
downloadcompcert-kvx-442e3140f4a2172bbc1ee7ce260eb1a8fd79ae95.tar.gz
compcert-kvx-442e3140f4a2172bbc1ee7ce260eb1a8fd79ae95.zip
Revised type compatibility check w.r.t. handling of attributes.
We now distinguish 3 modes (instead of 2 previously) for attributes: 1- strict compatibility, 2- ignore top-level attrs, 3- ignore all attrs recursively. In strict mode, const/volatile/restrict attributes must be identical, but nonstandard attributes may vary. Also: ignore top-level attrs when comparing function argument types, like GCC/Clang do. Net result is fewer warnings and type-checking that is closer to GCC/Clang.
Diffstat (limited to 'cparser/Cutil.mli')
-rw-r--r--cparser/Cutil.mli24
1 files changed, 20 insertions, 4 deletions
diff --git a/cparser/Cutil.mli b/cparser/Cutil.mli
index 309981be..53bcfcea 100644
--- a/cparser/Cutil.mli
+++ b/cparser/Cutil.mli
@@ -58,12 +58,28 @@ val attr_inherited_by_members: attribute -> bool
(* Is an attribute of a composite inherited by members of the composite? *)
(* Type compatibility *)
-val compatible_types : ?noattrs: bool -> Env.t -> typ -> typ -> bool
+
+type attr_handling =
+ | AttrCompat
+ | AttrIgnoreTop
+ | AttrIgnoreAll
+
+val compatible_types : attr_handling -> Env.t -> typ -> typ -> bool
(* Check that the two given types are compatible.
- If [noattrs], ignore attributes (recursively). *)
-val combine_types : ?noattrs: bool -> Env.t -> typ -> typ -> typ option
+ The attributes in the types are compared according to the first argument:
+- [AttrCompat]: the types must have the same standard attributes
+ ([const], [volatile], [restrict]) but may differ on custom attributes.
+- [AttrIgnoreTop]: the top-level attributes of the two types are ignored,
+ but attributes of e.g. types of pointed objects (for pointer types)
+ are compared as per [AttrCompat].
+- [AttrIgnoreAll]: recursively ignore the attributes in the two types. *)
+val combine_types : attr_handling -> Env.t -> typ -> typ -> typ option
(* Like [compatible_types], but if the two types are compatible,
- return the most precise type compatible with both. *)
+ return the most precise type compatible with both.
+ The attributes are compared according to the first argument,
+ with the same meaning as for [compatible_types].
+ When two sets of attributes are compatible, the result of
+ [combine_types] carries the union of these two sets of attributes. *)
(* Size and alignment *)