Skip to content

Commit 2e44691

Browse files
committed
Remove unnecessary suppress_ovwarn arguments in S
There's no need for the argument: the caller can just ignore the return value.
1 parent 051254f commit 2e44691

File tree

5 files changed

+31
-20
lines changed

5 files changed

+31
-20
lines changed

src/cdomain/value/cdomains/int/congruenceDomain.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,10 @@ struct
133133
| x when equal zero x -> Some false
134134
| x -> if leq zero x then None else Some true
135135

136-
let starting ?(suppress_ovwarn=false) ik n = top()
136+
let starting ik n = top()
137137

138138
let ending = starting
139+
let of_interval ik x = of_interval ik x (* cast away optional suppress_ovwarn argument *)
139140

140141
let of_congruence ik (c,m) = normalize ik @@ Some(c,m)
141142

src/cdomain/value/cdomains/int/defExcDomain.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -288,12 +288,12 @@ struct
288288
| _ -> None
289289
let top_bool = `Excluded (S.empty (), R.of_interval range_ikind (0L, 1L))
290290

291-
let of_interval ?(suppress_ovwarn=false) ik (x,y) =
291+
let of_interval ik (x,y) =
292292
if Z.compare x y = 0 then
293293
of_int ik x
294294
else
295295
let a, b = Size.min_range_sign_agnostic x, Size.min_range_sign_agnostic y in
296-
let r = R.join (R.of_interval ~suppress_ovwarn range_ikind a) (R.of_interval ~suppress_ovwarn range_ikind b) in
296+
let r = R.join (R.of_interval range_ikind a) (R.of_interval range_ikind b) in
297297
let ex = if Z.gt x Z.zero || Z.lt y Z.zero then S.singleton Z.zero else S.empty () in
298298
norm ik @@ (`Excluded (ex, r))
299299

@@ -308,13 +308,13 @@ struct
308308
let ik_mask = snd (Size.range ik) in
309309
(one_mask, ik_mask)
310310

311-
let starting ?(suppress_ovwarn=false) ikind x =
311+
let starting ikind x =
312312
let _,u_ik = Size.range ikind in
313-
of_interval ~suppress_ovwarn ikind (x, u_ik)
313+
of_interval ikind (x, u_ik)
314314

315-
let ending ?(suppress_ovwarn=false) ikind x =
315+
let ending ikind x =
316316
let l_ik,_ = Size.range ikind in
317-
of_interval ~suppress_ovwarn ikind (l_ik, x)
317+
of_interval ikind (l_ik, x)
318318

319319
let of_excl_list t l =
320320
let r = size t in (* elements in l are excluded from the full range of t! *)

src/cdomain/value/cdomains/int/enumsDomain.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@ module Enums : S with type int_t = Z.t = struct
108108

109109
let of_int ikind x = cast_to ikind (Inc (BISet.singleton x))
110110

111-
let of_interval ?(suppress_ovwarn=false) ik (x, y) =
111+
let of_interval ik (x, y) =
112112
if Z.compare x y = 0 then
113113
of_int ik x
114114
else
115115
let a, b = Size.min_range_sign_agnostic x, Size.min_range_sign_agnostic y in
116-
let r = R.join (R.of_interval ~suppress_ovwarn range_ikind a) (R.of_interval ~suppress_ovwarn range_ikind b) in
116+
let r = R.join (R.of_interval range_ikind a) (R.of_interval range_ikind b) in
117117
let ex = if Z.gt x Z.zero || Z.lt y Z.zero then BISet.singleton Z.zero else BISet.empty () in
118118
norm ik @@ (Exc (ex, r))
119119

@@ -265,13 +265,13 @@ module Enums : S with type int_t = Z.t = struct
265265
| _ when Cil.isSigned ik -> (one_mask, one_mask)
266266
| _ -> (one_mask, ik_mask)
267267

