Skip to content

Commit c4bb502

Browse files
cknittclaude
andcommitted
Remove code left unused by in-memory build file writes
Since #9170 writes build files through Build_file_store, nothing writes or reads them through channels any more. make dead-code reported: - Misc.output_to_bin_file_directly, Ext_buffer.output_buffer and Cmi_format.read_cmi_channel: never used; removed. - File_util.read_build_file: used only inside File_util; no longer exported. - Compiler_process.run_requests: its ?poll and ?on_complete are never passed (the only caller is a test); removed, like the other never-passed optional arguments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kbf3gLDo8mBJKpNE25WAwT Signed-off-by: Christoph Knittel <ck@cca.io>
1 parent 77c8197 commit c4bb502

9 files changed

Lines changed: 2 additions & 41 deletions

File tree

‎compiler/ext/ext_buffer.ml‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ let add_string_char b s c =
108108
really_input ic b.buffer b.position len;
109109
b.position <- b.position + len *)
110110

111-
let output_buffer oc b = output oc b.buffer 0 b.position
112-
113111
(**
114112
It could be one byte, two bytes, three bytes and four bytes
115113
TODO: inline for better performance

‎compiler/ext/ext_buffer.mli‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,4 @@ val add_string : t -> string -> unit
7676
Raise [End_of_file] if the channel contains fewer than [n]
7777
characters. *)
7878

79-
val output_buffer : out_channel -> t -> unit
80-
(** [output_buffer oc b] writes the current contents of buffer [b]
81-
on the output channel [oc]. *)
82-
8379
val add_string_char : t -> string -> char -> unit

‎compiler/ext/misc.ml‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -113,19 +113,6 @@ let create_hashtable init =
113113
Array.iter (fun (key, data) -> Hashtbl.add tbl key data) init;
114114
tbl
115115

116-
(* File copy *)
117-
118-
let output_to_bin_file_directly filename fn =
119-
let filename = Compiler_request_state.resolve_path filename in
120-
let oc = open_out_bin filename in
121-
match fn filename oc with
122-
| v ->
123-
close_out oc;
124-
v
125-
| exception e ->
126-
close_out oc;
127-
raise e
128-
129116
(* Integer operations *)
130117

131118
module Int_literal_converter = struct

‎compiler/ext/misc.mli‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ val create_hashtable : ('a * 'b) array -> ('a, 'b) Hashtbl.t
6161
(* Create a hashtable of the given size and fills it with the
6262
given bindings. *)
6363

64-
val output_to_bin_file_directly : string -> (string -> out_channel -> 'a) -> 'a
65-
6664
module Int_literal_converter : sig
6765
val int : string -> int
6866
end

‎compiler/ml/cmi_format.ml‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,6 @@ let check_magic_number filename buffer =
5252
raise (Error (Wrong_version_interface (filename, "an older")))
5353
else raise (Error (Not_an_interface filename))
5454

55-
let read_cmi_channel filename ic =
56-
try
57-
check_magic_number filename
58-
(really_input_string ic (String.length Config.cmi_magic_number));
59-
input_cmi ic
60-
with End_of_file | Failure _ -> raise (Error (Corrupted_interface filename))
61-
62-
(* The same as [read_cmi_channel] on a channel holding [contents]. *)
6355
let read_cmi_contents filename contents =
6456
let magic_length = String.length Config.cmi_magic_number in
6557
if String.length contents < magic_length then

‎compiler/ml/cmi_format.mli‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ val input_cmi : in_channel -> cmi_infos
2929

3030
(* read a cmi from a filename, checking the magic *)
3131
val read_cmi : string -> cmi_infos
32-
val read_cmi_channel : string -> in_channel -> cmi_infos
3332

3433
val read_cmi_contents : string -> string -> cmi_infos
3534
(** [read_cmi_contents filename contents] reads an interface from the

‎rewatch-ocaml/compiler_process.ml‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ let run_tasks ?poll ?on_complete tasks =
110110
~max_jobs:(Compiler_execution_mode.configured_count ())
111111
?poll ?on_complete tasks
112112

113-
let run_requests ?poll ?on_complete requests =
114-
requests |> List.map task |> run_tasks ?poll ?on_complete
113+
let run_requests requests = requests |> List.map task |> run_tasks
115114

116115
let parse_request ~build_dir ~(config : Config.t) path =
117116
let ast = Source.ast_path path in

‎rewatch-ocaml/compiler_process.mli‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,7 @@ type request = {args: string list; cwd: string}
88
val parse_request : build_dir:string -> config:Config.t -> string -> request
99
val run : ?poll:(unit -> unit) -> request -> Process.result
1010

11-
val run_requests :
12-
?poll:(unit -> unit) ->
13-
?on_complete:(int -> unit) ->
14-
request list ->
15-
Process.result list
11+
val run_requests : request list -> Process.result list
1612

1713
val publish_parse :
1814
build_dir:string -> ocaml_dir:string -> config:Config.t -> string -> unit

‎rewatch-ocaml/file_util.mli‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ val exists : string -> bool
1717
val files_equal : string -> string -> bool
1818
val copy_file_if_different : string -> string -> bool
1919

20-
val read_build_file : string -> string
21-
(** Reads a build file through [Build_file_store]. A missing file raises
22-
[Unix.Unix_error ENOENT]. *)
23-
2420
val write_build_file : ?keep:bool -> string -> string -> unit
2521
val copy_build_file : ?keep:bool -> string -> string -> unit
2622

0 commit comments

Comments
 (0)