From 12696ae9f6c34aaffc668711d96beda51a783832 Mon Sep 17 00:00:00 2001 From: xleroy Date: Thu, 14 Apr 2011 09:15:17 +0000 Subject: Revised handling of GCC attributes. Preliminary, untested support for __aligned__ attribute git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1634 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- cparser/Cutil.ml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'cparser/Cutil.ml') diff --git a/cparser/Cutil.ml b/cparser/Cutil.ml index bb540c7..7aac659 100644 --- a/cparser/Cutil.ml +++ b/cparser/Cutil.ml @@ -63,6 +63,14 @@ let rec incl_attributes (al1: attributes) (al2: attributes) = else if a1 > a2 then incl_attributes al1 al2' else incl_attributes al1' al2' +let rec find_custom_attributes (names: string list) (al: attributes) = + match al with + | [] -> [] + | Attr(name, args) :: tl when List.mem name names -> + args :: find_custom_attributes names tl + | _ :: tl -> + find_custom_attributes names tl + (* Adding top-level attributes to a type. Doesn't need to unroll defns. *) (* Array types cannot carry attributes, so add them to the element type. *) @@ -96,7 +104,7 @@ let rec attributes_of_type env t = | TInt(ik, a) -> a | TFloat(fk, a) -> a | TPtr(ty, a) -> a - | TArray(ty, sz, a) -> a (* correct? *) + | TArray(ty, sz, a) -> add_attributes a (attributes_of_type env ty) | TFun(ty, params, vararg, a) -> a | TNamed(s, a) -> attributes_of_type env (unroll env t) | TStruct(s, a) -> a -- cgit v1.2.3