This is the mail archive of the
mailing list for the GCC project.
Re: PATCH RFA: -Wc++-compat warning about operator names
- From: Gabriel Dos Reis <dosreis at gmail dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 12 Jun 2009 13:50:55 -0500
- Subject: Re: PATCH RFA: -Wc++-compat warning about operator names
- References: <firstname.lastname@example.org>
- Reply-to: gdr at integrable-solutions dot net
On Fri, Jun 12, 2009 at 1:45 PM, Ian Lance Taylor<email@example.com> wrote:
> The -Wc++-compat option warns about the use of C++ reserved words, but
> it does not warn about the use of C++ operator names. ?These are 11
> special names like "and" which C++ must be treated as operators. ?For
> example, "i and b" in C++ is equivalent to "i && b".
> This patch modifies -Wc++-compat to also warn about these operator
> names. ?This must be done in the preprocessor code, because the operator
> names work in preprocessor # lines just as they do in regular code.
> This patch also fixes the one case in the main gcc source code where a
> C++ operator name is used as an identifier--some code in fold-const.c
> uses a local variable named "and".
> This requires approval from a C or C++ frontend maintainer.
> Bootstrapped and tested on x86_64-unknown-linux-gnu. ?OK for mainline?
Note that those names are also standard C macro names, therefore
it makes sense to warn about those in -Wextra even if no -Wc++-compat.
Otherwise, the patch is OK by me.