public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* C++: Anticipated declaration of builtins.
@ 2003-05-26  0:33 Roger Sayle
  2003-05-26  2:08 ` Gabriel Dos Reis
  0 siblings, 1 reply; 5+ messages in thread
From: Roger Sayle @ 2003-05-26  0:33 UTC (permalink / raw)
  To: gcc; +Cc: jason, gcc


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.

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
--
Roger Sayle,                         E-mail: roger@eyesopen.com
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

^ permalink raw reply	[flat|nested] 5+ messages in thread
* C++: Anticipated declaration of builtins
@ 2003-05-25 22:13 gcc
  0 siblings, 0 replies; 5+ messages in thread
From: gcc @ 2003-05-25 22:13 UTC (permalink / raw)
  To: gcc; +Cc: jason


Hi,

Currently, anticipated declarations of builtin functions whose names do
not begin with underscores are done as follows:

  * a pre-declaration at the standard namespace scope std::
  * a pre-declaration at the global scope.

The actual code reads:

  /* All builtins that don't begin with an '_' should additionally
     go in the 'std' namespace.  */
  if (name[0] != '_')
    {
      push_namespace (std_identifier);
      builtin_function_1 (name, type, std_node, code, class, libname, attrs);
      pop_namespace ();
    }

  return builtin_function_1 (name, type, NULL_TREE, code,
			     class, libname, attrs);

I have two questions:

  1) Shouldn't we pre-declare the function at global scope, then do a
     using-declaration at the standard scope?

  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?

Thanks,

-- Gaby

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-05-26  2:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-26  0:33 C++: Anticipated declaration of builtins Roger Sayle
2003-05-26  2:08 ` Gabriel Dos Reis
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

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).