Skip to content

Commit e4f4445

Browse files
authored
Merge pull request #106 from goblint/ocaml-5
Remove batteries dependency to support OCaml 5
2 parents 92625c8 + fd6fe96 commit e4f4445

File tree

10 files changed

+57
-45
lines changed

10 files changed

+57
-45
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ jobs:
1515
- ubuntu-latest
1616
# - windows-latest
1717
ocaml-version:
18-
# - 4.04.2
1918
- 4.05.0
2019
- 4.06.1
2120
- 4.07.1
@@ -26,6 +25,7 @@ jobs:
2625
- 4.12.0
2726
- 4.13.1
2827
- 4.14.x
28+
- ocaml-base-compiler.5.0.0~alpha1
2929

3030

3131
runs-on: ${{ matrix.os }}

dune-project

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ Changes:
3535
stdlib-shims
3636
(ppx_deriving_yojson (>= 3.2))
3737
yojson
38-
(batteries (>= 3.2.0))
3938
conf-perl
4039
cppo
4140
)

goblint-cil.opam

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ depends: [
3535
"stdlib-shims"
3636
"ppx_deriving_yojson" {>= "3.2"}
3737
"yojson"
38-
"batteries" {>= "3.2.0"}
3938
"conf-perl"
4039
"cppo"
4140
]

src/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
(public_name goblint-cil)
55
(name cil)
66
(wrapped false) ; this should be changed, but then module paths in goblint need to be prefixed
7-
(libraries zarith findlib dynlink unix str stdlib-shims batteries.unthreaded) ; batteries shouldn't be needed, but tests fail on MacOS otherwise: https://github.com/goblint/cil/pull/89#issuecomment-1092610041
7+
(libraries zarith findlib dynlink unix str stdlib-shims)
88
(modules (:standard \ main machdepConfigure))
99
)
1010

src/ext/syntacticsearch/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
(public_name goblint-cil.syntacticsearch)
33
(name syntacticsearch)
44
(wrapped false) ; this should be changed, but then module paths in goblint need to be prefixed
5-
(libraries goblint-cil yojson ppx_deriving_yojson.runtime batteries.unthreaded)
5+
(libraries goblint-cil yojson ppx_deriving_yojson.runtime)
66
(preprocess (pps ppx_deriving_yojson))
77
)

src/ext/syntacticsearch/funcDatatype.ml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ open Cil
22

