From 7f6bd2f39e66cb0704b526d0450845cd0234e0c9 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Tue, 21 Aug 2018 10:41:14 +0200 Subject: 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. --- cparser/Cutil.ml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'cparser/Cutil.ml') 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? *) -- cgit