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: [RFC] GCC caret diagnostics


"Manuel LÃpez-IbÃÃez" <lopezibanez@gmail.com> writes:

> Here is a patch that give us caret diagnostics in C/C++. There a lot
> of things that can be improved but because I wanted to get some
> feedback with my current approach.
> 
> Basically, I store a pointer linebuf in the line_map structure to a
> character in the input file buffer. The character corresponds to the
> first character in the line corresponding to TO_LINE in the line_map
> structure. The downside of this is that the buffer cannot be freed
> anymore. I am not sure whether this is better than storing a duplicate
> of the line as gfortran does. The third approach would be to store an
> offset and when generating diagnostics, reopen the file, fseek to the
> offset and print that line.
> 
> One line_map can contain information about several lines, so we still
> need to find the correct position for a line within linebuf. That is
> what the hack in expand_location is for. It would be nice to have a
> way to point directly to the beginning of each line: multiple pointers
> per line_map?

I like it.  I think the general approach is fine, but I think you
should free all the information when the frontend is complete--e.g.,
when it calls cgraph_finalize_compilation_unit.  That is, only give
caret warnings for diagnostics from the frontend.

Ian


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