This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH RFA: -Wc++-compat warning about ++/-- with enum value
On Thu, May 14, 2009 at 09:57:40AM -0700, Ian Lance Taylor wrote:
> Steve Kargl <sgk@troutmask.apl.washington.edu> writes:
>
> > On Thu, May 14, 2009 at 08:44:27AM -0700, Ian Lance Taylor wrote:
> >>
> >> Bootstrapped and tested on i686-pc-linux-gnu. OK for mainline?
> >>
> >
> > Can you please explain why there is a need to
> > make the code compilable with a C++ compiler?
> > Do I need to now learn C++, so I don't run afoul
> > of your effort?
>
> The goal of writing gcc such that it can be compiled with a C++ compiler
> has been present for a long time. It is listed here under Portability:
> http://gcc.gnu.org/codingconventions.html
>
> I am working on a long-term project to write gcc in C++:
> http://gcc.gnu.org/wiki/gcc-in-cxx
> This has been discussed at some length on the gcc@ mailing list. Some
> people are in favor, some are opposed. Nobody has expressed strong
> opposition to the intermediate goal of writing gcc in the common subset
> of C and C++ (I discount some mutterings and grumblings). This patch is
> part of that intermediate goal.
>
> You do not need to learn C++ currently, as the -Wc++-compat warning will
> prevent you from writing code which is not in the common subset of C and
> C++. In the future, if gcc does switch to C++, you may need to learn
> some C++ (the fortran frontend can remain in the common C/C++ subset if
> the fortran maintainers prefer that). Although C++ is a complex
> language, the complexity is largely in the interactions of different
> aspects which are in themselves reasonably straightforward. There is no
> reason to think that gcc will rely on that complexity. I expect that
> the parts of C++ which gcc maintainers will need to understand will be
> simpler than, say, understanding gcc/vec.h.
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++?
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.
--
Steve