From be2192f295290c72d56e01263bc354f6844229ec Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Wed, 1 Feb 2017 15:38:30 +0100 Subject: Regression: type attributes and array modifiers Owing to the peculiarities of array types in Cutil.change_attributes_type, type-related attributes of the array element type were duplicated on the array type. E.g. elaborating 'const int a[10][5]' produced "a is an array of 5 const arrays of 10 const ints" instead of "a is an array of 5 arrays of 10 const ints" --- cparser/Elab.ml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'cparser/Elab.ml') diff --git a/cparser/Elab.ml b/cparser/Elab.ml index 951ae5b3..cc66f04b 100644 --- a/cparser/Elab.ml +++ b/cparser/Elab.ml @@ -481,8 +481,10 @@ let typespec_order t1 t2 = compare (typespec_rank t1) (typespec_rank t2) attributes from the given type and return those attributes separately. *) let get_nontype_attrs env ty = - let (ta, nta) = List.partition attr_is_type_related (attributes_of_type env ty) in - (change_attributes_type env (fun _ -> ta) ty, nta) + let nta = + List.filter (fun a -> not (attr_is_type_related a)) + (attributes_of_type env ty) in + (remove_attributes_type env nta ty, nta) (* Is a specifier an anonymous struct/union in the sense of ISO C2011? *) -- cgit