MPR#7918: fix 4.08+dev regression, object files would remain after build error

master
Gabriel Scherer 2019-02-19 08:42:19 +01:00
parent 05913e6ce3
commit 43793390b9
2 changed files with 20 additions and 17 deletions

13
Changes
View File

@ -565,6 +565,13 @@ OCaml 4.08.0
### Internal/compiler-libs changes:
- MPR#7918, GPR#1703, GPR#1944, GPR#2213, GPR#2257: Add the module
Compile_common, which factorizes the common part in Compile and
Optcompile. This also makes the pipeline more modular.
(Gabriel Radanne, help from Gabriel Scherer and Valentin
Gatien-Baron, review by Mark Shinwell and Gabriel Radanne,
regression spotted by Clément Franchini)
- GPR#292: use Menhir as the parser generator for the OCaml parser.
Satellite GPRs: GPR#1844, GPR#1846, GPR#1853, GPR#1850, GPR#1934, GPR#2151,
GPR#2174
@ -587,12 +594,6 @@ OCaml 4.08.0
- GPR#1610, GPR#2252: Remove positions from paths
(Leo White, review by Frédéric Bour and Thomas Refis)
- GPR#1703, GPR#1944, GPR#2213: Add the module Compile_common,
which factorizes the common part in Compile and Optcompile.
This also makes the pipeline more modular.
(Gabriel Radanne, help from Gabriel Scherer and Valentin Gatien-Baron,
review by Mark Shinwell and Gabriel Radanne)
- GPR#1745: do not generalize the type of every sub-pattern, only of variables.
(Thomas Refis, review by Leo White)

View File

@ -113,15 +113,17 @@ let typecheck_impl i parsetree =
let implementation info ~backend =
Profile.record_call info.source_file @@ fun () ->
let sufs = if info.native then [ cmx; obj ] else [ cmo ] in
let parsed = parse_impl info in
if Clflags.(should_stop_after Compiler_pass.Parsing) then () else begin
let typed = typecheck_impl info parsed in
if Clflags.(should_stop_after Compiler_pass.Typing) then () else begin
let exceptionally () =
List.iter (fun suf -> remove_file (suf info)) sufs;
in
Misc.try_finally ~exceptionally (fun () -> backend info typed)
let exceptionally () =
let sufs = if info.native then [ cmx; obj ] else [ cmo ] in
List.iter (fun suf -> remove_file (suf info)) sufs;
in
Misc.try_finally ?always:None ~exceptionally (fun () ->
let parsed = parse_impl info in
if Clflags.(should_stop_after Compiler_pass.Parsing) then () else begin
let typed = typecheck_impl info parsed in
if Clflags.(should_stop_after Compiler_pass.Typing) then () else begin
backend info typed
end;
end;
end;
Warnings.check_fatal ();
Warnings.check_fatal ();
)