This is the mail archive of the
mailing list for the GCC project.
Re: PATCH to represent column numbers using source_location
There are of course a number of solutions. I'm leaning towards (2),
as the simplest and safest.
Allow line-map.h to be #included even if line-map.o isn't linked:
(1) Don't inline linemap_position_for_column.
It is (currently) only used once in a possibly preformance-critical
location (_cpp_lex_direct), so inlining is probably desirable.
(2) Use a macro for inline linemap_position_for_column.
(3) Inline linemap_line_start as well.
This is used more often, and is bigger, so inlining may be nonoptimal.
Link in line-map.o wih gengtype etc:
(4) link line-map.o with gengtype (and anything else that inlcudes rtl.h)
Don't include line-map.h in gengtype.c:
(5) Don't #include line-map.h in rtl.h
Problem: location_t needs to be defined.
(6) Don't include line-map.h in input.h.
Problem: We will need the source_location typedef once we replace
struct location_s by source_location.
Possible fix: Move the source_location typedef to coretypes.h.