This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH RFA: Use $(COMPILER) to build objects
- From: Ian Lance Taylor <iant at google dot com>
- To: Paolo Bonzini <bonzini at gnu dot org>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 24 May 2009 18:30:42 -0700
- Subject: Re: PATCH RFA: Use $(COMPILER) to build objects
- References: <m3my97xapb.fsf@google.com> <gvbuch$3ge$1@ger.gmane.org>
On Sun, May 24, 2009 at 9:58 AM, Paolo Bonzini <bonzini@gnu.org> wrote:
> Ian Lance Taylor wrote:
>> This is a preliminary step toward supporting a configure option to build
>> gcc using either a C compiler or a C++ compiler. ?I think it would lead
>> to long term confusion to use $(CC) in a Makefile to represent a C++
>> compiler. ?This patch instead arranges to compile all code using
>> $(COMPILER). ?CFLAGS changes to COMPILER_FLAGS and ALL_CFLAGS changes to
>> ALL_COMPILERFLAGS. ?The COMPILER make variable is currently always set
>> to $(CC); my intent is that in the future, a configure option will
>> permit it to be set to either $(CC) or $(CXX).
>
> I am not sure it is a good idea. ?The main reason is that I think this
> --enable-cxx-for-cc option should be in gcc, not in the toplevel. ?I
> don't see any problem with CC representing a C++ compiler, since it is
> used to compile C/C++-common-subset code.
If the gcc-in-cxx project succeeds, we will want to write libcpp in
C++ as well. So, although I did not include the changes to make
libcpp use $(COMPILER), I think that making this change at top-level
is appropriate.
It's true that today the code is in the C/C++ common subset. However,
if the gcc-in-cxx project succeeds, the code will move to C++.
Despite that, there is code in gcc which will always be compiled with
a C compiler--e.g., crtstuff.c (I understand that that may move to
libgcc eventually, but the one need not be tied to the other). In any
case, in all autoconf projects $(CC) reliably is a C compiler and
$(CXX) reliably is a C++ compiler. I think that having $(CC) expand
to a C++ compiler is a recipe for future confusion. I think we should
avoid that confusion today, while we can.
Ian