PR symtab/12704

* cp-namespace.c (ANONYMOUS_NAMESPACE_LEN): Remove.
	(cp_scan_for_anonymous_namespaces): Use CP_ANONYMOUS_NAMESPACE_STR
	and CP_ANONYMOUS_NAMESPACE_LEN.
	(cp_is_anonymous): Likewise.
	* cp-support.h (CP_ANONYMOUS_NAMESPACE_STR): Define.
	(CP_ANONYMOUS_NAMESPACE_LEN): Define.
	* dwarf2read.c (namespace_name): Likewise.
	(fixup_partial_die): Likewise.
	* linespec.c (decode_compound): If CP_ANONYMOUS_NAMESPACE_STR is
	seen in the input, keep it.
This commit is contained in:
Keith Seitz
2011-05-31 21:54:07 +00:00
parent 0a5b1e09bf
commit 2b1dbab03d
5 changed files with 38 additions and 12 deletions

View File

@@ -52,10 +52,6 @@ static struct type *cp_lookup_transparent_type_loop (const char *name,
/* Check to see if SYMBOL refers to an object contained within an
anonymous namespace; if so, add an appropriate using directive. */
/* Optimize away strlen ("(anonymous namespace)"). */
#define ANONYMOUS_NAMESPACE_LEN 21
void
cp_scan_for_anonymous_namespaces (const struct symbol *symbol)
{
@@ -76,10 +72,11 @@ cp_scan_for_anonymous_namespaces (const struct symbol *symbol)
while (name[next_component] == ':')
{
if ((next_component - previous_component) == ANONYMOUS_NAMESPACE_LEN
if (((next_component - previous_component)
== CP_ANONYMOUS_NAMESPACE_LEN)
&& strncmp (name + previous_component,
"(anonymous namespace)",
ANONYMOUS_NAMESPACE_LEN) == 0)
CP_ANONYMOUS_NAMESPACE_STR,
CP_ANONYMOUS_NAMESPACE_LEN) == 0)
{
int dest_len = (previous_component == 0
? 0 : previous_component - 2);
@@ -207,7 +204,7 @@ cp_set_block_scope (const struct symbol *symbol,
int
cp_is_anonymous (const char *namespace)
{
return (strstr (namespace, "(anonymous namespace)")
return (strstr (namespace, CP_ANONYMOUS_NAMESPACE_STR)
!= NULL);
}