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: Add tgmath.h


Matt Austern <austern@apple.com> writes:

| On Aug 14, 2004, at 9:24 PM, Gabriel Dos Reis wrote:
| 
| > Geoff Keating <geoffk@geoffk.org> writes:
| >
| > [...]
| >
| > | I don't believe the current situation is the result of a conscious
| > | decision to not provide particular headers simply because they are
| > not
| > | part of a freestanding implementation.  Indeed, the documentation
| > says
| > | that
| > |
| > | > GCC aims towards being usable as a conforming freestanding
| > | > implementation, or as the compiler for a conforming hosted
| > | > implementation.
| > |
| > | and as the compiler for a conforming implementation, it is properly
| > | responsible for certain compiler-specific header files, like
| > tgmath.h.
| >
| > I guess I disagree with the assertion that the current situation is
| > not a conscious decision. It has always been the case that, for hosted
| > implementations, GCC explicitly expects the target to provide a C
| > library implementation. Only in few occasions do we provide our own
| > headers -- and they mostly derive from fixincludes or are required
| > for freestandaning implementation.
| 
| My feeling is that hosted vs freestanding is the wrong distinction.

I'm not saying that is the best way we should proceed. As a matter of
fact, that distinction has always seem fairly artificial to me but
that is another debate.  I'm merely describing what we currently do.
As I said in the rest of my previous message, I would not object to a
clear policy concerning tigher coupling of the C library
implementatoin, what we expect and what users should expect.

| Yes, obviously we need to provide all the headers that are required
| for a freestanding implementation.  But we also need to provide
| headers that a compiler-neutral C library implementation can't
| reasonably provide on its own.

I don't think that is sufficient if we wanted to have a conforming
hosted implementation.  We should be providing also all headers
we need for our hosted components implementations -- not just those we
believe cannot be written in a compiler neutral fashion.  Again I can
give the libstdc++ example.  I'm pretty sure the situation would
improve for C too.

| At present, I believe the only such header is tgmath.h.  There just
| isn't any way to write it in portable C; it requires compiler magic.
| It tells the compiler to use Fortran-like overload resolution rules
| when processing certain kinds of function calls, instead of normal
| C.  It just doesn't make sense to expect that a C library, written in
| isolation from a compiler and intended to work with multiple
| compilers, should do that.

But the fact is that for GCC targets, most of them don't provide a C
library in isolation from a compiler.  Rather, they do provide the
header with assumption based on the system compiler.  Glibc systems
assume GCC, Solaris-9 has C++-aware C headers because they wrote their
headers with their compiler in mind -- and that defeats proper
deployment of our libstdc++ on that target -- and so on.

| I simply see no advantage to our saying that providing tgmath.h
| is the OS vendors' responsibility.  The practical consequence of
| that will be that lots of OSs won't provide one at all, that others
| will provide a tgmath that's unusable with gcc, and that still others
| will provide poor implementations that don't use gcc extensions
| as well as they might.


If you want to change that common assumption, that is fine with me.
However, I maintain that we should clearly state what GCC expects and
what users can except from GCC, for a conforming hosted implementation.
I don't want us, to strech things as we go. What about <fenv.h>? 

| (And if this sounds like a messy distinction, instead of the simple
| hosted-vs-freestanding criterion---well, that's because it is.  The
| C standard has some features that can't be classified cleanly as
| compiler or library.  This is one of them.)

My point was not to classify a freestanfding vs. hosted.  Rather it
recalled the existing assumption of implementation,s some of its
deficiencies and stated that the situation could be improved if we had
close connection between the compiler and the C library
implementation.  However such policy should be clearly defined.

-- Gaby


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