On Fri, May 12, 2017 at 08:28:38PM +0000, Joseph Myers wrote:
> On Fri, 12 May 2017, Marek Polacek wrote:
> 
> > In the effort of reducing early folding, we should avoid calling 
> > c_fully_fold
> > blithely, except when needed for e.g. initializers.  This is a teeny tiny 
> > step
> 
> Note there are several reasons for early folding in the C front end: at 
> least (a) cases where logically needed (initializers and other places 
> where constants are needed), (b) because warnings need a folded 
> expression, (c) when the expression will go somewhere c_fully_fold does 
> not recurse inside.  Also (d) convert, at least, folds regardless of 
> whether it's actually necessary.

The C++ FE has here a folding cache.  For (a) I think one usually just
performs that once (to fold e.g. the initializer), for (b) one might want
to fold many times, when wanting to test for some warning and then finally
when folding everything (which is where a cache can help, the first time you
fold something for a warning or when folding everything if never fold
something for a warning you cache the result and then just look it up).
(c) we should fix, (d) too, or convert to (b) kind of tests - fold something
in a test to see which path should be taken, but then actually defer
folding till later.

        Jakub

Reply via email to