From 99f47c7a99b11c9cc3429fc0e5d0e21ae3707518 Mon Sep 17 00:00:00 2001 From: xleroy Date: Wed, 1 Sep 2010 08:36:03 +0000 Subject: Adding __builtin_annotation git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1497 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- cparser/Elab.ml | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'cparser') diff --git a/cparser/Elab.ml b/cparser/Elab.ml index b3e375cd..2ae7c7e9 100644 --- a/cparser/Elab.ml +++ b/cparser/Elab.ml @@ -778,6 +778,17 @@ let elab_expr loc env a = let ty = match b3.edesc with ESizeof ty -> ty | _ -> assert false in { edesc = ECall(b1, [b2; b3]); etyp = ty } +(* Hack to treat __builtin_annotation the CompCert way. + Arguments are treated as per the prototype (const char *, ...). + Result type is type of second argument, or void if only one argument. *) + | CALL((VARIABLE "__builtin_annotation" as a1), al) -> + let b1 = elab a1 in + let bl = List.map elab al in + let bl' = elab_arguments 1 bl [Env.fresh_ident "", + TPtr(TInt(IChar, [AConst]),[])] true in + let tyres = match bl' with _ :: b2 :: _ -> b2.etyp | _ -> TVoid[] in + { edesc = ECall(b1, bl'); etyp = tyres } + | CALL(a1, al) -> let b1 = (* Catch the old-style usage of calling a function without -- cgit