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

C++: Anticipated declaration of builtins


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


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