diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2014-03-21 10:40:33 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2014-03-21 10:40:33 +0000 |
commit | c7099a26a0b5fd13987454fbe9a56e2b2d711726 (patch) | |
tree | 6e2d05c4aab282082b7fa297b54143abb5b77149 | |
parent | c4f1ca931fe19f7e8e67cca6bb56dd867770d1d0 (diff) | |
download | compcert-c7099a26a0b5fd13987454fbe9a56e2b2d711726.tar.gz compcert-c7099a26a0b5fd13987454fbe9a56e2b2d711726.zip |
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
-rw-r--r-- | driver/Interp.ml | 10 |
1 files changed, 5 insertions, 5 deletions
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 -> |