123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172(**************************************************************************)(* *)(* This file is part of WP plug-in of Frama-C. *)(* *)(* Copyright (C) 2007-2023 *)(* CEA (Commissariat a l'energie atomique et aux energies *)(* alternatives) *)(* *)(* you can redistribute it and/or modify it under the terms of the GNU *)(* Lesser General Public License as published by the Free Software *)(* Foundation, version 2.1. *)(* *)(* It is distributed in the hope that it will be useful, *)(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)(* GNU Lesser General Public License for more details. *)(* *)(* See the GNU Lesser General Public License version 2.1 *)(* for more details (enclosed in the file licenses/LGPLv2.1). *)(* *)(**************************************************************************)(* Compute Init WP *)moduleMake(W:Mcfg.S)=structletcompute_global_initwenvfilterobj=Globals.Vars.fold_in_file_rev_order(funvarinitinfoobj->ifvar.vstorage=Externthenobjelseletdo_init=matchfilterwith|`All->true|`InitConst->Cil.isGlobalInitConstvarinifnotdo_initthenobjelseletold_loc=Cil.CurrentLoc.get()inCil.CurrentLoc.setvar.vdecl;letobj=W.initwenvvarinitinfo.initobjinCil.CurrentLoc.setold_loc;obj)objletprocess_global_constwenvobj=Globals.Vars.fold_in_file_rev_order(funvar_initinfoobj->ifCil.isGlobalInitConstvarthenW.constwenvvarobjelseobj)obj(* WP of global initializations. *)letprocess_global_initwenvkfobj=ifCfgInfos.is_entry_pointkfthenbeginletobj=W.labelwenvNoneClabels.initobjincompute_global_initwenv`AllobjendelseifW.has_initwenvthenbeginletobj=ifWp_parameters.Init.get()thenprocess_global_constwenvobjelseobjinletobj=W.use_assignswenvNoneWpPropId.mk_init_assignsobjinletobj=W.labelwenvNoneClabels.initobjincompute_global_initwenv`AllobjendelseifWp_parameters.Init.get()thencompute_global_initwenv`InitConstobjelseobjend