aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/Cutil.ml
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2018-08-21 10:41:14 +0200
committerXavier Leroy <xavierleroy@users.noreply.github.com>2018-08-24 09:26:50 +0200
commit7f6bd2f39e66cb0704b526d0450845cd0234e0c9 (patch)
tree90221bfb1ca892dc01b40d566cbd5c06049801ea /cparser/Cutil.ml
parentb6542ff823fb431b6f22724da5ab5cbbdfe01598 (diff)
downloadcompcert-kvx-7f6bd2f39e66cb0704b526d0450845cd0234e0c9.tar.gz
compcert-kvx-7f6bd2f39e66cb0704b526d0450845cd0234e0c9.zip
Reimplement attr_array_applicable in terms of class_of_attribute
Since commit 5963ac4, "aligned" attributes and _Alignas qualifiers are represented differently, causing them to be treated differently by the previous implementation of Cutil.attr_array_applicable. This is incorrect and inconsistent with what happens during elaboration of array types in Elab. This PR reimplements attr_array_applicable in terms of class_of_attribute. Just like during elaboration, attributes of the Attr_type class are applied to the type of array elements, other attributes stay attached to the array type.
Diffstat (limited to 'cparser/Cutil.ml')
-rw-r--r--cparser/Cutil.ml5
1 files changed, 2 insertions, 3 deletions
diff --git a/cparser/Cutil.ml b/cparser/Cutil.ml
index 8b6d5e32..4b69c95e 100644
--- a/cparser/Cutil.ml
+++ b/cparser/Cutil.ml
@@ -124,9 +124,8 @@ let attr_is_standard = function
(* Is an attribute applicable to a whole array (true) or only to
array elements (false)? *)
-let attr_array_applicable = function
- | AConst | AVolatile | ARestrict | AAlignas _ -> false
- | Attr _ -> true
+let attr_array_applicable a =
+ class_of_attribute a <> Attr_type
(* Is an attribute of a composite type applicable to members of this type
when they are accessed? *)