This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] caret diagnostics


Manuel López-Ibáñez wrote:

My proposal is to enable this while not in release mode (like we
enable checks and dump statistics and output from the optimizers), so
developers notice wrong locations and open a PR and maybe even fix
them. Then maybe let users or distributions configure the default as
they wish, with our releases defaulting to off.

Won't this have a negative effect on the test infrastructure? It sure would for our Ada testing, where we have hundreds of thousands of diagnostic messages in our test suites.

BTW, I am all in favor of caret output, it's not the default in
gnat, the default is more like the C default, but -gnatv gives
output like:

    2.    a : integer
                     |
       >>> missing ";"

    4.    a := b c;
                |
       >>> binary operator expected

    5.    a := b
                |
       >>> missing ";"

and -gnatl gives a complete listing


Compiling: k.adb

     1. procedure k is
     2.    a : integer
                      |
        >>> missing ";"

     3. begin
     4.    a := b c;
                 |
        >>> binary operator expected

     5.    a := b
                 |
        >>> missing ";"

     6.    c;
     7. end;

This last listing is interesting, it shows how GNAT pays attention to code layout in diagnostics, giving quite different messages for two cases of the same token sequence.

FWIW we find most users are aware of options like this. We make
a special attempt to encourage people to at least read through
the list of switches, even if they read no other documentation.





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]