diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2017-02-01 15:38:30 +0100 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2017-02-01 15:38:30 +0100 |
commit | be2192f295290c72d56e01263bc354f6844229ec (patch) | |
tree | 8a8cfe6527e738dd06ac1c294ee2936df6340a56 | |
parent | 8b178cf0b7e9dcc823ad164a6856032627b3bc6f (diff) | |
download | compcert-be2192f295290c72d56e01263bc354f6844229ec.tar.gz compcert-be2192f295290c72d56e01263bc354f6844229ec.zip |
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"
-rw-r--r-- | cparser/Elab.ml | 6 |
1 files changed, 4 insertions, 2 deletions
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? *) |