This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Parseable output generation from gcc.
- To: gcc at gcc dot gnu dot org
- Subject: Parseable output generation from gcc.
- From: Eric Weiss <eweiss at apple dot com>
- Date: Mon, 11 Jun 2001 18:34:41 -0700
I have been looking into providing a means of getting gcc to report
error messages and warnings in a parseable format which is not front end
dependent.
The general goal is to provide a format for expressing messages that can
be read by an IDE quickly and accurately, where relevant data can be
extracted.
A number of methods have been discussed and I would like to get feedback
on a few of the ideas. I will explain my current approach (and then
duck;) :
A command line option would be added (-fparseable-log) to turn on
parseable formatting.
At this point output is formatted as a delimited string which contains
fields for: file name, line begin, line end, column begin, column end,
message type, message. Any field for which the front end does not
supply diagnostic context information is left empty.
We need to choose an appropriate delimiting character/sequence. To this
point, I have been using a pipe to delimit fields. I am not sure what
ramifications this may have or what option could be more appropriate....
Also, each output message should probably include a unique identifier,
indicating which invocation of the compiler is currently issuing a
complaint. There are a couple ways we have looked at doing this.... one
would be to internally generate a unique key, declare it at generation
time, and place the key in its own field of every diagnostic message.
Another would be to add another command line option which would allow an
IDE itself to pass an identifier to be associated with an invocation. I
am unclear which of these approaches (or another) would be best.
For instance, I could invoke gcc -fparseable-log -inum 2112 : or
something similar. This number would be stored, and warning/error
messages from this process would look like this:
|2112|foo.c|...|...|...|...|warn|warning message here
Otherwise, the compiler would generate this identifier itself, so you
could say
gcc -fparseable-log foo.c bar.c
and get :
foo.c
id: 2112
bar.c
id: 1001
.......
|1001|bar.c|...|...|...|...|error|blah blah blah error
|2112|foo.c|...|...|...|...|warn|blah blah blah warning
Look forward to hearing suggestions,
Thanks,
Eric Weiss