This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Reject invalid specifiers for virtual functions
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: reichelt at igpm dot rwth-aachen dot de (Volker Reichelt)
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 9 Dec 2005 10:20:56 -0500 (EST)
- Subject: Re: [patch] Reject invalid specifiers for virtual functions
>
> The following patch addresses the problem that we currently accept
> invalid pure specifiers for virtual functions like the following
>
> virtual void foo () = 0l;
>
> since we only check integer_zerop in cp_parser_pure_specifier.
> To make sure that the pure specifier is really just '0' we
> need some support from the lexer.
>
> The following patch adds NAMED_OP to the cpp_flags in c_lex_with_flags
> when a single '0' is encountered.
> In cp_parser_pure_specifier we then check for NAMED_OP to identify a
> correct pure specifier.
>
> I tried to change the lexer as few as possible and stay completely out
> of libcpp. Therefore I chose to reuse an already existing flag from the
> cpp_token structure - and NAMED_OP is the only C++ specific one.
>
> Btw, as I found out after writing the patch, there's a similar one
> (that never got finished AFAIK) by Michael Matz:
> http://gcc.gnu.org/ml/gcc-patches/2004-02/msg02318.html
>
>
> Bootstrapped and regtested on x86_64-unknown-linux-gnu.
> Ok for mainline?
And this is PR 23333.
-- Pinski