This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [CPP] fix some diagnostic locations
- From: Tom Tromey <tromey at redhat dot com>
- To: Manuel LÃpez-IbÃÃez <lopezibanez at gmail dot com>
- Cc: "Gcc Patch List" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 31 Oct 2008 10:29:58 -0600
- Subject: Re: [CPP] fix some diagnostic locations
- References: <6c33472e0810301925q10195dcbw43e84ffbcf157d70@mail.gmail.com>
- Reply-to: tromey at redhat dot com
>>>>> "Manuel" == Manuel LÃpez-IbÃÃez <lopezibanez@gmail.com> writes:
Manuel> The way CPP builds expressions loses track of the locations of
Manuel> subexpressions. The result is that CPP often points to the
Manuel> wrong location, typically the end of the line. This patch
Manuel> propagates the correct locations.
Thanks.
Manuel> OK for trunk?
Yes, with a little nit fixed; see below.
FWIW -- I have an unfinished patch here that fixes this problem (in a
different way) plus a number of other location-related problems in
libcpp. I went through most of the cpp test cases in gcc and fixed
them to use column numbers.
The patch breaks some location handling in traditional mode, though,
so I haven't checked it in. If you plan to do more work in this area,
and you'd like it as a starting point, I can send it.
Manuel> top[-1].value = num_unary_op (pfile, top->value, top->op);
Manuel> + top[-1].loc = top->loc;
Don't line up the '='. There are a few cases of this.
Tom