diff options
Diffstat (limited to 'contrib/gcc/cp/name-lookup.c')
-rw-r--r-- | contrib/gcc/cp/name-lookup.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/contrib/gcc/cp/name-lookup.c b/contrib/gcc/cp/name-lookup.c index 744dd5c..4d08174 100644 --- a/contrib/gcc/cp/name-lookup.c +++ b/contrib/gcc/cp/name-lookup.c @@ -61,6 +61,24 @@ tree global_namespace; unit. */ static GTY(()) tree anonymous_namespace_name; +/* Initialise anonymous_namespace_name if necessary, and return it. */ + +static tree +get_anonymous_namespace_name(void) +{ + if (!anonymous_namespace_name) + { + /* The anonymous namespace has to have a unique name + if typeinfo objects are being compared by name. */ + if (! flag_weak || ! SUPPORTS_ONE_ONLY) + anonymous_namespace_name = get_file_function_name ("N"); + else + /* The demangler expects anonymous namespaces to be called + something starting with '_GLOBAL__N_'. */ + anonymous_namespace_name = get_identifier ("_GLOBAL__N_1"); + } + return anonymous_namespace_name; +} /* Compute the chain index of a binding_entry given the HASH value of its name and the total COUNT of chains. COUNT is assumed to be a power @@ -3011,11 +3029,7 @@ push_namespace_with_attribs (tree name, tree attributes) if (anon) { - /* The name of anonymous namespace is unique for the translation - unit. */ - if (!anonymous_namespace_name) - anonymous_namespace_name = get_file_function_name ('N'); - name = anonymous_namespace_name; + name = get_anonymous_namespace_name(); d = IDENTIFIER_NAMESPACE_VALUE (name); if (d) /* Reopening anonymous namespace. */ |