From b6542ff823fb431b6f22724da5ab5cbbdfe01598 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Fri, 17 Aug 2018 15:42:23 +0200 Subject: Preserve attribute(("aligned")) in the AST, don't map it to _Alignas We used to recognize attribute(("aligned"(N))) and map it to _Alignas(N) during elaboration. However, we want to restrict the places where _Alignas can occur, as standardized in ISO C11, while leaving more freedom for the placement of the "aligned" attribute. As a first step in this direction, this commit keeps the "aligned" attribute unchanged in the AST, and distinct from _Alignas attributes. Both attributes are honored when it comes to determining the actual alignment of a type. --- cparser/Cutil.ml | 2 ++ 1 file changed, 2 insertions(+) (limited to 'cparser/Cutil.ml') diff --git a/cparser/Cutil.ml b/cparser/Cutil.ml index 1c9f747e..8b6d5e32 100644 --- a/cparser/Cutil.ml +++ b/cparser/Cutil.ml @@ -264,6 +264,8 @@ let alignas_attribute al = let rec alignas_attr accu = function | [] -> accu | AAlignas n :: al -> alignas_attr (max n accu) al + | Attr(("aligned" | "__aligned__"), [AInt n]) :: al -> + alignas_attr (max (Int64.to_int n) accu) al | a :: al -> alignas_attr accu al in alignas_attr 0 al -- cgit