aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2016-01-11 14:37:35 +0100
committerBernhard Schommer <bernhardschommer@gmail.com>2016-01-11 14:37:35 +0100
commitca055fc22c3b9d0ac6bbd394562933aa3e044c95 (patch)
tree1fc60a3fe7ed6b3a442cf733839663efd9f1267b
parent69d6a2c1e08e6169af95bf895d6b0380edb0d081 (diff)
downloadcompcert-kvx-ca055fc22c3b9d0ac6bbd394562933aa3e044c95.tar.gz
compcert-kvx-ca055fc22c3b9d0ac6bbd394562933aa3e044c95.zip
More descriptive error message for failed command.
CompCert now prints if the assembler, linker or preprocessor command failed and a hint for the user to get the full command line. Bug 17894
-rw-r--r--driver/Driver.ml18
1 files changed, 14 insertions, 4 deletions
diff --git a/driver/Driver.ml b/driver/Driver.ml
index 8509e84a..352cbe41 100644
--- a/driver/Driver.ml
+++ b/driver/Driver.ml
@@ -60,6 +60,9 @@ let command ?stdout args =
argv.(0) fn (Unix.error_message err) param;
-1
+let command_error n exc =
+ eprintf "Error: %s command failed with exit code %d (use -v to see invocation)\n" n exc
+
let safe_remove file =
try Sys.remove file with Sys_error _ -> ()
@@ -106,8 +109,10 @@ let preprocess ifile ofile =
List.rev !prepro_options;
[ifile]
] in
- if command ?stdout:output cmd <> 0 then begin
+ let exc = command ?stdout:output cmd in
+ if exc <> 0 then begin
if ofile <> "-" then safe_remove ofile;
+ command_error "preprocessor" exc;
eprintf "Error during preprocessing.\n";
exit 2
end
@@ -246,9 +251,10 @@ let assemble ifile ofile =
List.rev !assembler_options;
[ifile]
] in
- if command cmd <> 0 then begin
+ let exc = command cmd in
+ if exc <> 0 then begin
safe_remove ofile;
- eprintf "Error during assembling.\n";
+ command_error "assembler" exc;
exit 2
end
@@ -263,7 +269,11 @@ let linker exe_name files =
then ["-L" ^ !stdlib_path; "-lcompcert"]
else [])
] in
- if command cmd <> 0 then exit 2
+ let exc = command cmd in
+ if exc <> 0 then begin
+ command_error "linker" exc;
+ exit 2
+ end
(* Processing of a .c file *)