FreeBSD/contrib/gcc/cp/name-lookup.c
/* Same, but specify attributes to apply to the namespace.  The attributes
   only apply to the current namespace-body, not to any later extensions. */
Same, but specify attributes to apply to the namespace.  The attributes
only apply to the current namespace-body, not to any later extensions.
Same but specify attributes to apply to the namespace . The attributes only apply to the current namespace - body not to any later extensions .
void
push_namespace_with_attribs (tree name, tree attributes)
{
  tree d = NULL_TREE;
  int need_new = 1;
  int implicit_use = 0;
  bool anon = !name;
  timevar_push (TV_NAME_LOOKUP);
  gcc_assert (global_namespace != NULL && name != global_scope_name);
  if (anon)
    {
      name = get_anonymous_namespace_name();
      d = IDENTIFIER_NAMESPACE_VALUE (name);
      if (d)
	need_new = 0;
      implicit_use = 1;
    }
  else
    {
      d = IDENTIFIER_NAMESPACE_VALUE (name);
      if (d != NULL_TREE && TREE_CODE (d) == NAMESPACE_DECL)
	{
	  need_new = 0;
	  if (DECL_NAMESPACE_ALIAS (d))
	    {
	      error ("namespace alias %qD not allowed here, assuming %qD",
		     d, DECL_NAMESPACE_ALIAS (d));
	      d = DECL_NAMESPACE_ALIAS (d);
	    }
	}
    }
  if (need_new)
    {
      d = build_lang_decl (NAMESPACE_DECL, name, void_type_node);
      DECL_CONTEXT (d) = FROB_CONTEXT (current_namespace);
      if (anon || decl_anon_ns_mem_p (current_namespace))
	TREE_PUBLIC (d) = 0;
      else
	TREE_PUBLIC (d) = 1;
      pushdecl (d);
      if (anon)
	{
	  SET_DECL_ASSEMBLER_NAME (d, name);
	  DECL_NAME (d) = NULL_TREE;
	}
      begin_scope (sk_namespace, d);
    }
  else
    resume_scope (NAMESPACE_LEVEL (d));
  if (implicit_use)
    do_using_directive (d);
  current_namespace = d;
#ifdef HANDLE_PRAGMA_VISIBILITY
  current_binding_level->has_visibility = 0;
  for (d = attributes; d; d = TREE_CHAIN (d))
    {
      tree name = TREE_PURPOSE (d);
      tree args = TREE_VALUE (d);
      tree x;
      if (! is_attribute_p ("visibility", name))
	{
	  warning (OPT_Wattributes, "%qs attribute directive ignored",
		   IDENTIFIER_POINTER (name));
	  continue;
	}
      x = args ? TREE_VALUE (args) : NULL_TREE;
      if (x == NULL_TREE || TREE_CODE (x) != STRING_CST || TREE_CHAIN (args))
	{
	  warning (OPT_Wattributes, "%qs attribute requires a single NTBS argument",
		   IDENTIFIER_POINTER (name));
	  continue;
	}
      current_binding_level->has_visibility = 1;
      push_visibility (TREE_STRING_POINTER (x));
      goto found;
    }
 found:
#endif
  timevar_pop (TV_NAME_LOOKUP);
}
void push_namespace_with_attribs ( tree name , tree attributes ) { tree d = NULL_TREE ; int need_new = 1 ; int implicit_use = 0 ; bool anon = ! name ; timevar_push ( TV_NAME_LOOKUP ) ; gcc_assert ( global_namespace != NULL && name != global_scope_name ) ; if ( anon ) { name = get_anonymous_namespace_name ( ) ; d = IDENTIFIER_NAMESPACE_VALUE ( name ) ; if ( d ) need_new = 0 ; implicit_use = 1 ; } else { d = IDENTIFIER_NAMESPACE_VALUE ( name ) ; if ( d != NULL_TREE && TREE_CODE ( d ) == NAMESPACE_DECL ) { need_new = 0 ; if ( DECL_NAMESPACE_ALIAS ( d ) ) { error ( " " , d , DECL_NAMESPACE_ALIAS ( d ) ) ; d = DECL_NAMESPACE_ALIAS ( d ) ; } } } if ( need_new ) { d = build_lang_decl ( NAMESPACE_DECL , name , void_type_node ) ; DECL_CONTEXT ( d ) = FROB_CONTEXT ( current_namespace ) ; if ( anon || decl_anon_ns_mem_p ( current_namespace ) ) TREE_PUBLIC ( d ) = 0 ; else TREE_PUBLIC ( d ) = 1 ; pushdecl ( d ) ; if ( anon ) { SET_DECL_ASSEMBLER_NAME ( d , name ) ; DECL_NAME ( d ) = NULL_TREE ; } begin_scope ( sk_namespace , d ) ; } else resume_scope ( NAMESPACE_LEVEL ( d ) ) ; if ( implicit_use ) do_using_directive ( d ) ; current_namespace = d ; #ifdef HANDLE_PRAGMA_VISIBILITY current_binding_level -> has_visibility = 0 ; for ( d = attributes ; d ; d = TREE_CHAIN ( d ) ) { tree name = TREE_PURPOSE ( d ) ; tree args = TREE_VALUE ( d ) ; tree x ; if ( ! is_attribute_p ( " " , name ) ) { warning ( OPT_Wattributes , " " , IDENTIFIER_POINTER ( name ) ) ; continue ; } x = args ? TREE_VALUE ( args ) : NULL_TREE ; if ( x == NULL_TREE || TREE_CODE ( x ) != STRING_CST || TREE_CHAIN ( args ) ) { warning ( OPT_Wattributes , " " , IDENTIFIER_POINTER ( name ) ) ; continue ; } current_binding_level -> has_visibility = 1 ; push_visibility ( TREE_STRING_POINTER ( x ) ) ; goto found ; } found : #endif timevar_pop ( TV_NAME_LOOKUP ) ; }
Same, but specify attributes to apply to the namespace.
Same but specify attributes to apply to the namespace .
/* We should not get here if the global_namespace is not yet constructed
     nor if NAME designates the global namespace:  The global scope is
     constructed elsewhere.  */ /* Reopening anonymous namespace.  */ /* Check whether this is an extended namespace definition.  */ /* Make a new namespace, binding the name to it.  */ /* The name of this namespace is not visible to other translation
	 units if it is an anonymous namespace or member thereof.  */ /* Clear DECL_NAME for the benefit of debugging back ends.  */ /* Enter the name space.  */ /* Clear has_visibility in case a previous namespace-definition had a
     visibility attribute and this one doesn't.  */