From 3b15828ca868365b285ba611ba72177e90d0061b Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Tue, 7 Apr 2020 22:50:20 +0200 Subject: expect operation --- cfrontend/C2C.ml | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cfrontend/C2C.ml') diff --git a/cfrontend/C2C.ml b/cfrontend/C2C.ml index 9f2c4604..902a5c5d 100644 --- a/cfrontend/C2C.ml +++ b/cfrontend/C2C.ml @@ -900,6 +900,14 @@ let rec convertExpr env e = | C.ECompound(ty1, ie) -> unsupported "compound literals"; ezero + | C.ECall({edesc = C.EVar {name = "__builtin_expect"}}, args) -> + (match args with + | [e1; e2] -> + ewrap (Ctyping.ebinop Cop.Oexpect (convertExpr env e1) (convertExpr env e2)) + | _ -> + error "__builtin_expect wants two arguments"; + ezero) + | C.ECall({edesc = C.EVar {name = "__builtin_debug"}}, args) when List.length args < 2 -> error "too few arguments to function call, expected at least 2, have 0"; ezero -- cgit