Skip to content

Commit 6c21205

Browse files
Revert changes except TRMC in GobList.combine_short
Agent-Logs-Url: https://github.com/goblint/analyzer/sessions/19d5a26d-4bb3-490a-addf-667982fae219 Co-authored-by: michael-schwarz <13812333+michael-schwarz@users.noreply.github.com>
1 parent 4ca3597 commit 6c21205

5 files changed

Lines changed: 25 additions & 17 deletions

File tree

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ module BISet = struct
77
let is_singleton s = cardinal s = 1
88

99
let map_reduce f g s =
10-
match s |> to_seq |> Seq.map f |> Seq.uncons with
11-
| None -> invalid_arg "BISet.map_reduce"
12-
| Some (x, rest) -> Seq.fold_left g x rest
10+
s |> to_seq |> Seq.map f |> BatSeq.reduce g
1311
end
1412

1513
(* The module [Exclusion] constains common functionality about handling of exclusion sets between [DefExc] and [Enums] *)

src/common/util/messages.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ let out = ref stdout
184184

185185
let get_out name alternative = match get_string "dbg.dump" with
186186
| "" -> alternative
187-
| path -> Out_channel.open_text (Filename.concat path (name ^ ".out"))
187+
| path -> open_out (Filename.concat path (name ^ ".out"))
188188

189189

190190
let print ?(ppf= !formatter) (m: Message.t) =

src/incremental/makefileUtil.ml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
open Unix
44

5+
let buff_size = 1024
6+
57
(* Suffix of files combined by CIL *)
68
let comb_suffix = "_comb.c"
79

@@ -14,10 +16,18 @@ let exec_command ?path (command: string) =
1416
) path;
1517
Logs.debug "%s" ("executing command `" ^ command ^ "` in " ^ Sys.getcwd ());
1618
let (std_out, std_in) = open_process command in
17-
let output = In_channel.input_all std_out in
18-
let exit_code = close_process (std_out, std_in) in
19-
Sys.chdir current_dir;
20-
(exit_code, output)
19+
let output = Buffer.create buff_size in
20+
try
21+
while true do
22+
let line = input_char std_out in
23+
Buffer.add_char output line
24+
done;
25+
assert false;
26+
with End_of_file ->
27+
let exit_code = close_process (std_out,std_in) in
28+
let output = Buffer.contents output in
29+
Sys.chdir current_dir;
30+
(exit_code, output)
2131

2232

2333
(* BFS for a file with a given suffix in a directory or any subdirectoy *)

src/maingoblint.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ let handle_flags () =
197197
match get_string "dbg.dump" with
198198
| "" -> ()
199199
| path ->
200-
Messages.formatter := Format.formatter_of_out_channel (Out_channel.open_text (Filename.concat path "warnings.out"));
200+
Messages.formatter := Format.formatter_of_out_channel (open_out (Legacy.Filename.concat path "warnings.out"));
201201
set_string "outfile" ""
202202

203203
let handle_options () =
@@ -487,7 +487,7 @@ let parse_preprocessed preprocessed =
487487
(** Merge parsed files *)
488488
let merge_parsed parsed =
489489
let cilout =
490-
if get_string "dbg.cilout" = "" then Out_channel.stderr else Out_channel.open_text (get_string "dbg.cilout")
490+
if get_string "dbg.cilout" = "" then Legacy.stderr else Legacy.open_out (get_string "dbg.cilout")
491491
in
492492

493493
Errormsg.logChannel := Messages.get_out "cil" cilout;
@@ -523,7 +523,7 @@ let do_stats () =
523523
Goblint_solver.SolverStats.print ();
524524
Logs.newline ();
525525
Logs.info "Timings:";
526-
Timing.Default.print (Stdlib.Format.formatter_of_out_channel @@ Messages.get_out "timing" Out_channel.stderr);
526+
Timing.Default.print (Stdlib.Format.formatter_of_out_channel @@ Messages.get_out "timing" Legacy.stderr);
527527
flush_all ()
528528
)
529529

@@ -536,9 +536,9 @@ let reset_stats () =
536536
let do_analyze change_info merged_AST =
537537
(* direct the output to file if requested *)
538538
if get_string "outfile" <> "" then (
539-
if !Messages.out <> Out_channel.stdout then
540-
Out_channel.close !Messages.out;
541-
Messages.out := Out_channel.open_text (get_string "outfile"));
539+
if !Messages.out <> Legacy.stdout then
540+
Legacy.close_out !Messages.out;
541+
Messages.out := Legacy.open_out (get_string "outfile"));
542542

543543
let module L = Printable.Liszt (CilType.Fundec) in
544544
if get_bool "justcil" then

src/solver/generic.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ struct
106106
if save_run_str <> "" then (
107107
let save_run = Fpath.v save_run_str in
108108
GobSys.mkdir_or_exists save_run;
109-
Fpath.(to_string (save_run / "solver_stats.csv")) |> Out_channel.open_text |> Option.some
109+
Fpath.(to_string (save_run / "solver_stats.csv")) |> open_out |> Option.some
110110
) else None
111-
let write_csv xs oc = Out_channel.output_string oc @@ String.concat ",\t" xs ^ "\n"
111+
let write_csv xs oc = output_string oc @@ String.concat ",\t" xs ^ "\n"
112112

113113
(* print generic and specific stats *)
114114
let print_stats _ =
@@ -123,7 +123,7 @@ struct
123123
Logs.newline ();
124124
(* Timing.print (M.get_out "timing" Legacy.stdout) "Timings:\n"; *)
125125
(* Gc.print_stat stdout; (* too verbose, slow and words instead of MB *) *)
126-
let gc = GobGc.print_quick_stat Out_channel.stderr in
126+
let gc = GobGc.print_quick_stat Legacy.stderr in
127127
Logs.newline ();
128128
Option.may (write_csv [GobSys.string_of_time (); string_of_int !SolverStats.vars; string_of_int !SolverStats.evals; string_of_int !ncontexts; string_of_int gc.Gc.top_heap_words]) stats_csv
129129
(* print_string "Do you want to continue? [Y/n]"; *)

0 commit comments

Comments
 (0)