From 947e3e3fe3a0c686c0fa9e0d5dbd7cd9620acb05 Mon Sep 17 00:00:00 2001 From: Thibault Martin <thi.martin.pro@pm.me> Date: Tue, 9 Jul 2024 10:01:07 +0200 Subject: [PATCH] [cil] Remove unused parameter of isConstantGen --- src/kernel_services/ast_queries/cil.ml | 37 ++++++++++++-------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/src/kernel_services/ast_queries/cil.ml b/src/kernel_services/ast_queries/cil.ml index 90833a75888..4c8f43f3d8a 100644 --- a/src/kernel_services/ast_queries/cil.ml +++ b/src/kernel_services/ast_queries/cil.ml @@ -5861,18 +5861,18 @@ let isVariadicListType t = match unrollTypeSkel t with | TBuiltin_va_list _ -> true | _ -> false -let rec isConstantGen lit_only is_varinfo_cst f e = match e.enode with +let rec isConstantGen is_varinfo_cst f e = match e.enode with | Const c -> f c - | UnOp (_, e, _) -> isConstantGen lit_only is_varinfo_cst f e + | UnOp (_, e, _) -> isConstantGen is_varinfo_cst f e | BinOp (_, e1, e2, _) -> - isConstantGen lit_only is_varinfo_cst f e1 && - isConstantGen lit_only is_varinfo_cst f e2 + isConstantGen is_varinfo_cst f e1 && + isConstantGen is_varinfo_cst f e2 | Lval (Var vi, NoOffset) -> is_varinfo_cst vi || (vi.vglob && isArrayType vi.vtype) || isFunctionType vi.vtype | Lval (Var vi, offset) -> - is_varinfo_cst vi && isConstantOffsetGen lit_only is_varinfo_cst f offset + is_varinfo_cst vi && isConstantOffsetGen is_varinfo_cst f offset | Lval _ -> false | SizeOf _ | SizeOfE _ | SizeOfStr _ | AlignOf _ | AlignOfE _ -> true (* see ISO 6.6.6 *) @@ -5886,32 +5886,29 @@ let rec isConstantGen lit_only is_varinfo_cst f e = match e.enode with in any case. *) bytesSizeOfInt theMachine.upointKind <= bytesSizeOfInt i && - isConstantGen false is_varinfo_cst f e - | _ -> isConstantGen lit_only is_varinfo_cst f e + isConstantGen is_varinfo_cst f e + | _ -> isConstantGen is_varinfo_cst f e end | AddrOf (Var vi, off) | StartOf (Var vi, off) -> - not lit_only && - vi.vglob && - isConstantOffsetGen lit_only is_varinfo_cst f off + vi.vglob && isConstantOffsetGen is_varinfo_cst f off | AddrOf (Mem e, off) | StartOf(Mem e, off) -> - isConstantGen lit_only is_varinfo_cst f e && - isConstantOffsetGen lit_only is_varinfo_cst f off + isConstantGen is_varinfo_cst f e && + isConstantOffsetGen is_varinfo_cst f off -and isConstantOffsetGen lit_only is_varinfo_cst f = function +and isConstantOffsetGen is_varinfo_cst f = function NoOffset -> true - | Field(_fi, off) -> isConstantOffsetGen lit_only is_varinfo_cst f off + | Field(_fi, off) -> isConstantOffsetGen is_varinfo_cst f off | Index(e, off) -> - isConstantGen lit_only is_varinfo_cst f e && - isConstantOffsetGen lit_only is_varinfo_cst f off + isConstantGen is_varinfo_cst f e && + isConstantOffsetGen is_varinfo_cst f off let isConstant ?(is_varinfo_cst = alphafalse) e = - isConstantGen false is_varinfo_cst alphatrue e + isConstantGen is_varinfo_cst alphatrue e let isConstantOffset ?(is_varinfo_cst = alphafalse) o = - isConstantOffsetGen false is_varinfo_cst alphatrue o + isConstantOffsetGen is_varinfo_cst alphatrue o let isIntegerConstant ?(is_varinfo_cst = alphafalse) e = - isConstantGen false - is_varinfo_cst + isConstantGen is_varinfo_cst (function | CInt64 _ | CChr _ | CEnum _ -> true | CStr _ | CWStr _ | CReal _ -> false) -- GitLab