aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/ErrorReports.ml
diff options
context:
space:
mode:
authorFrançois Pottier <francois.pottier@inria.fr>2015-11-24 13:30:31 +0100
committerFrançois Pottier <francois.pottier@inria.fr>2015-11-24 13:30:31 +0100
commita663fe4774f7af2b4a189f5fea8b0b92d2d5c006 (patch)
tree085ba09d25fc6cf73a64657f781b71204a2b44d6 /cparser/ErrorReports.ml
parent08625476f659d84980ac8619f40be0472061fb83 (diff)
downloadcompcert-kvx-a663fe4774f7af2b4a189f5fea8b0b92d2d5c006.tar.gz
compcert-kvx-a663fe4774f7af2b4a189f5fea8b0b92d2d5c006.zip
Use 1-based column numbers instead of 0-based.
This seems to agree with clang and with the emacs C mode.
Diffstat (limited to 'cparser/ErrorReports.ml')
-rw-r--r--cparser/ErrorReports.ml4
1 files changed, 2 insertions, 2 deletions
diff --git a/cparser/ErrorReports.ml b/cparser/ErrorReports.ml
index a8976e42..3e46365d 100644
--- a/cparser/ErrorReports.ml
+++ b/cparser/ErrorReports.ml
@@ -233,7 +233,7 @@ let fragments text checkpoint (message : string) : string =
let report text buffer checkpoint : string =
(* Extract the position where the error occurred, that is, the start
position of the invalid token. We display it as a filename, a (1-based)
- line number, and a (0-based) column number. *)
+ line number, and a (1-based) column number. *)
let (pos, _) = last buffer in
(* Construct a readable description of where the error occurred, that is,
after which token and before which token. *)
@@ -256,7 +256,7 @@ let report text buffer checkpoint : string =
Printf.sprintf "%s:%d:%d: syntax error %s.\n%s"
pos.pos_fname
pos.pos_lnum
- (pos.pos_cnum - pos.pos_bol)
+ (pos.pos_cnum - pos.pos_bol + 1)
where
message