This is the mail archive of the 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: PATCH RFA: -Wc++-compat warning about operator names

On Fri, Jun 12, 2009 at 1:45 PM, Ian Lance Taylor<> 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.

-- Gaby

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