diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2015-04-21 13:36:21 +0200 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2015-04-21 13:36:21 +0200 |
commit | 84a96e92562461260f7f557d8b973f0f48807e78 (patch) | |
tree | f98665a9f3580c3a6c0b19cc9e5b51f0d30f11d2 /cfrontend | |
parent | 832685e5dc7c17c434146d353b60c2158e3edd11 (diff) | |
download | compcert-84a96e92562461260f7f557d8b973f0f48807e78.tar.gz compcert-84a96e92562461260f7f557d8b973f0f48807e78.zip |
Use Cerrors for error reporting instead of rolling our own reporting in C2C.
Diffstat (limited to 'cfrontend')
-rw-r--r-- | cfrontend/C2C.ml | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/cfrontend/C2C.ml b/cfrontend/C2C.ml index 44d16502..b6b9defe 100644 --- a/cfrontend/C2C.ml +++ b/cfrontend/C2C.ml @@ -114,18 +114,14 @@ let currentLocation = ref Cutil.no_loc let updateLoc l = currentLocation := l -let numErrors = ref 0 - let error msg = - incr numErrors; - eprintf "%aError: %s\n" Cutil.printloc !currentLocation msg + Cerrors.error "%aError: %s" Cutil.formatloc !currentLocation msg let unsupported msg = - incr numErrors; - eprintf "%aUnsupported feature: %s\n" Cutil.printloc !currentLocation msg + Cerrors.error "%aUnsupported feature: %s" Cutil.formatloc !currentLocation msg let warning msg = - eprintf "%aWarning: %s\n" Cutil.printloc !currentLocation msg + Cerrors.warning "%aWarning: %s\n" Cutil.formatloc !currentLocation msg let string_of_errmsg msg = let string_of_err = function @@ -1237,7 +1233,7 @@ let public_globals gl = (** Convert a [C.program] into a [Csyntax.program] *) let convertProgram p = - numErrors := 0; + Cerrors.reset(); stringNum := 0; Hashtbl.clear decl_atom; Hashtbl.clear stringTable; @@ -1262,9 +1258,7 @@ let convertProgram p = prog_main = intern_string "main"; prog_types = typs; prog_comp_env = ce } in - if !numErrors > 0 - then None - else Some p' + if Cerrors.check_errors () then None else Some p' with Env.Error msg -> error (Env.error_message msg); None |