From: Gabriel Dos Reis <gdr@integrable-solutions.net>
To: Roger Sayle <roger@eyesopen.com>
Cc: gcc@integrable-solutions.net, jason@redhat.com, <gcc@gcc.gnu.org>
Subject: Re: C++: Anticipated declaration of builtins.
Date: Mon, 26 May 2003 02:08:00 -0000 [thread overview]
Message-ID: <m3isrya6pk.fsf@uniton.integrable-solutions.net> (raw)
In-Reply-To: <Pine.LNX.4.44.0305251731370.364-100000@www.eyesopen.com>
Roger Sayle <roger@eyesopen.com> writes:
| Hi Gaby,
|
| > 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.
Hmm, why do we need to have two independent declarations for the same
builtin?
| 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...
If we have the same builtin declared twice with possibly two
incompatible declarations, it occurs to me that we're calling for
trouble. Is there any case where that could be useful?
| > 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.
The point is that I have been reworking some part of th name lookup
machinery, and that particular behaviour crashes the compiler until I
realized that declarations (of builtins) in the outer space is no good.
If they are supposed to be pre-declared at the global scope (as the
comment indicates), then their DECL_CONTEXT should point to
global_namespace. I'll make that change, once I understand the other
issue.
Thanks,
-- Gaby
next prev parent reply other threads:[~2003-05-26 0:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-26 0:33 Roger Sayle
2003-05-26 2:08 ` Gabriel Dos Reis [this message]
2003-05-26 2:44 ` Roger Sayle
2003-05-26 4:26 ` Gabriel Dos Reis
-- strict thread matches above, loose matches on Subject: below --
2003-05-25 22:13 gcc
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3isrya6pk.fsf@uniton.integrable-solutions.net \
--to=gdr@integrable-solutions.net \
--cc=gcc@gcc.gnu.org \
--cc=gcc@integrable-solutions.net \
--cc=jason@redhat.com \
--cc=roger@eyesopen.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).