This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C PATCH] Follow-up fix to the misclassified token problem (PR c/67784)
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 26 Apr 2016 11:44:52 +0000
- Subject: Re: [C PATCH] Follow-up fix to the misclassified token problem (PR c/67784)
- Authentication-results: sourceware.org; auth=none
- References: <20160426112900 dot GF28445 at redhat dot com>
On Tue, 26 Apr 2016, Marek Polacek wrote:
> This PR was reopened, because the exact same problem with treating a TYPENAME
> wrongly as an ID was found when using just if-clause, without an enclosing for
> loop. More details: <https://gcc.gnu.org/ml/gcc-patches/2015-11/msg01588.html>.
> That fix had a follow-up, because it broke some ObjC code.
>
> To fix this, we need to use the (amended) token reclassification even when
> parsing an if statement. I factored the code into a separate function so as to
> not repeat the very same code.
>
> Bootstrapped/regtested on x86_64-linux, ok for trunk?
I think you need more thorough testcases, to cover the cases where the if
statement with no else forms the body of a switch or while statement, and
the declaration in question appears in the expression of that switch or
while statement, e.g.
typedef int T;
switch (sizeof (enum { T }))
if (1)
;
T x;
--
Joseph S. Myers
joseph@codesourcery.com