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: Use $(COMPILER) to build objects


Paolo Bonzini <bonzini@gnu.org> writes:

>> 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.
>
> Whatever you can do in the toplevel, you can also do with a shared
> macro used in both libcpp and gcc.

Well, yes.  It seems natural to me to handle this as a top-level
configure option and as a top-level make variable.  That just seems more
straightforward, both for use with "make COMPILER=..." and with
"configure --enable-build-with-c++".  In general, all the handling of
compilation tools is done at the top level.  But if you prefer to handle
this specific case in a config file, I agree that that it should be
possible to work that way.


>> 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++.
>
> ... and then you'll have a patch replacing CC with CXX.  But while
> it's the common subset, I don't see anything wrong with having CC
> being a C++ compiler given you provided a rather explicit command-line
> option to do so.

I really feel that this is going to confuse people, by which I basically
mean gcc backend maintainers.  When a gcc maintainer see $(CC) in a
Makefile fragment, he or she is going to tend to assume that it is a C
compiler.  I want to use $(COMPILER) to make it very clear that it is
either a C compiler or a C++ compiler.


>> 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).
>
> They are not, crtstuff.c is compiled with GCC_FOR_TARGET.

Of course crtstuff.c is not compiled with $(CC).  But it remains true
that it is compiled with a C compiler, not a C++ compiler.  You're right
that it's GCC_FOR_TARGET when I said CC_FOR_TARGET.  But while I agree
that we can make it work if $(CC) is a C++ compiler, it's unexpected,
and I think it's confusion waiting to happen.  We should strive to make
things clear and obvious rather than rely on subtle knowledge.


> I'm still leaning towards "no", but it's more like "I haven't seen any
> good reason yet" so I'd like to hear from more maintainers.

OK.

Ian


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