This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Candidate fix for PR 15007


Zack Weinberg <zack@codesourcery.com> writes:

> It seems to me that the most straightforward way to fix PR 15007 is to
> avoid generating a TRANSLATION_UNIT_DECL at all until we're done
> parsing the entire translation unit.  This mirrors what is done with
> BLOCK nodes - we create them only when the scope is popped.
> Fortunately, DECL_FILE_SCOPE_P can already handle this, so the change
> is limited to c-decl.c.

This isn't exactly what your patch does.  If I'm reading it right, it
defers creating the TRANSLATION_UNIT_DECL until the first global
declaration is seen.  The approach you described would have been
trouble, but the one actually implemented looks like it would work.

-- 
- Geoffrey Keating <geoffk@geoffk.org>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]