Skip to content

Commit 3015607

Browse files
authored
Merge pull request #1294 from goblint/printable-expand
Improve readability of global invariants
2 parents df2b39a + 152b54b commit 3015607

28 files changed

+213
-149
lines changed

src/analyses/base.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ struct
5454

5555
module G =
5656
struct
57-
include Lattice.Lift2 (Priv.G) (VD) (Printable.DefaultNames)
57+
include Lattice.Lift2Conf (struct include Printable.DefaultConf let expand1 = false let expand2 = false end) (Priv.G) (VD)
5858

5959
let priv = function
6060
| `Bot -> Priv.G.bot ()

src/analyses/basePriv.ml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ struct
544544
)
545545
)
546546
else (
547-
if ConcDomain.ThreadSet.is_top tids then
547+
if ConcDomain.ThreadSet.is_top tids then
548548
st
549549
else
550550
match ConcDomain.ThreadSet.elements tids with
@@ -660,21 +660,11 @@ struct
660660
struct
661661
include VarinfoV (* [g]' *)
662662
let name () = "unprotected"
663-
let show x = show x ^ ":unprotected" (* distinguishable variant names for html *)
664-
include Printable.SimpleShow (struct
665-
type nonrec t = t
666-
let show = show
667-
end)
668663
end
669664
module VProt =
670665
struct
671666
include VarinfoV (* [g] *)
672667
let name () = "protected"
673-
let show x = show x ^ ":protected" (* distinguishable variant names for html *)
674-
include Printable.SimpleShow (struct
675-
type nonrec t = t
676-
let show = show
677-
end)
678668
end
679669
module V =
680670
struct
@@ -809,7 +799,7 @@ struct
809799
struct
810800
(* weak: G -> (2^M -> WeakRange) *)
811801
(* sync: M -> (2^M -> SyncRange) *)
812-
include Lattice.Lift2 (GWeak) (GSync) (Printable.DefaultNames)
802+
include Lattice.Lift2Conf (struct include Printable.DefaultConf let expand1 = false let expand2 = false end) (GWeak) (GSync)
813803

814804
let weak = function
815805
| `Bot -> GWeak.bot ()

src/analyses/commonPriv.ml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,16 @@ struct
7474
struct
7575
include LockDomain.Addr
7676
let name () = "mutex"
77-
let show x = show x ^ ":mutex" (* distinguishable variant names for html *)
7877
end
7978
module VMutexInits = Printable.UnitConf (struct let name = "MUTEX_INITS" end)
8079
module VGlobal =
8180
struct
8281
include VarinfoV
8382
let name () = "global"
84-
let show x = show x ^ ":global" (* distinguishable variant names for html *)
8583
end
8684
module V =
8785
struct
88-
include Printable.Either3 (VMutex) (VMutexInits) (VGlobal)
86+
include Printable.Either3Conf (struct include Printable.DefaultConf let expand2 = false end) (VMutex) (VMutexInits) (VGlobal)
8987
let name () = "MutexGlobals"
9088
let mutex x: t = `Left x
9189
let mutex_inits: t = `Middle ()
@@ -173,7 +171,7 @@ struct
173171

174172
module V =
175173
struct
176-
include Printable.Either (MutexGlobals.V) (TID)
174+
include Printable.EitherConf (struct let expand1 = false let expand2 = true end) (MutexGlobals.V) (TID)
177175
let mutex x = `Left (MutexGlobals.V.mutex x)
178176
let mutex_inits = `Left MutexGlobals.V.mutex_inits
179177
let global x = `Left (MutexGlobals.V.global x)
@@ -200,7 +198,7 @@ struct
200198

201199
module G =
202200
struct
203-
include Lattice.Lift2 (GMutex) (GThread) (Printable.DefaultNames)
201+
include Lattice.Lift2Conf (struct include Printable.DefaultConf let expand1 = false let expand2 = false end) (GMutex) (GThread)
204202

205203
let mutex = function
206204
| `Bot -> GMutex.bot ()

src/analyses/loopTermination.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ let check_bounded ctx varinfo =
1919
(** We want to record termination information of loops and use the loop
2020
* statements for that. We use this lifting because we need to have a
2121
* lattice. *)
22-
module Statements = Lattice.Flat (CilType.Stmt) (Printable.DefaultNames)
22+
module Statements = Lattice.Flat (CilType.Stmt)
2323

2424
(** The termination analysis considering loops and gotos *)
2525
module Spec : Analyses.MCPSpec =

src/analyses/mCPRegistry.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ end
426426

427427
module DomVariantLattice (DLSpec : DomainListLatticeSpec) =
428428
struct
429-
include Lattice.Lift (DomVariantLattice0 (DLSpec)) (Printable.DefaultNames)
429+
include Lattice.LiftConf (struct include Printable.DefaultConf let expand1 = false end) (DomVariantLattice0 (DLSpec))
430430
let name () = "MCP.G"
431431
end
432432

src/analyses/mutexAnalysis.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ struct
132132

133133
module G =
134134
struct
135-
include Lattice.Lift2 (GProtecting) (GProtected) (Printable.DefaultNames)
135+
include Lattice.Lift2Conf (struct include Printable.DefaultConf let expand1 = false let expand2 = false end) (GProtecting) (GProtected)
136136

137137
let protecting = function
138138
| `Bot -> GProtecting.bot ()

src/analyses/raceAnalysis.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ struct
194194

195195
module G =
196196
struct
197-
include Lattice.Lift2 (OffsetTrie) (MemoSet) (Printable.DefaultNames)
197+
include Lattice.Lift2Conf (struct include Printable.DefaultConf let expand1 = false let expand2 = false end) (OffsetTrie) (MemoSet)
198198

199199
let access = function
200200
| `Bot -> OffsetTrie.bot ()

src/analyses/symbLocks.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,20 +106,20 @@ struct
106106

107107
module A =
108108
struct
109-
module E = struct
110-
include Printable.Either (CilType.Offset) (ILock)
111-
112-
let pretty () = function
113-
| `Left o -> Pretty.dprintf "p-lock:%a" (d_offset (text "*")) o
114-
| `Right addr -> Pretty.dprintf "i-lock:%a" ILock.pretty addr
109+
module PLock =
110+
struct
111+
include CilType.Offset
112+
let name () = "p-lock"
115113

114+
let pretty = d_offset (text "*")
116115
include Printable.SimplePretty (
117116
struct
118117
type nonrec t = t
119118
let pretty = pretty
120119
end
121120
)
122121
end
122+
module E = Printable.Either (PLock) (ILock)
123123
include SetDomain.Make (E)
124124

125125
let name () = "symblock"

src/analyses/threadId.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct
3131

3232
module N =
3333
struct
34-
include Lattice.Flat (VNI) (struct let bot_name = "unknown node" let top_name = "unknown node" end)
34+
include Lattice.FlatConf (struct include Printable.DefaultConf let bot_name = "unknown node" let top_name = "unknown node" end) (VNI)
3535
let name () = "wrapper call"
3636
end
3737
module TD = Thread.D

src/analyses/tutorials/signs.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ end
3636
* We then lift the above operations to the lattice. *)
3737
module SL =
3838
struct
39-
include Lattice.Flat (Signs) (Printable.DefaultNames)
39+
include Lattice.Flat (Signs)
4040
let of_int i = `Lifted (Signs.of_int i)
4141

4242
let lt x y = match x, y with

0 commit comments

Comments
 (0)