This is the mail archive of the gcc-help@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: Machine readable build log with gcc warnings


Martin Olsson <mnemo@minimum.se> writes:

> I'm working on webapp that tracks gcc warnings in a large C++ application.
> I tried grepping the build log for "warning:" which works well for simple
> single line warnings like "unused variable" etc. But g++ sometimes output
> multiline warnings like this one:
>
> file.h: In constructor âBlah::Blah()â:
> file.h:2411: warning: âBlah::secondâ will be initialized after
> file.h:2406: warning:   âSomeClass* Blah::firstâ
> file.h:2413: warning:   when initialized here
>
> ...this makes it a bit more complex to parse the build log correctly.
> If I don't special-case the multiline warning it will get counted as
> three warnings, which is not desirable in my case. Ideally, I don't
> want to parse each kind of warning separately because there are quite
> a lot of different warnings and new gcc versions might include new
> kinds of warnings and warning formatting.
>
> A) Can gcc output a machine readable build log (in XML or whatever)?

It's a reasonable request, but, no, this is not implemented.

> B) Is there a list of all warnings GCC can output somewhere?

No.  Such a list would be difficult to maintain in practice, unless it
were somehow machine generated from the source code.

Note that the warnings are emitted on multiple lines in order to provide
multiple locations relevant to the warning.  However, I think you could
make a good case that this should be using info rather than warning
lines for the second and third line here.

Ian


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