bug-standards
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: error messages with ranges


From: Manuel López-Ibáñez
Subject: Re: error messages with ranges
Date: Wed, 14 Oct 2009 12:47:54 +0200

2009/10/14 Richard Stallman <address@hidden>:
>    The goal here is to work towards supporting caret information in GCC
>
> What is "caret information"?

I would say that it is the ability to print, in diagnostic messages,
parts of the original source code indicating exactly which parts of
the source code the diagnostic is referring to.

>
>        exprs.c:47:15:{47:8-47:14}{47:17-47:24}: error: invalid operands
>    to binary expression ('int *' and '_Complex float')
>           P = (P-42) + Gamma*4;
>               ~~~~~~ ^ ~~~~~~~
>
> Is that what "caret information" means?

The line of code with the '~~' and '^' below is the caret information.
The {47:8-47:14}{47:17-47:24} would be the "location range" information.

>
> I can see how this
>
>           P = (P-42) + Gamma*4;
>               ~~~~~~ ^ ~~~~~~~
>
> is useful for humans, and making GCC output that information
> seems like a good feature.  But why is it useful to include
> the location range information for the operands?

In principle the location range information would be only internal for
GCC. The option that enables it to be shown in the output would allow
external programs (like emacs, IDEs, a custom wrapper, or GCC's
regression tester) to parse the output of GCC. In fact, what such
programs would do is to turn OFF the caret information and turn ON the
location range information, in order to provide their own custom caret
information.

I really do not know if this format actually needs documenting in
Coding Standards, since it is not really meant for humans. I can also
update the patch to mention that this format is to be parsed by
machines, and it should not be used for output meant to be read by
humans (unless requested).

> How exactly do people propose to use that location range information?

As far as I know, at least one IDE is using it to parse the output of
Clang and provide custom caret information in the IDE interface.

Cheers,

Manuel.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]