This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: change the location_t type, DECL_SOURCE_LINE etc
- From: Fergus Henderson <fjh at cs dot mu dot OZ dot AU>
- To: Per Bothner <per at bothner dot com>
- Cc: gcc at gnu dot org
- Date: Wed, 4 Dec 2002 13:35:56 +1100
- Subject: Re: change the location_t type, DECL_SOURCE_LINE etc
- References: <3DEBED4D.5070106@bothner.com>
On 02-Dec-2002, Per Bothner <per@bothner.com> wrote:
> To reduce space usage we have to replace the filename by an index
> in a 'line_table'. We also have to use bit fields in order to squeeze
> everything into 32 bits. This means a limited number of different
> file names, and a limited range on line and column numbers. However,
> it is not quite a limited as the 14 and 8 suggest, since we can
> have multiple 'line_table' entries for the same filename, but with
> different line and column base values. Thus:
>
> /* The data structure used to record a location in a translation unit. */
> struct location_s GTY (())
> {
> /* An index into line_table. */
> unsigned int file_index : 10;
>
> /* The source line, relative to line_table[file_index].line_base. */
> unsigned int rline : 14;
>
> /* The source column, relative to line_table[file_index].column_base. */
> unsigned int rcolumn : 8;
> };
The C code generated by the Mercury compiler is going to overflow
those limits, I think.
Currently the longest C file generated by the Mercury compiler
is about 600,000 lines long (20,000,000 bytes).
The longest line is about 2300 characters.
There are up to about 750 header files.
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.