[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: column numbers and ranges in error messages
From: |
Per Bothner |
Subject: |
Re: column numbers and ranges in error messages |
Date: |
Sun, 30 Sep 2018 22:46:01 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 |
On 9/30/18 4:06 PM, Per Bothner wrote:
Two related issues about section "4.4 Formatting Error Messages"
(https://www.gnu.org/prep/standards/html_node/Errors.html):
(1) "The error message can also give both the starting and ending positions of the
erroneous text."
This is ambiguous wrt respect to whether end positions are exclusive or
inclusive.
In most APIs I'm familiar that talk about ranges (such as a substring function), an
"end position"
is exclusive (but is zero-based). However, it seems clear to me that we want
*inclusive* ranges;
one reason is that otherwise you would never have a duplicate line numbers.
I think I'm wrong here: Exclusive end positions are ok. (I was thinking in
terms
of a line range being delimited by an exclusive end line number, but that is
not relevant.)
I haven't found real examples of code that emits
sourcefile:line1.column1-line2.column2: message
or
sourcefile:line1:column1-line2:column2: message
However, gcc's and clang's -fdiagnostics-parseable-fixits (and clang's
-fdiagnostics-print-source-range-info)
options emit sources ranges with exclusive end-points. However, the ranges are
meant to be
machine-parsable, are inside braces, and count bytes rather than characters, so
may not be
directly relevant.
--
--Per Bothner
address@hidden http://per.bothner.com/
- Re: column numbers and ranges in error messages,
Per Bothner <=