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: C++ PATCH: PR 9924


Jason Merrill wrote:
> Mark Mitchell wrote:
> > This patch fixes PR 9924, a problem with builtins and using
> > declarations.
> >
> > (Remind me again why builtins aren't just marked specially when the
> > function is declared in C++?  Since functions can't be called without
> > a prototype in C++, creating all the builtins up front is just an
> > error-prone, wasteful way of getting where we want to get...)
>
> That's my preferred strategy, too, but Roger Sayle seems to have
> disagreed, and he was the one writing the code.

I'd be the last person to argue the current situation is ideal.  Please
remember that all four of g++'s schemes for handling builtins in predate
my involvement.  Infact the situation got so out of control, that the
g++ front-end maintainers just completely disabled built-ins for 3.0,
prior to my first GCC patch submission.  I'm just the poor sole trying
to pull things back into some sort of shape.

As Zack has pointed out getting this unified is a pre-requiste to
changing the way things are done.  [You weren't seriously proposing
a sixth built-in mechanism were you? :>]  For example, unifying
exception handling by exposing exceptions in C, would help much.


Its not that I disagree with a strategy that recognizes declarations
as they're defined, its just that's no-one's written or even proposed
a workable solution along those lines.  And the current mechanisms for
"builtin declaration recognition" in g++ are remarkably inefficient.
Linear searches vs. the hash-table identifier lookups for duplicate
declarations.  Remember that C++ has to lookup duplicate declarations
anyway, so this bit is free, even if the spagetti-code in cp/decl.c's
duplicate_decls is an error-prone nightmare.  The equivalent code in
C, java and FORTRAN is also ugly, but C++'s is particularly buggy.

In the meantime, I'm just trying to fix the bugs in GCC's current
machinery.  If something better comes along, I'll fix the bugs there
too/instead.


Nobody's even commented on my suggestion of using the PCH machinery
to efficiently preload the builtins DECLs from iso90.gch, iso99.gch
or a g++.gch.

My long term dream is that some day g++ will convert "v.size() == 0"
into "v.empty()" where v is any of the standard STL container templates,
such as std::vector<T>.  Our current infrastructure is so far from
being able to handle this, its almost science fiction.

Roger
--


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