This is the mail archive of the 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]

Re: Builtins in `std'

>>>>> "Jason" == Jason Merrill <> writes:

    Jason> I agree that the current builtin handling is unfortunate.
    Jason> But I'm not sure that moving it into the library is the
    Jason> right path, as it creates yet another version lock between
    Jason> library and compiler.

I don't understand this point.

The library already uses `__builtin_*' all over the place:

  namespaces std {
    inline double 
    fabs(double __x) { return __builtin_fabs(__x); }
    extern "C" double fabs(double __x);

I want this code to still work, because I want us to still declare
`::__builtin_fabs' which is safely out of the user namespace.  But, I
want us to not declare `std::fabs' which is in the library namespace.
I want to make it up to the V3 people to wire the latter to the
former, as they've already done.

To be clear, I'm not proposing that the library open-code `fabs' in
the optimal assembly code or anything like that; I just want to make
the only builtins we declare in C++ be those that start with

    Jason> I like Joseph's idea; I think it would make sense to
    Jason> generalize nothrow_libfn_p to handle attributes other than
    Jason> nothrow-ness.

I didn't connect the part after the `;' with the part before, but
that's OK. :-)

I agree that in C Joseph's idea (lazily create the non __builtin
builtins as needed) makes sense.  But, in C++, I don't think we need
bother.  The key point being that in C++ it's just not legal to use
these functions without including a header that declares them, and
once you've declared them you can let the library do it's thing.

Am I talking nonsense?

Mark Mitchell         
CodeSourcery, LLC     

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