This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: integral location_t
On Tue, Sep 23, 2003 at 11:04:35PM -0700, Per Bothner wrote:
> (fileline) 0 is specifically reserved. Can we create a fileline
> for an arbitrary filename, with a line number of 0? This could be
> used fo "unknown" or "whole file" or "line number not applicable".
Assuming we have at least 32 bits, 12 bits of which are
reserved for the column, there are 20 bits for the line
number. If we limit the number of possible lines per
file to say 1,000,000 - or rather 0xf0000 (983040), then
that leaves 16 bits for 'special values'.
#define IS_SPECIAL(lineno) ((lineno & 0xf0000) == 0xf0000)
#define FLAGS(lineno) (lineno & 0xffff)
#define UNKNOWN 0xffff
#define WHOLEFILE 0xfffe
#define NOTAPPLICIABLE 0xfffd
...
for example. It's probably better to shift everything
12 bits to the left in order to save a shift to the
right when starting with linecol (= lineno << 12 + col).
--
Carlo Wood <carlo@alinoe.com>