The following patches for libcpp (and gcc) are an attempt at making the libcpp API and internal representation easier to understand and to hack on, simplifying it (IMHO) with a modest amount of C++, without changing its behavior.
See the individual patches for their descriptions. How do these look? (for trunk) I've successfully bootstrapped®rtested the cumulative effect of the patches on x86_64-unknown-linux-gnu (Fedora 20). I would verify the bootstrap®rtest of each patch before applying them. I didn't do any performance testing; what would be appropriate? David Malcolm (4): libcpp: Improvements to comments in line-map.h/c libcpp: Replace macro usage with C++ constructs libcpp/input.c: Add a way to visualize the linemaps Replace line_map union with C++ class hierarchy gcc/ada/gcc-interface/trans.c | 2 +- gcc/c-family/c-common.h | 4 +- gcc/c-family/c-lex.c | 6 +- gcc/c-family/c-opts.c | 14 +- gcc/c-family/c-ppoutput.c | 6 +- gcc/common.opt | 4 + gcc/diagnostic.c | 2 +- gcc/fortran/cpp.c | 12 +- gcc/genmatch.c | 4 +- gcc/input.c | 244 +++++++++++++- gcc/input.h | 2 + gcc/toplev.c | 3 + gcc/tree-diagnostic.c | 9 +- libcpp/directives.c | 17 +- libcpp/files.c | 2 +- libcpp/include/cpplib.h | 2 +- libcpp/include/line-map.h | 735 +++++++++++++++++++++++++++++++----------- libcpp/internal.h | 12 +- libcpp/line-map.c | 243 ++++++++------ libcpp/location-example.txt | 216 +++++++++++++ libcpp/macro.c | 18 +- 21 files changed, 1204 insertions(+), 353 deletions(-) create mode 100644 libcpp/location-example.txt -- 1.8.5.3