33
(* Finds definition of a user-defined type *)
44
let find_def name file =
5-
BatList.filter_map
5+
Util.list_filter_map
66
(function
77
| GType (info, loc) ->
88
if String.compare name info.tname = 0 then Some ("", loc, name, -1)
@@ -18,7 +18,7 @@ let find_def name file =
1818

1919
(* Finds all definition of user-defined types *)
2020
let find_def_all file =
21-
BatList.filter_map
21+
Util.list_filter_map
2222
(function
2323
| GType (info, loc) -> Some ("", loc, info.tname, -1)
2424
| GCompTag (info, loc) -> Some ("", loc, info.cname, -1)
@@ -27,7 +27,7 @@ let find_def_all file =
2727
file.globals
2828

2929
let find_in_globals list name =
30-
BatList.filter_map
30+
Util.list_filter_map
3131
(function
3232
| GVar (info, _, _) ->
3333
if
@@ -40,7 +40,7 @@ let find_in_globals list name =
4040
list
4141

4242
let find_in_varinfos list name =
43-
BatList.filter_map
43+
Util.list_filter_map
4444
(fun info ->
4545
if
4646
String.compare name
@@ -52,7 +52,7 @@ let find_in_varinfos list name =
5252

5353
let find_fundec globals name =
5454
let gfun =
55-
BatList.find_opt
55+
List.find_opt
5656
(function
5757
| GFun (fundec, _) -> String.compare fundec.svar.vname name = 0
5858
| _ -> false)

src/ext/syntacticsearch/funcFunction.ml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ let map_gfun f = function GFun (dec, loc) -> f dec loc | _ -> None
2020

2121
let find_all_with_origname n =
2222
let ns = Hashtbl.find_all environment n in
23-
BatList.filter_map (function | (EnvVar v,_) -> Some v.vname | _ -> None) ns
23+
Util.list_filter_map (function | (EnvVar v,_) -> Some v.vname | _ -> None) ns
2424

2525
class fun_find_returns funname funid result : nopCilVisitor =
2626
object
@@ -58,7 +58,7 @@ let find_returns funname funid file =
5858
(* Finds all returns in all functions *)
5959
let find_returns_all file =
6060
List.flatten
61-
@@ BatList.filter_map
61+
@@ Util.list_filter_map
6262
(map_gfun (fun fundec _ -> Some (find_returns "" fundec.svar.vid file)))
6363
file.globals
6464

@@ -121,18 +121,18 @@ let find_def funname funid file =
121121
Some (fundec.svar.vname, loc, create_sig fundec file, fundec.svar.vid)
122122
else None
123123
in
124-
BatList.filter_map (map_gfun fn) file.globals
124+
Util.list_filter_map (map_gfun fn) file.globals
125125

126126
(* Finds all definitions of all functions *)
127127
let find_def_all file =
128128
List.flatten
129-
@@ BatList.filter_map
129+
@@ Util.list_filter_map
130130
(map_gfun (fun fundec _ -> Some (find_def "" fundec.svar.vid file)))
131131
file.globals
132132

133133
let find_fundec funname funid list =
134134
let gfun =
135-
BatList.find_opt
135+
List.find_opt
136136
(fun x ->
137137
match x with
138138
| GFun (dec, _) -> is_equal_funname_funid dec.svar funname funid
@@ -170,7 +170,7 @@ let find_uses funname funid file =
170170
(* Find all calls of all functions in all functions *)
171171
let find_uses_all file =
172172
List.flatten
173-
@@ BatList.filter_map
173+
@@ Util.list_filter_map
174174
(map_gfun (fun fundec _ -> Some (find_uses "" fundec.svar.vid file)))
175175
file.globals
176176

@@ -210,7 +210,7 @@ let find_uses_in_fun funname funid funstrucname file =
210210
(* Finds all calls of all functions in a function *)
211211
let find_uses_in_fun_all funstrucname file =
212212
List.flatten
213-
@@ BatList.filter_map
213+
@@ Util.list_filter_map
214214
(map_gfun (fun fundec _ ->
215215
Some (find_uses_in_fun "" fundec.svar.vid funstrucname file)))
216216
file.globals
@@ -272,7 +272,7 @@ let find_usesvar_in_fun funname funid funstrucname varname file =
272272
(* Finds calls of all function with a var in argument in a function *)
273273
let find_usesvar_in_fun_all funstrucname varname file =
274274
List.flatten
275-
@@ BatList.filter_map
275+
@@ Util.list_filter_map
276276
(map_gfun (fun fundec _ ->
277277
Some
278278
(find_usesvar_in_fun "" fundec.svar.vid funstrucname varname file)))
@@ -281,7 +281,7 @@ let find_usesvar_in_fun_all funstrucname varname file =
281281
(* Finds all calls of a function with a var in argument in all functions *)
282282
let find_usesvar funname funid varname file =
283283
List.flatten
284-
@@ BatList.filter_map
284+
@@ Util.list_filter_map
285285
(map_gfun (fun fundec _ ->
286286
Some
287287
(find_usesvar_in_fun funname funid fundec.svar.vname varname file)))
@@ -290,7 +290,7 @@ let find_usesvar funname funid varname file =
290290
(* Finds all calls of all functions with a var in argument in all functions *)
291291
let find_usesvar_all varname file =
292292
List.flatten
293-
@@ BatList.filter_map
293+
@@ Util.list_filter_map
294294
(map_gfun (fun fundec _ ->
295295
Some (find_usesvar "" fundec.svar.vid varname file)))
296296
file.globals
@@ -331,7 +331,7 @@ let create_fun_res name id file loc =
331331
(* Finds all calls of a function in a condition in all functions *)
332332
let find_uses_cond funname funid file =
333333
let id_list = find_lval_of_calls funname funid file in
334-
BatList.filter_map
334+
Util.list_filter_map
335335
(fun (tmp, func) ->
336336
match FuncVar.find_uses_in_cond "" tmp file true with
337337
| (_, loc, _, _) :: _ -> Some (create_fun_res "" func file loc)
@@ -341,7 +341,7 @@ let find_uses_cond funname funid file =
341341
(* Finds all calls of all functions in a condition in all functions *)
342342
let find_uses_cond_all file =
343343
List.flatten
344-
@@ BatList.filter_map
344+
@@ Util.list_filter_map
345345
(map_gfun (fun fundec _ -> Some (find_uses_cond "" fundec.svar.vid file)))
346346
file.globals
347347

@@ -354,7 +354,7 @@ let find_uses_noncond funname funid file =
354354
(* Finds calls of all functions in non-condition in all functions *)
355355
let find_uses_noncond_all file =
356356
List.flatten
357-
@@ BatList.filter_map
357+
@@ Util.list_filter_map
358358
(map_gfun (fun fundec _ ->
359359
Some (find_uses_noncond "" fundec.svar.vid file)))
360360
file.globals
@@ -397,7 +397,7 @@ let find_lval_of_calls_usesvar funname funid varname file =
397397
(* Finds calls of a function with a variable as argument in conditions *)
398398
let find_usesvar_cond funname funid varname file =
399399
let id_list = find_lval_of_calls_usesvar funname funid varname file in
400-
BatList.filter_map
400+
Util.list_filter_map
401401
(fun (tmp, func) ->
402402
match FuncVar.find_uses_in_cond "" tmp file true with
403403
| (_, loc, _, _) :: _ -> Some (create_fun_res "" func file loc)
@@ -407,7 +407,7 @@ let find_usesvar_cond funname funid varname file =
407407
(* Finds calls of all functions with a variable as argument in conditions *)
408408
let find_usesvar_cond_all varname file =
409409
List.flatten
410-
@@ BatList.filter_map
410+
@@ Util.list_filter_map
411411
(map_gfun (fun fundec _ ->
412412
Some (find_usesvar_cond "" fundec.svar.vid varname file)))
413413
file.globals
@@ -421,7 +421,7 @@ let find_usesvar_noncond funname funid varname file =
421421
(* Finds calls of all functions with a variable as argument in non-conditions *)
422422
let find_usesvar_noncond_all varname file =
423423
List.flatten
424-
@@ BatList.filter_map
424+
@@ Util.list_filter_map
425425
(map_gfun (fun fundec _ ->
426426
Some (find_usesvar_noncond "" fundec.svar.vid varname file)))
427427
file.globals

src/ext/syntacticsearch/funcVar.ml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ let map_gvar f = function
2828
let is_temporary id = Inthash.mem allTempVars id
2929

3030
let generate_func_loc_table cilfile =
31-
BatList.filter_map
31+
Util.list_filter_map
3232
(map_gfun (fun dec loc -> Some (dec.svar.vname, loc.line)))
3333
cilfile.globals
3434

3535
let generate_globalvar_list cilfile =
36-
BatList.filter_map
36+
Util.list_filter_map
3737
(map_gvar (fun varinfo _ _ -> Some varinfo.vname))
3838
cilfile.globals
3939

@@ -53,7 +53,7 @@ let get_all_alphaconverted_in_fun varname funname cilfile =
5353
in
5454
let loc_end = iter_fun_loc fun_loc_table in
5555
let tmp =
56-
BatList.filter_map
56+
Util.list_filter_map
5757
(function
5858
| EnvVar varinfo, loc when loc.line >= loc_start && loc.line < loc_end
5959
->
@@ -223,7 +223,7 @@ let find_uses_in_fun_var dec name varid includeCallTmp cilfile =
223223
(* Finds the function in which a variable shall be found *)
224224
let find_uses_in_fun_find_fun list name varname varid includeCallTmp cilfile =
225225
let r =
226-
BatList.find_opt
226+
List.find_opt
227227
(function
228228
| GFun (dec, _) -> String.compare dec.svar.vname name = 0 | _ -> false)
229229
list
@@ -239,7 +239,7 @@ let find_uses_in_fun varname varid funname file includeCallTmp =
239239
file
240240

241241
let find_all_glob_vars list =
242-
BatList.filter_map (map_gvar (fun info _ _ -> Some info.vid)) list
242+
Util.list_filter_map (map_gvar (fun info _ _ -> Some info.vid)) list
243243

244244
(* Finds all uses of all global variables in a function *)
245245
let find_uses_in_fun_all_glob funname file includeCallTmp =
@@ -251,7 +251,7 @@ let find_uses_in_fun_all_glob funname file includeCallTmp =
251251

252252
let find_fundec globals funname =
253253
let r =
254-
BatList.find_opt
254+
List.find_opt
255255
(function
256256
| GFun (dec, _) -> String.compare dec.svar.vname funname = 0
257257
| _ -> false)
@@ -274,7 +274,7 @@ let find_uses_in_fun_all funname file includeCallTmp =
274274

275275
let find_var_in_globals varname varid list =
276276
let r =
277-
BatList.find_opt
277+
List.find_opt
278278
(function
279279
| GVar (info, _, _) -> is_equal_varname_varid info varname varid
280280
| _ -> false)
@@ -294,7 +294,7 @@ let find_var_in_globals varname varid list =
294294
let find_uses varname varid file includeCallTmp =
295295
let uses_in_all_fun =
296296
List.flatten
297-
@@ BatList.filter_map
297+
@@ Util.list_filter_map
298298
(map_gfun (fun dec _ ->
299299
Some
300300
(find_uses_in_fun varname varid dec.svar.vname file
@@ -307,7 +307,7 @@ let find_uses varname varid file includeCallTmp =
307307
let find_uses_all_glob file includeCallTmp =
308308
let res =
309309
List.flatten
310-
@@ BatList.filter_map
310+
@@ Util.list_filter_map
311311
(map_gfun (fun dec _ ->
312312
Some
313313
(find_uses_in_fun_all_glob dec.svar.vname file includeCallTmp)))
@@ -323,7 +323,7 @@ let find_uses_all_glob file includeCallTmp =
323323
let find_uses_all file includeCallTmp =
324324
let res =
325325
List.flatten
326-
@@ BatList.filter_map
326+
@@ Util.list_filter_map
327327
(map_gfun (fun dec _ ->
328328
Some (find_uses_in_fun_all dec.svar.vname file includeCallTmp)))
329329
file.globals
@@ -422,7 +422,7 @@ let find_uses_in_cond_in_fun_all funname file includeCallTmp =
422422
(* Finds all uses of variables in conditions in all functions *)
423423
let find_uses_in_cond_all file includeCallTmp =
424424
List.flatten
425-
@@ BatList.filter_map
425+
@@ Util.list_filter_map
426426
(map_gfun (fun dec _ ->
427427
Some
428428
(find_uses_in_cond_in_fun_all dec.svar.vname file includeCallTmp)))
@@ -456,7 +456,7 @@ let find_uses_in_noncond_all file includeCallTmp =
456456
let find_decl_in_fun varname varid funname file =
457457
let get_formals_locals dec = dec.sformals @ dec.slocals in
458458
let iter_list_name list name =
459-
BatList.filter_map
459+
Util.list_filter_map
460460
(fun x ->
461461
if String.compare x.vname name = 0 && not (is_temporary x.vid) then
462462
Some
@@ -474,7 +474,7 @@ let find_decl_in_fun varname varid funname file =
474474
| None -> []
475475
| Some fundec ->
476476
if varid != -1 then
477-
BatList.filter_map
477+
Util.list_filter_map
478478
(fun x ->
479479
if x.vid = varid then
480480
Some
@@ -504,7 +504,7 @@ let find_decl_in_fun_all funname file =
504504

505505
(* Finds all global variable declarations *)
506506
let find_decl_all_glob file =
507-
BatList.filter_map
507+
Util.list_filter_map
508508
(map_gvar (fun info _ loc ->
509509
Some
510510
( info.vname,
@@ -536,7 +536,7 @@ let find_decl varname varid file =
536536
let find_decl_all file =
537537
let list =
538538
List.flatten
539-
@@ BatList.filter_map
539+
@@ Util.list_filter_map
540540
(map_gfun (fun dec _ ->
541541
Some (find_decl_in_fun_all dec.svar.vname file)))
542542
file.globals
@@ -588,7 +588,7 @@ let find_defs_in_fun varname varid funname file =
588588
(* Finds definitions of all global variables in a function *)
589589
let find_defs_in_fun_all_glob funname file =
590590
List.flatten
591-
@@ BatList.filter_map
591+
@@ Util.list_filter_map
592592
(map_gvar (fun info _ _ ->
593593
Some (find_defs_in_fun "" info.vid funname file)))
594594
file.globals
@@ -610,7 +610,7 @@ let find_defs_in_fun_all funname file =
610610
let find_defs varname varid file =
611611
let r =
612612
List.flatten
613-
@@ BatList.filter_map
613+
@@ Util.list_filter_map
614614
(map_gfun (fun dec _ ->
615615
Some (find_defs_in_fun varname varid dec.svar.vname file)))
616616
file.globals
@@ -624,7 +624,7 @@ let find_defs_all_glob file =
624624
(fun x -> find_var_in_globals "" x file.globals)
625625
(find_all_glob_vars file.globals))
626626
@ List.flatten
627-
@@ BatList.filter_map
627+
@@ Util.list_filter_map
628628
(map_gfun (fun dec _ ->
629629
Some (find_defs_in_fun_all_glob dec.svar.vname file)))
630630
file.globals
@@ -636,6 +636,6 @@ let find_defs_all file =
636636
(fun x -> find_var_in_globals "" x file.globals)
637637
(find_all_glob_vars file.globals))
638638
@ List.flatten
639-
@@ BatList.filter_map
639+
@@ Util.list_filter_map
640640
(map_gfun (fun dec _ -> Some (find_defs_in_fun_all dec.svar.vname file)))
641641
file.globals

0 commit comments

Comments
 (0)