268-
let starting ?(suppress_ovwarn=false) ikind x =
268+
let starting ikind x =
269269
let _,u_ik = Size.range ikind in
270-
of_interval ~suppress_ovwarn ikind (x, u_ik)
270+
of_interval ikind (x, u_ik)
271271

272-
let ending ?(suppress_ovwarn=false) ikind x =
272+
let ending ikind x =
273273
let l_ik,_ = Size.range ikind in
274-
of_interval ~suppress_ovwarn ikind (l_ik, x)
274+
of_interval ikind (l_ik, x)
275275

276276
let c_lognot ik x =
277277
if is_bot x

src/cdomain/value/cdomains/intDomain0.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ sig
110110
end
111111

112112

113-
module IntDomLifter (I : S) =
113+
module IntDomLifter (I : S2) =
114114
struct
115115
open Cil
116116
type int_t = I.int_t
@@ -465,7 +465,7 @@ struct
465465
) (Invariant.top ()) ns
466466
end
467467

468-
module SOverflowUnlifter (D : SOverflow) : S with type int_t = D.int_t and type t = D.t = struct
468+
module SOverflowUnlifter (D : SOverflow) : S2 with type int_t = D.int_t and type t = D.t = struct
469469
include D
470470

471471
let add ?no_ov ik x y = fst @@ D.add ?no_ov ik x y

src/cdomain/value/cdomains/intDomain_intf.ml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,16 +248,16 @@ sig
248248
val meet: Cil.ikind -> t -> t -> t
249249
val narrow: Cil.ikind -> t -> t -> t
250250
val widen: Cil.ikind -> t -> t -> t
251-
val starting : ?suppress_ovwarn:bool -> Cil.ikind -> int_t -> t
252-
val ending : ?suppress_ovwarn:bool -> Cil.ikind -> int_t -> t
251+
val starting : Cil.ikind -> int_t -> t
252+
val ending : Cil.ikind -> int_t -> t
253253
val of_int: Cil.ikind -> int_t -> t
254254
(** Transform an integer literal to your internal domain representation. *)
255255

256256
val of_bool: Cil.ikind -> bool -> t
257257
(** Transform a known boolean value to the default internal representation. It
258258
* should follow C: [of_bool true = of_int 1] and [of_bool false = of_int 0]. *)
259259

260-
val of_interval: ?suppress_ovwarn:bool -> Cil.ikind -> int_t * int_t -> t
260+
val of_interval: Cil.ikind -> int_t * int_t -> t
261261
val of_congruence: Cil.ikind -> int_t * int_t -> t
262262
val of_bitfield: Cil.ikind -> int_t * int_t -> t
263263
val to_bitfield: Cil.ikind -> t -> int_t * int_t
@@ -275,6 +275,15 @@ sig
275275
end
276276
(** Interface of IntDomain implementations taking an ikind for arithmetic operations *)
277277

278+
module type S2 =
279+
sig
280+
include S
281+
282+
val starting : ?suppress_ovwarn:bool -> Cil.ikind -> int_t -> t
283+
val ending : ?suppress_ovwarn:bool -> Cil.ikind -> int_t -> t
284+
val of_interval: ?suppress_ovwarn:bool -> Cil.ikind -> int_t * int_t -> t
285+
end
286+
278287
module type SOverflow =
279288
sig
280289

@@ -358,14 +367,15 @@ sig
358367
module type B = B
359368
module type IkindUnawareS = IkindUnawareS
360369
module type S = S
370+
module type S2 = S2
361371
module type SOverflow = SOverflow
362372

363-
module SOverflowUnlifter (D : SOverflow) : S with type int_t = D.int_t and type t = D.t
373+
module SOverflowUnlifter (D : SOverflow) : S2 with type int_t = D.int_t and type t = D.t
364374

365375
module type Y = Y
366376
module type Z = Z
367377

368-
module IntDomLifter (I: S): Y with type int_t = I.int_t
378+
module IntDomLifter (I: S2): Y with type int_t = I.int_t
369379

370380
module type Ikind = Ikind
371381

0 commit comments

Comments
 (0)