This is the mail archive of the
mailing list for the GCC project.
C++: Anticipated declaration of builtins.
- From: Roger Sayle <roger at eyesopen dot com>
- To: gcc at integrable-solutions dot net
- Cc: jason at redhat dot com, <gcc at gcc dot gnu dot org>
- Date: Sun, 25 May 2003 17:45:29 -0600 (MDT)
- Subject: C++: Anticipated declaration of builtins.
> 1) Shouldn't we pre-declare the function at global scope, then
> do a using-declaration at the standard scope?
The problem here is that they need to be treated as two independent
pre-declarations. If a prototype or declaration is given for
one, it does not automatically anticipate/declare the other. Hence,
we require separate DECLs with independent DECL_ANTICIPATED flags.
Similarly, the user-provided declaration/prototype in one namespace
could be compatible with the predeclared type, and hence use the
builtin's functionality, but the declaration given in the other
namespace incompatible, overrides the anticipated functionality
and providing it's own definition, DECL_RTL, etc...
> 2) Why doesn't the second call to builtin_function_1() specify
> global_namespace instead of NULL_TREE? I think specifying
> global_namespace should be the way to go. What I am missing?
For this I have no good answer. The original code used NULL_TREE
when I added the additional call to also anticipate the declaration
in the std:: namespace. I've no problem with you changing it if
that's more correct thing to do, and it passes regression checking.
I hope this helps,
Roger Sayle, E-mail: firstname.lastname@example.org
OpenEye Scientific Software, WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road, Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507. Fax: (+1) 505-473-0833