Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
MC further cleanups (let it compile, this time)
[simgrid.git] / include / simgrid / modelchecker.h
1 /* simgrid/modelchecker.h - Formal Verification made possible in SimGrid    */
2
3 /* Copyright (c) 2008-2022. The SimGrid Team. All rights reserved.          */
4
5 /* This program is free software; you can redistribute it and/or modify it
6  * under the terms of the license (GNU LGPL) which comes with this package. */
7
8 #ifndef SIMGRID_MODELCHECKER_H
9 #define SIMGRID_MODELCHECKER_H
10
11 #include <simgrid/config.h> /* SIMGRID_HAVE_MC ? */
12 #include <xbt/base.h>
13
14 #include <stddef.h> /* size_t */
15
16 SG_BEGIN_DECL
17
18 /** Explore every branches where that function returns a value between min and max (inclusive) */
19 XBT_PUBLIC int MC_random(int min, int max);
20
21 #if SIMGRID_HAVE_MC
22
23 /* Internal variable used to check if we're running under the MC. Please use MC_is_active instead. */
24 extern XBT_PUBLIC int _sg_do_model_check;
25 extern XBT_PUBLIC int _sg_mc_max_visited_states;
26
27 #define MC_is_active()         _sg_do_model_check
28 #define MC_visited_reduction() _sg_mc_max_visited_states
29
30 /** Assertion for the model-checker
31  *
32  *  This function is used to define safety properties to verify.
33  */
34 XBT_PUBLIC void MC_assert(int);
35
36 XBT_PUBLIC void MC_automaton_new_propositional_symbol(const char* id, int (*fct)(void));
37 XBT_PUBLIC void MC_automaton_new_propositional_symbol_pointer(const char* id, int* value);
38
39 XBT_PUBLIC void MC_ignore_heap(void* address, size_t size);
40 XBT_PUBLIC void MC_unignore_heap(void* address, size_t size);
41
42 #else
43
44 #define MC_is_active()                  0
45 #define MC_visited_reduction()          0
46
47 #define MC_assert(a)                    xbt_assert(a)
48
49 #define MC_automaton_new_propositional_symbol(a, b) ((void)0)
50 #define MC_automaton_new_propositional_symbol_pointer(a, b) ((void)0)
51
52 #define MC_ignore_heap(a, s) ((void)0)
53 #define MC_unignore_heap(a, s) ((void)0)
54
55 #endif
56
57 SG_END_DECL
58
59 #endif /* SIMGRID_MODELCHECKER_H */