From d271d82bd1ad0ac99ad45f65d2510a0200279193 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20B=C3=BChler?= <david.buhler@cea.fr> Date: Tue, 7 Dec 2021 18:17:12 +0100 Subject: [PATCH] [Eva] Fixes function Value_util.protect, which can be called multiple times. --- src/plugins/value/utils/value_util.ml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/plugins/value/utils/value_util.ml b/src/plugins/value/utils/value_util.ml index 9f7ddc3f461..548a3cc8b12 100644 --- a/src/plugins/value/utils/value_util.ml +++ b/src/plugins/value/utils/value_util.ml @@ -111,17 +111,19 @@ let protect_only_once = ref true let protect f ~cleanup = let catch () = !protect_only_once && not (Kernel.SaveState.is_empty ()) in + let cleanup () = + Value_parameters.feedback ~once:true "Clean up and save partial results."; + try cleanup () + with e -> + protect_only_once := false; + raise e + in try f (); with | Log.AbortError _ | Log.AbortFatal _ | Log.FeatureRequest _ | Sys.Break as e when catch () -> - try - Value_parameters.feedback ~once:true "Clean up and save partial results."; - cleanup (); - raise e; - with e -> - protect_only_once := false; - raise e + cleanup (); + raise e let register_new_var v typ = if Cil.isFunctionType typ then -- GitLab