From c7099a26a0b5fd13987454fbe9a56e2b2d711726 Mon Sep 17 00:00:00 2001 From: xleroy Date: Fri, 21 Mar 2014 10:40:33 +0000 Subject: Error messages were not displayed correctly if the main() function is missing or has the wrong type. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2433 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- driver/Interp.ml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'driver/Interp.ml') diff --git a/driver/Interp.ml b/driver/Interp.ml index 5975ae39..af657890 100644 --- a/driver/Interp.ml +++ b/driver/Interp.ml @@ -622,7 +622,7 @@ let rec find_main_function name = function let fixup_main p = match find_main_function p.prog_main p.prog_defs with | None -> - fprintf err_formatter "ERROR: no main() function"; + fprintf err_formatter "ERROR: no main() function@."; None | Some main_fd -> match type_of_fundef main_fd with @@ -632,7 +632,7 @@ let fixup_main p = Tint _, _) as ty -> Some (change_main_function p p.prog_main ty) | _ -> - fprintf err_formatter "ERROR: wrong type for main() function"; + fprintf err_formatter "ERROR: wrong type for main() function@."; None (* Execution of a whole program *) @@ -643,17 +643,17 @@ let execute prog = pp_set_max_indent p 30; pp_set_max_boxes p 10; match fixup_main prog with - | None -> () + | None -> exit 126 | Some prog1 -> let wprog = world_program prog1 in let wge = Genv.globalenv wprog in match Genv.init_mem wprog with | None -> - fprintf p "ERROR: World memory state undefined@." + fprintf p "ERROR: World memory state undefined@."; exit 126 | Some wm -> match Cexec.do_initial_state prog1 with | None -> - fprintf p "ERROR: Initial state undefined@." + fprintf p "ERROR: Initial state undefined@."; exit 126 | Some(ge, s) -> match !mode with | First | Random -> -- cgit