Skip to content

Commit

Permalink
Fix regression introduced by #9660
Browse files Browse the repository at this point in the history
This commit restores the compiler's behaviour when called on a C file
and with no "-o" otption.
  • Loading branch information
shindere committed Sep 8, 2021
1 parent 3e85887 commit 0da29e1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
6 changes: 3 additions & 3 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -486,9 +486,9 @@ OCaml 4.13.0
- #9407: added warning for missing mli interface file
(Anukriti Kumar, review by Florian Angeletti)

- #9960: extend ocamlc/ocamlopt's -o option to work when compiling C files
(Sébastien Hinderer, reported by Daniel Bünzli, review by Florian
Angeletti and Gabriel Scherer)
- #9960, #10619: extend ocamlc/ocamlopt's -o option to work when
compiling C files (Sébastien Hinderer, reported by Daniel Bünzli,
review by Florian Angeletti and Gabriel Scherer)

- #10095: simplify the syntax error messages produced by the compiler.
In many cases, the compiler would produce an error message that looked
Expand Down
19 changes: 12 additions & 7 deletions driver/compenv.ml
Original file line number Diff line number Diff line change
Expand Up @@ -641,13 +641,18 @@ let process_action
| ProcessCFile name ->
readenv ppf (Before_compile name);
Location.input_name := name;
let obj_name = match !output_name with
| None -> c_object_of_filename name
| Some n -> n
in
if Ccomp.compile_file ~output:obj_name name <> 0
then raise (Exit_with_status 2);
ccobjs := obj_name :: !ccobjs
(match !output_name with
| None ->
begin
if Ccomp.compile_file name <> 0 then raise (Exit_with_status 2);
ccobjs := c_object_of_filename name :: !ccobjs
end
| Some obj_name ->
begin
if Ccomp.compile_file ~output:obj_name name <> 0
then raise (Exit_with_status 2);
ccobjs := obj_name :: !ccobjs
end)
| ProcessObjects names ->
ccobjs := names @ !ccobjs
| ProcessDLLs names ->
Expand Down

0 comments on commit 0da29e1

Please sign in to comment.