tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] _Generic or __builtin_choose_expr


From: Michael Matz
Subject: Re: [Tinycc-devel] _Generic or __builtin_choose_expr
Date: Fri, 30 Jun 2017 18:05:58 +0200 (CEST)
User-agent: Alpine 2.20 (LSU 67 2015-01-07)

Hi,

On Fri, 30 Jun 2017, uso ewin wrote:

> I'd like to do that, problem is with default:
> if we encounter a default,
> we need to remember that there is a default in the generic,
> but we need to continue parsing generic expression to check
> if there is a type that match, and with you technique we can't go back and
> re-evaluate default if at the end, no match was found.

Aw, crap, right, they've introduced more syntax that defeats single-pass 
parsing.  Okay, then your token saving code is nevertheless buggy 
I think.  E.g. what are you using 'i' for: you sometimes increase it, but 
zero it always, and never make use of it.  And this code will be wrong 
when presented with an expression like 'call(a,b)' because of the skipping 
on ','.  Instead of doing it yourself try to use skip_or_save_block.  
Despite its name it can also be used to skip expressions (i.e. stops at 
outer ',') and should be usable here.

(You also don't make use of the outer buf[], so remove it and its 
setting).  Oh, and your call to unary() should be expr_eq, the accepted 
expressions after the ':' are assignment-expression, not just unaries.


Ciao,
Michael.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]