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: PATCH RFA: -Wc++-compat warning about ++/-- with enum value


Steve Kargl <sgk@troutmask.apl.washington.edu> writes:

> Thanks for the explanation.  Unfortunately, I disagree with 
> your assertation that I don't need to learn C++ as you move
> forward.  From codingconventions.html,
>
>    Avoid the use of identifiers or idioms that would prevent code
>    compiling with a C++ compiler.
>
> How do I recognize these identifiers and idioms with no knowledge
> of C++?

1) Learning the common subset of C and C++ does not require learning
   C++.  It requires learning to identify code which is valid C but is
   not valid C++.  The latter is a much smaller set than the former.

2) You can rely on the -Wc++-compat option.  You don't need to care
   about anything which it doesn't warn about.


> More to the point, including -Wc++-compat in CFLAGS can make it
> impossible to do a binary search to determine what revision 
> caused a regression.  Try backing out only the Fortran portion of
> r146855 and rebuild. 

I don't understand how this is different from any other compiler
warning.  Warnings do change over time.  For example, the same thing
could have occurred when we toughened up -Wparentheses.

Note that -Wc++-compat has been in CFLAGS since at least gcc 4.2, so
what is new is not -Wc++-compat, but the fact that -Wc++-compat is
getting tougher.

Ian


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