This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: cpplib: expression parser
- To: Neil Booth <NeilB at earthling dot net>
- Subject: Re: cpplib: expression parser
- From: Zack Weinberg <zack at wolery dot cumb dot org>
- Date: Fri, 31 Mar 2000 13:26:51 -0800
- Cc: gcc-patches at gcc dot gnu dot org, Jonathan Larmour <jlarmour at redhat dot co dot uk>
- References: <E12azcG-0000VU-00@monkey.rosenet.ne.jp>
On Fri, Mar 31, 2000 at 08:29:27PM +0900, Neil Booth wrote:
> This is the first of a set of patches to the preprocessor's expression
> parser. The ultimate goal is to make the code a little clearer and
> faster, and to improve the quality of the error messages.
>
> This patch fixes the following bugs:-
>
> o "#if" by itself without an expression was accepted.
>
> o "#if (2" produced an internal compiler error.
>
> o "#if 1 ? 1 ? 2 : 2 : 1" produced a "':' without '?'" error.
>
> o "#if 1 + + + 1" was accepted.
>
> o Now I understand the algorithm better, the correct fix to the bug
> Jonathan reported a couple of weeks ago:
> #if 16 * (1) + 4 == 20
> now evaluates to true rather than false, because the '+' is
> correctly interpreted as a binary operator.
>
> A bit later I'll add a series of test suites for cpplib's expression
> parser based on those I'm using for testing, which should exercise
> most operator-combination possibilities.
OK.
zw