aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2011-05-31 21:54:07 +0000
committerKeith Seitz <keiths@redhat.com>2011-05-31 21:54:07 +0000
commit2b1dbab03d9b512f15900cb274f69214bd88d3bc (patch)
tree5585a8b827c7e5c67067a6d2e1e07c67572afb57
parent0a5b1e09bf62fcbe776eb641640f802f64bb6169 (diff)
downloadgdb-2b1dbab03d9b512f15900cb274f69214bd88d3bc.zip
gdb-2b1dbab03d9b512f15900cb274f69214bd88d3bc.tar.gz
gdb-2b1dbab03d9b512f15900cb274f69214bd88d3bc.tar.bz2
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.
-rw-r--r--gdb/ChangeLog14
-rw-r--r--gdb/cp-namespace.c13
-rw-r--r--gdb/cp-support.h8
-rw-r--r--gdb/dwarf2read.c4
-rw-r--r--gdb/linespec.c11
5 files changed, 38 insertions, 12 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5a80e27..2397534 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,17 @@
+2010-05-31 Keith Seitz <keiths@redhat.com>
+
+ 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.
+
2011-05-30 Pedro Alves <pedro@codesourcery.com>
* target.h (enum inferior_event_type): Delete INF_QUIT_REQ.
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index 00c68b3..7ff7bf7 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -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);
}
diff --git a/gdb/cp-support.h b/gdb/cp-support.h
index 57aa03a..52d4cb7 100644
--- a/gdb/cp-support.h
+++ b/gdb/cp-support.h
@@ -36,6 +36,14 @@ struct objfile;
struct type;
struct demangle_component;
+/* A string representing the name of the anonymous namespace used in GDB. */
+
+#define CP_ANONYMOUS_NAMESPACE_STR "(anonymous namespace)"
+
+/* The length of the string representing the anonymous namespace. */
+
+#define CP_ANONYMOUS_NAMESPACE_LEN 21
+
/* This struct is designed to store data from using directives. It
says that names from namespace IMPORT_SRC should be visible within
namespace IMPORT_DEST. These form a linked list; NEXT is the next
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 01a9467..29ca473 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -7877,7 +7877,7 @@ namespace_name (struct die_info *die, int *is_anonymous, struct dwarf2_cu *cu)
*is_anonymous = (name == NULL);
if (*is_anonymous)
- name = "(anonymous namespace)";
+ name = CP_ANONYMOUS_NAMESPACE_STR;
return name;
}
@@ -9547,7 +9547,7 @@ fixup_partial_die (struct partial_die_info *part_die,
/* Set default names for some unnamed DIEs. */
if (part_die->name == NULL && part_die->tag == DW_TAG_namespace)
- part_die->name = "(anonymous namespace)";
+ part_die->name = CP_ANONYMOUS_NAMESPACE_STR;
/* If there is no parent die to provide a namespace, and there are
children, see if we can determine the namespace from their linkage
diff --git a/gdb/linespec.c b/gdb/linespec.c
index dcb80ff..8ee721b 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -1430,8 +1430,15 @@ decode_compound (char **argptr, int funfirstline,
{
/* PASS2: We'll keep getting here, until P points to one of the
break characters, at which point we exit this loop. */
- if (*p && strchr (break_characters, *p) == NULL)
- p++;
+ if (*p)
+ {
+ if (p[1] == '('
+ && strncmp (&p[1], CP_ANONYMOUS_NAMESPACE_STR,
+ CP_ANONYMOUS_NAMESPACE_LEN) == 0)
+ p += CP_ANONYMOUS_NAMESPACE_LEN;
+ else if (strchr (break_characters, *p) == NULL)
+ ++p;
+ }
}
}