[Bug c/84888] C/C++: Improve wording of unclosed paren/brace
egallager at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Mar 16 05:03:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84888
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |egallager at gcc dot gnu.org
--- Comment #1 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to David Malcolm from comment #0)
> As noted by oridb on reddit:
>
> > I also find the large, visually complex error messages confusing to
> > read. For example, this makes me skim and see 3 separate errors:
> >
> > t.c: In function ‘log_when_out_of_range’:
> > t.c:12:50: error: expected ‘)’ before ‘{’ token
> > && (temperature < MIN || temperature > MAX) {
> > ^~
> > )
> > unclosed.c:11:6: note: to match this ‘(’
> > if (logging_enabled && check_range ()
> > ^
> > I'd rather see something like this (although, I admit the phrasing could use work):
> >
> > t.c:12:50: error: expected ')' for unclosed '(' on t.c:11:6
> > && (temperature < MIN || temperature > MAX) {
> > ^~
> > )
>
> I much prefer oridb's proposed wording to what we have now (in gcc 8),
> though I'd prefer to keep the note; I'll open another bug with some ideas I
> have about making multiple diagnostics easier on the eye.
>
> Maybe (brainstorming here):
>
> If it's on the same line:
>
> t.c:12:50: error: expected ')' for unclosed '(' on column 6
>
> If it's in the same file:
>
> t.c:12:50: error: expected ')' for unclosed '(' at line 11 column 6
>
> If it's in a different file:
>
> t.c:12:50: error: expected ')' for unclosed '(' at other.c:11:6
>
> (Or maybe it's better to always give the same format, to make it easier for
> IDEs to parse?)
As in bug 84887, I'd like a link to the reddit thread mentioned here, too
More information about the Gcc-bugs
mailing list