This is the mail archive of the 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]

[RFC] GCC caret diagnostics

Dear all,

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?

Well, comments, ideas, code, questions, help are all welcome.



Attachment: caret-diagnostics.diff
Description: Text document

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